Filter isolates on results in specific antimicrobial classes. This makes it easy to filter on isolates that were tested for e.g. any aminoglycoside, or to filter on carbapenem-resistant isolates without the need to specify the drugs.

filter_ab_class(x, ab_class, result = NULL, scope = "any", ...)

filter_aminoglycosides(x, result = NULL, scope = "any", ...)

filter_carbapenems(x, result = NULL, scope = "any", ...)

filter_cephalosporins(x, result = NULL, scope = "any", ...)

filter_1st_cephalosporins(x, result = NULL, scope = "any", ...)

filter_2nd_cephalosporins(x, result = NULL, scope = "any", ...)

filter_3rd_cephalosporins(x, result = NULL, scope = "any", ...)

filter_4th_cephalosporins(x, result = NULL, scope = "any", ...)

filter_5th_cephalosporins(x, result = NULL, scope = "any", ...)

filter_fluoroquinolones(x, result = NULL, scope = "any", ...)

filter_glycopeptides(x, result = NULL, scope = "any", ...)

filter_macrolides(x, result = NULL, scope = "any", ...)

filter_penicillins(x, result = NULL, scope = "any", ...)

filter_tetracyclines(x, result = NULL, scope = "any", ...)

Arguments

x

a data set

ab_class

an antimicrobial class, like "carbapenems". The columns group, atc_group1 and atc_group2 of the antibiotics data set will be searched (case-insensitive) for this value.

result

an antibiotic result: S, I or R (or a combination of more of them)

scope

the scope to check which variables to check, can be "any" (default) or "all"

...

previously used when this package still depended on the dplyr package, now ignored

Details

All columns of x will be searched for known antibiotic names, abbreviations, brand names and codes (ATC, EARS-Net, WHO, etc.). This means that a filter function like e.g. filter_aminoglycosides() will include column names like 'gen', 'genta', 'J01GB03', 'tobra', 'Tobracin', etc.

Stable lifecycle


The lifecycle of this function is stable. In a stable function, major changes are unlikely. This means that the unlying code will generally evolve by adding new arguments; removing arguments or changing the meaning of existing arguments will be avoided.

If the unlying code needs breaking changes, they will occur gradually. For example, a argument will be deprecated and first continue to work, but will emit an message informing you of the change. Next, typically after at least one newly released version on CRAN, the message will be transformed to an error.

See also

Examples

filter_aminoglycosides(example_isolates)

# \donttest{
if (require("dplyr")) {

  # filter on isolates that have any result for any aminoglycoside
  example_isolates %>% filter_aminoglycosides()
  example_isolates %>% filter_ab_class("aminoglycoside")

  # this is essentially the same as (but without determination of column names):
  example_isolates %>%
    filter_at(.vars = vars(c("GEN", "TOB", "AMK", "KAN")),
              .vars_predicate = any_vars(. %in% c("S", "I", "R")))


  # filter on isolates that show resistance to ANY aminoglycoside
  example_isolates %>% filter_aminoglycosides("R", "any")
 
  # filter on isolates that show resistance to ALL aminoglycosides
  example_isolates %>% filter_aminoglycosides("R", "all")
 
  # filter on isolates that show resistance to
  # any aminoglycoside and any fluoroquinolone
  example_isolates %>%
    filter_aminoglycosides("R") %>%
    filter_fluoroquinolones("R")
 
  # filter on isolates that show resistance to
  # all aminoglycosides and all fluoroquinolones
  example_isolates %>%
    filter_aminoglycosides("R", "all") %>%
    filter_fluoroquinolones("R", "all")
  
  # with dplyr 1.0.0 and higher (that adds 'across()'), this is all equal:
  # (though the row names on the first are more correct)
  example_isolates %>% filter_carbapenems("R", "all")
  example_isolates %>% filter(across(carbapenems(), ~. == "R"))
  example_isolates %>% filter(across(carbapenems(), function(x) x == "R"))
}
# }