# Filter isolates on result in antibiotic class — filter_ab_class • AMR (for R)
Filter isolates on results in specific antibiotic variables based on their class (ATC groups). This makes it easy to get a list of isolates that were tested for e.g. any aminoglycoside.

# Filter isolates on result in antibiotic class

`filter_ab_class.Rd`

Filter isolates on results in specific antibiotic variables based on their class (ATC groups). This makes it easy to get a list of isolates that were tested for e.g. any aminoglycoside.

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

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

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

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

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

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

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

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

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

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

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

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

## Arguments

tbl | a data set
ab_class | an antimicrobial class, like `"carbapenems"`. More specifically, this should be a text that can be found in a 4th level ATC group (chemical subgroup) or a 5th level ATC group (chemical substance), please see this explanation on the WHOCC website.
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"`
... | parameters passed on to `filter_at`

## Details

The `antibiotics` data set will be searched for `ab_class` in the columns `atc_group1` and `atc_group2` (case-insensitive). Next, `tbl` will be checked for column names with a value in any abbreviations, codes or official names found in the `antibiotics` data set.

## Examples

    # NOT RUN {
    library(dplyr)

    # filter on isolates that have any result for any aminoglycoside
    septic_patients %>% filter_aminoglycosides()

    # this is essentially the same as (but without determination of column names):
    septic_patients %>%
      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
    septic_patients %>% filter_aminoglycosides("R")

    # filter on isolates that show resistance to ALL aminoglycosides
    septic_patients %>% filter_aminoglycosides("R", "all")

    # filter on isolates that show resistance to
    # any aminoglycoside and any fluoroquinolone
    septic_patients %>%
      filter_aminoglycosides("R") %>%
      filter_fluoroquinolones("R")

    # filter on isolates that show resistance to
    # all aminoglycosides and all fluoroquinolones
    septic_patients %>%
      filter_aminoglycosides("R", "all") %>%
      filter_fluoroquinolones("R", "all")
    # }