Use these selection helpers inside any function that allows Tidyverse selections, like dplyr::select() or tidyr::pivot_longer(). They help to select the columns of antibiotics that are of a specific antibiotic class, without the need to define the columns or antibiotic abbreviations.

ab_class(ab_class)

aminoglycosides()

carbapenems()

cephalosporins()

cephalosporins_1st()

cephalosporins_2nd()

cephalosporins_3rd()

cephalosporins_4th()

cephalosporins_5th()

fluoroquinolones()

glycopeptides()

macrolides()

penicillins()

tetracyclines()

Arguments

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.

Details

All columns will be searched for known antibiotic names, abbreviations, brand names and codes (ATC, EARS-Net, WHO, etc.). This means that a selector like e.g. aminoglycosides() will pick up column names like 'gen', 'genta', 'J01GB03', 'tobra', 'Tobracin', etc.

These functions only work if the tidyselect package is installed, that comes with the dplyr package. An error will be thrown if tidyselect package is not installed, or if the functions are used outside a function that allows Tidyverse selections like select() or pivot_longer().

Read more on our website!

On our website https://msberends.github.io/AMR you can find a comprehensive tutorial about how to conduct AMR analysis, the complete documentation of all functions (which reads a lot easier than here in R) and an example analysis using WHONET data. As we would like to better understand the backgrounds and needs of our users, please participate in our survey!

See also

filter_ab_class() for the filter() equivalent.

Examples

if (FALSE) {
  library(dplyr)

  # this will select columns 'IPM' (imipenem) and 'MEM' (meropenem):
  example_isolates %>% 
    select(carbapenems())
    
  # this will select columns 'mo', 'AMK', 'GEN', 'KAN' and 'TOB':
  example_isolates %>% 
    select(mo, aminoglycosides())
    
  # this will select columns 'mo' and all antimycobacterial drugs ('RIF'):
  example_isolates %>% 
    select(mo, ab_class("mycobact"))
    
    
  # get bug/drug combinations for only macrolides in Gram-positives:
  example_isolates %>% 
    filter(mo_gramstain(mo) %like% "pos") %>% 
    select(mo, macrolides()) %>% 
    bug_drug_combinations() %>%
    format()
    
    
  data.frame(irrelevant = "value",
             J01CA01 = "S") %>%   # ATC code of ampicillin
    select(penicillins())         # so the 'J01CA01' column is selected

}