mirror of
https://github.com/msberends/AMR.git
synced 2025-07-12 21:41:55 +02:00
Compare commits
9 Commits
v1.7.1
...
c8491d07f8
Author | SHA1 | Date | |
---|---|---|---|
c8491d07f8 | |||
95050ee3e0 | |||
1dc9d237f6 | |||
d04e83f494 | |||
c44d9392ca | |||
556bf0014d | |||
99be4c7e7e | |||
683a0e748a | |||
1908e7cc7a |
49
.github/workflows/check.yaml
vendored
49
.github/workflows/check.yaml
vendored
@ -23,6 +23,8 @@
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
# This GitHub Actions file runs without ANY dependency, so works on all versions of R since R-3.0.
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
@ -32,9 +34,9 @@ on:
|
||||
branches:
|
||||
- master
|
||||
schedule:
|
||||
# run a schedule everyday at 3 AM.
|
||||
# run a schedule everyday at 1 AM.
|
||||
# this is to check that all dependencies are still available (see R/zzz.R)
|
||||
- cron: '0 3 * * *'
|
||||
- cron: '0 1 * * *'
|
||||
|
||||
name: R-code-check
|
||||
|
||||
@ -55,25 +57,33 @@ jobs:
|
||||
- {os: windows-latest, r: 'devel', allowfail: true}
|
||||
- {os: ubuntu-20.04, r: 'devel', allowfail: true, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
|
||||
|
||||
# these are the current release of R
|
||||
- {os: macOS-latest, r: 'release', allowfail: false}
|
||||
- {os: windows-latest, r: 'release', allowfail: false}
|
||||
- {os: ubuntu-20.04, r: 'release', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
|
||||
|
||||
# these are the previous release of R
|
||||
- {os: macOS-latest, r: 'oldrel', allowfail: false}
|
||||
- {os: windows-latest, r: 'oldrel', allowfail: false}
|
||||
- {os: ubuntu-20.04, r: 'oldrel', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
|
||||
|
||||
# test against all released versions of R >= 3.0, we support them all!
|
||||
# test all systems against all released versions of R >= 3.0, we support them all!
|
||||
- {os: macOS-latest, r: '4.1', allowfail: false}
|
||||
- {os: windows-latest, r: '4.1', allowfail: false}
|
||||
- {os: ubuntu-20.04, r: '4.1', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
|
||||
- {os: macOS-latest, r: '4.0', allowfail: false}
|
||||
- {os: windows-latest, r: '4.0', allowfail: false}
|
||||
- {os: ubuntu-20.04, r: '4.0', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
|
||||
- {os: macOS-latest, r: '3.6', allowfail: false}
|
||||
- {os: windows-latest, r: '3.6', allowfail: true}
|
||||
- {os: ubuntu-20.04, r: '3.6', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
|
||||
- {os: macOS-latest, r: '3.5', allowfail: false}
|
||||
- {os: windows-latest, r: '3.5', allowfail: false}
|
||||
- {os: ubuntu-20.04, r: '3.5', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
|
||||
- {os: macOS-latest, r: '3.4', allowfail: false}
|
||||
- {os: windows-latest, r: '3.4', allowfail: false}
|
||||
- {os: ubuntu-20.04, r: '3.4', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
|
||||
- {os: macOS-latest, r: '3.3', allowfail: false}
|
||||
- {os: windows-latest, r: '3.3', allowfail: false}
|
||||
- {os: ubuntu-20.04, r: '3.3', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
|
||||
- {os: macOS-latest, r: '3.2', allowfail: false}
|
||||
- {os: windows-latest, r: '3.2', allowfail: false}
|
||||
- {os: ubuntu-20.04, r: '3.2', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
|
||||
# - {os: macOS-latest, r: '3.1', allowfail: false}
|
||||
# - {os: windows-latest, r: '3.1', allowfail: false}
|
||||
- {os: ubuntu-20.04, r: '3.1', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
|
||||
# - {os: macOS-latest, r: '3.0', allowfail: false}
|
||||
# - {os: windows-latest, r: '3.0', allowfail: false}
|
||||
- {os: ubuntu-20.04, r: '3.0', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
|
||||
|
||||
env:
|
||||
@ -96,13 +106,18 @@ jobs:
|
||||
run: |
|
||||
sudo apt install -y libssl-dev pandoc pandoc-citeproc libxml2-dev libicu-dev libcurl4-openssl-dev libpng-dev
|
||||
|
||||
- name: Query dependencies
|
||||
# this will change every day (i.e. at scheduled night run of GitHub Action), so it will cache dependency updates
|
||||
run: |
|
||||
writeLines(paste0(format(Sys.Date(), "%Y%m%d"), sprintf("-R-%i.%i", getRversion()$major, getRversion()$minor)), ".github/daily-R-bundle")
|
||||
shell: Rscript {0}
|
||||
|
||||
- name: Restore cached R packages
|
||||
# this step will add the step 'Post Restore cached R packages' on a succesful run
|
||||
if: runner.os != 'Windows'
|
||||
uses: actions/cache@v1
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ env.R_LIBS_USER }}
|
||||
key: ${{ matrix.config.os }}-r-${{ matrix.config.r }}-v4
|
||||
key: ${{ matrix.config.os }}-${{ hashFiles('.github/daily-R-bundle') }}-v4
|
||||
|
||||
- name: Unpack AMR and install R dependencies
|
||||
if: always()
|
||||
@ -156,5 +171,5 @@ jobs:
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: artifacts-${{ matrix.config.os }}-r${{ matrix.config.r }}
|
||||
name: artifacts-r-${{ matrix.config.r }}-${{ matrix.config.os }}
|
||||
path: AMR.Rcheck
|
||||
|
28
.github/workflows/codecovr.yaml
vendored
28
.github/workflows/codecovr.yaml
vendored
@ -48,12 +48,18 @@ jobs:
|
||||
|
||||
- uses: r-lib/actions/setup-pandoc@master
|
||||
|
||||
- name: Query dependencies
|
||||
# this will change once a week, so it will cache dependency updates
|
||||
run: |
|
||||
writeLines(paste(format(Sys.Date(), "week %V %Y"), sprintf("R-%i.%i", getRversion()$major, getRversion()$minor)), ".github/week-R-version")
|
||||
shell: Rscript {0}
|
||||
|
||||
- name: Restore cached R packages
|
||||
# this step will add the step 'Post Restore cached R packages' on a succesful run
|
||||
uses: actions/cache@v1
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ env.R_LIBS_USER }}
|
||||
key: macOS-latest-r-release-v5-codecovr
|
||||
key: ${{ matrix.config.os }}-${{ hashFiles('.github/week-R-version') }}-v4
|
||||
|
||||
- name: Unpack AMR and install R dependencies
|
||||
run: |
|
||||
@ -68,26 +74,14 @@ jobs:
|
||||
as.data.frame(utils::installed.packages())[, "Version", drop = FALSE]
|
||||
shell: Rscript {0}
|
||||
|
||||
# - name: Test coverage
|
||||
# env:
|
||||
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
# run: |
|
||||
# library(AMR)
|
||||
# library(tinytest)
|
||||
# library(covr)
|
||||
# source_files <- list.files("R", pattern = ".R$", full.names = TRUE)
|
||||
# test_files <- list.files("inst/tinytest", full.names = TRUE)
|
||||
# cov <- file_coverage(source_files = source_files, test_files = test_files, parent_env = asNamespace("AMR"), line_exclusions = list("R/atc_online.R", "R/mo_source.R", "R/translate.R", "R/resistance_predict.R", "R/aa_helper_functions.R", "R/aa_helper_pm_functions.R", "R/zzz.R"))
|
||||
# attr(cov, which = "package") <- list(path = ".") # until https://github.com/r-lib/covr/issues/478 is solved
|
||||
# codecov(coverage = cov, quiet = FALSE)
|
||||
# shell: Rscript {0}
|
||||
|
||||
- name: Test coverage
|
||||
env:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
R_RUN_TINYTEST: true
|
||||
run: |
|
||||
install.packages("covr", repos = "https://cran.rstudio.com/")
|
||||
library(AMR)
|
||||
library(tinytest)
|
||||
covr::codecov(line_exclusions = list("R/atc_online.R", "R/mo_source.R", "R/translate.R", "R/resistance_predict.R", "R/aa_helper_functions.R", "R/aa_helper_pm_functions.R", "R/zzz.R"))
|
||||
x <- covr::codecov(line_exclusions = list("R/atc_online.R", "R/mo_source.R", "R/translate.R", "R/resistance_predict.R", "R/aa_helper_functions.R", "R/aa_helper_pm_functions.R", "R/zzz.R"))
|
||||
print(x)
|
||||
shell: Rscript {0}
|
||||
|
2
.github/workflows/lintr.yaml
vendored
2
.github/workflows/lintr.yaml
vendored
@ -52,7 +52,7 @@ jobs:
|
||||
shell: Rscript {0}
|
||||
|
||||
- name: Cache R packages
|
||||
uses: actions/cache@v1
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ env.R_LIBS_USER }}
|
||||
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
|
||||
|
@ -1,6 +1,6 @@
|
||||
Package: AMR
|
||||
Version: 1.7.1
|
||||
Date: 2021-06-03
|
||||
Version: 1.7.1.9008
|
||||
Date: 2021-06-23
|
||||
Title: Antimicrobial Resistance Data Analysis
|
||||
Authors@R: c(
|
||||
person(role = c("aut", "cre"),
|
||||
@ -59,7 +59,7 @@ Suggests:
|
||||
tinytest,
|
||||
xml2
|
||||
VignetteBuilder: knitr,rmarkdown
|
||||
URL: https://msberends.github.io/AMR/, https://github.com/msberends/AMR
|
||||
URL: https://github.com/msberends/AMR, https://msberends.github.io/AMR
|
||||
BugReports: https://github.com/msberends/AMR/issues
|
||||
License: GPL-2 | file LICENSE
|
||||
Encoding: UTF-8
|
||||
|
@ -170,6 +170,7 @@ export(age)
|
||||
export(age_groups)
|
||||
export(all_antimicrobials)
|
||||
export(aminoglycosides)
|
||||
export(aminopenicillins)
|
||||
export(anti_join_microorganisms)
|
||||
export(antimicrobials_equal)
|
||||
export(as.ab)
|
||||
@ -255,6 +256,8 @@ export(kurtosis)
|
||||
export(labels_rsi_count)
|
||||
export(left_join_microorganisms)
|
||||
export(like)
|
||||
export(lincosamides)
|
||||
export(lipoglycopeptides)
|
||||
export(macrolides)
|
||||
export(mdr_cmi2012)
|
||||
export(mdr_tb)
|
||||
@ -297,12 +300,14 @@ export(oxazolidinones)
|
||||
export(p_symbol)
|
||||
export(pca)
|
||||
export(penicillins)
|
||||
export(polymyxins)
|
||||
export(proportion_I)
|
||||
export(proportion_IR)
|
||||
export(proportion_R)
|
||||
export(proportion_S)
|
||||
export(proportion_SI)
|
||||
export(proportion_df)
|
||||
export(quinolones)
|
||||
export(random_disk)
|
||||
export(random_mic)
|
||||
export(random_rsi)
|
||||
@ -316,9 +321,11 @@ export(scale_y_percent)
|
||||
export(semi_join_microorganisms)
|
||||
export(set_mo_source)
|
||||
export(skewness)
|
||||
export(streptogramins)
|
||||
export(susceptibility)
|
||||
export(tetracyclines)
|
||||
export(theme_rsi)
|
||||
export(ureidopenicillins)
|
||||
importFrom(graphics,arrows)
|
||||
importFrom(graphics,axis)
|
||||
importFrom(graphics,barplot)
|
||||
|
19
NEWS.md
19
NEWS.md
@ -1,7 +1,23 @@
|
||||
# `AMR` 1.7.1.9008
|
||||
## <small>Last updated: 23 June 2021</small>
|
||||
|
||||
### Changed
|
||||
* Antibiotic class selectors (see `ab_class()`)
|
||||
* They now finally also work in R-3.0 and R-3.1, supporting every version of R since 2013
|
||||
* Added more selectors: `aminopenicillins()`, `lincosamides()`, `lipoglycopeptides()`, `polymyxins()`, `quinolones()`, `streptogramins()` and `ureidopenicillins()`
|
||||
* Fix for using selectors multiple times in one call (e.g., using them in `dplyr::filter()` and immediately after in `dplyr::select()`)
|
||||
* Fixed duplicate ATC codes in the `antibiotics` data set
|
||||
* Added `ggplot2::autoplot()` generic for classes `<mic>`, `<disk>`, `<rsi>` and `<resistance_predict>`
|
||||
* Fix to prevent introducing `NA`s for old MO codes when running `as.mo()` on them
|
||||
* Added more informative error messages when any of the `proportion_*()` and `count_*()` functions fail
|
||||
* When printing a tibble with any old MO code, a warning will be thrown that old codes should be updated using `as.mo()`
|
||||
* Improved automatic column selector when `col_*` arguments are left blank, e.g. in `first_isolate()`
|
||||
* The right input types for `random_mic()`, `random_disk()` and `random_rsi()` are now enforced
|
||||
|
||||
|
||||
# `AMR` 1.7.1
|
||||
|
||||
### Breaking change
|
||||
* Support for CLSI 2020 guideline for interpreting MICs and disk diffusion values (using `as.rsi()`)
|
||||
* All antibiotic class selectors (such as `carbapenems()`, `aminoglycosides()`) can now be used for filtering as well, making all their accompanying `filter_*()` functions redundant (such as `filter_carbapenems()`, `filter_aminoglycosides()`). These functions are now deprecated and will be removed in a next release. Examples of how the selectors can be used for filtering:
|
||||
```r
|
||||
# select columns with results for carbapenems
|
||||
@ -21,6 +37,7 @@
|
||||
```
|
||||
|
||||
### New
|
||||
* Support for CLSI 2020 guideline for interpreting MICs and disk diffusion values (using `as.rsi()`)
|
||||
* Function `custom_eucast_rules()` that brings support for custom AMR rules in `eucast_rules()`
|
||||
* Function `italicise_taxonomy()` to make taxonomic names within a string italic, with support for markdown and ANSI
|
||||
* Support for all four methods to determine first isolates as summarised by Hindler *et al.* (doi: [10.1086/511864](https://doi.org/10.1086/511864)): isolate-based, patient-based, episode-based and phenotype-based. The last method is now the default.
|
||||
|
@ -170,65 +170,73 @@ search_type_in_df <- function(x, type, info = TRUE) {
|
||||
|
||||
# remove attributes from other packages
|
||||
x <- as.data.frame(x, stringsAsFactors = FALSE)
|
||||
colnames(x) <- trimws(colnames(x))
|
||||
colnames_formatted <- tolower(generalise_antibiotic_name(colnames(x)))
|
||||
|
||||
# -- mo
|
||||
if (type == "mo") {
|
||||
if (any(vapply(FUN.VALUE = logical(1), x, is.mo))) {
|
||||
found <- sort(colnames(x)[vapply(FUN.VALUE = logical(1), x, is.mo)])[1]
|
||||
} else if ("mo" %in% colnames(x) &
|
||||
suppressWarnings(
|
||||
all(x$mo %in% c(NA, microorganisms$mo)))) {
|
||||
# take first <mo> column
|
||||
found <- colnames(x)[vapply(FUN.VALUE = logical(1), x, is.mo)]
|
||||
} else if ("mo" %in% colnames_formatted &
|
||||
suppressWarnings(all(x$mo %in% c(NA, microorganisms$mo)))) {
|
||||
found <- "mo"
|
||||
} else if (any(colnames(x) %like% "^(mo|microorganism|organism|bacteria|ba[ck]terie)s?$")) {
|
||||
found <- sort(colnames(x)[colnames(x) %like% "^(mo|microorganism|organism|bacteria|ba[ck]terie)s?$"])[1]
|
||||
} else if (any(colnames(x) %like% "^(microorganism|organism|bacteria|ba[ck]terie)")) {
|
||||
found <- sort(colnames(x)[colnames(x) %like% "^(microorganism|organism|bacteria|ba[ck]terie)"])[1]
|
||||
} else if (any(colnames(x) %like% "species")) {
|
||||
found <- sort(colnames(x)[colnames(x) %like% "species"])[1]
|
||||
} else if (any(colnames_formatted %like_case% "^(mo|microorganism|organism|bacteria|ba[ck]terie)s?$")) {
|
||||
found <- sort(colnames(x)[colnames_formatted %like_case% "^(mo|microorganism|organism|bacteria|ba[ck]terie)s?$"])
|
||||
} else if (any(colnames_formatted %like_case% "^(microorganism|organism|bacteria|ba[ck]terie)")) {
|
||||
found <- sort(colnames(x)[colnames_formatted %like_case% "^(microorganism|organism|bacteria|ba[ck]terie)"])
|
||||
} else if (any(colnames_formatted %like_case% "species")) {
|
||||
found <- sort(colnames(x)[colnames_formatted %like_case% "species"])
|
||||
}
|
||||
|
||||
}
|
||||
# -- key antibiotics
|
||||
if (type %in% c("keyantibiotics", "keyantimicrobials")) {
|
||||
if (any(colnames(x) %like% "^key.*(ab|antibiotics|antimicrobials)")) {
|
||||
found <- sort(colnames(x)[colnames(x) %like% "^key.*(ab|antibiotics|antimicrobials)"])[1]
|
||||
if (any(colnames_formatted %like_case% "^key.*(ab|antibiotics|antimicrobials)")) {
|
||||
found <- sort(colnames(x)[colnames_formatted %like_case% "^key.*(ab|antibiotics|antimicrobials)"])
|
||||
}
|
||||
}
|
||||
# -- date
|
||||
if (type == "date") {
|
||||
if (any(colnames(x) %like% "^(specimen date|specimen_date|spec_date)")) {
|
||||
if (any(colnames_formatted %like_case% "^(specimen date|specimen_date|spec_date)")) {
|
||||
# WHONET support
|
||||
found <- sort(colnames(x)[colnames(x) %like% "^(specimen date|specimen_date|spec_date)"])[1]
|
||||
found <- sort(colnames(x)[colnames_formatted %like_case% "^(specimen date|specimen_date|spec_date)"])
|
||||
if (!any(class(pm_pull(x, found)) %in% c("Date", "POSIXct"))) {
|
||||
stop(font_red(paste0("Found column '", font_bold(found), "' to be used as input for `col_", type,
|
||||
"`, but this column contains no valid dates. Transform its values to valid dates first.")),
|
||||
call. = FALSE)
|
||||
}
|
||||
|
||||
} else if (any(vapply(FUN.VALUE = logical(1), x, function(x) inherits(x, c("Date", "POSIXct"))))) {
|
||||
found <- sort(colnames(x)[vapply(FUN.VALUE = logical(1), x, function(x) inherits(x, c("Date", "POSIXct")))])[1]
|
||||
# take first <Date> column
|
||||
found <- colnames(x)[vapply(FUN.VALUE = logical(1), x, function(x) inherits(x, c("Date", "POSIXct")))]
|
||||
}
|
||||
}
|
||||
# -- patient id
|
||||
if (type == "patient_id") {
|
||||
if (any(colnames(x) %like% "^(identification |patient|patid)")) {
|
||||
found <- sort(colnames(x)[colnames(x) %like% "^(identification |patient|patid)"])[1]
|
||||
crit1 <- colnames_formatted %like_case% "^(patient|patid)"
|
||||
if (any(crit1)) {
|
||||
found <- colnames(x)[crit1]
|
||||
} else {
|
||||
crit2 <- colnames_formatted %like_case% "(identification |patient|pat.*id)"
|
||||
if (any(crit2)) {
|
||||
found <- colnames(x)[crit2]
|
||||
}
|
||||
}
|
||||
}
|
||||
# -- specimen
|
||||
if (type == "specimen") {
|
||||
if (any(colnames(x) %like% "(specimen type|spec_type)")) {
|
||||
found <- sort(colnames(x)[colnames(x) %like% "(specimen type|spec_type)"])[1]
|
||||
} else if (any(colnames(x) %like% "^(specimen)")) {
|
||||
found <- sort(colnames(x)[colnames(x) %like% "^(specimen)"])[1]
|
||||
if (any(colnames_formatted %like_case% "(specimen type|spec_type)")) {
|
||||
found <- sort(colnames(x)[colnames_formatted %like_case% "(specimen type|spec_type)"])
|
||||
} else if (any(colnames_formatted %like_case% "^(specimen)")) {
|
||||
found <- sort(colnames(x)[colnames_formatted %like_case% "^(specimen)"])
|
||||
}
|
||||
}
|
||||
# -- UTI (urinary tract infection)
|
||||
if (type == "uti") {
|
||||
if (any(colnames(x) == "uti")) {
|
||||
found <- colnames(x)[colnames(x) == "uti"][1]
|
||||
} else if (any(colnames(x) %like% "(urine|urinary)")) {
|
||||
found <- sort(colnames(x)[colnames(x) %like% "(urine|urinary)"])[1]
|
||||
if (any(colnames_formatted == "uti")) {
|
||||
found <- colnames(x)[colnames_formatted == "uti"]
|
||||
} else if (any(colnames_formatted %like_case% "(urine|urinary)")) {
|
||||
found <- sort(colnames(x)[colnames_formatted %like_case% "(urine|urinary)"])
|
||||
}
|
||||
if (!is.null(found)) {
|
||||
# this column should contain logicals
|
||||
@ -241,10 +249,12 @@ search_type_in_df <- function(x, type, info = TRUE) {
|
||||
}
|
||||
}
|
||||
|
||||
found <- found[1]
|
||||
|
||||
if (!is.null(found) & info == TRUE) {
|
||||
if (message_not_thrown_before(fn = paste0("search_", type))) {
|
||||
msg <- paste0("Using column '", font_bold(found), "' as input for `col_", type, "`.")
|
||||
if (type %in% c("keyantibiotics", "specimen")) {
|
||||
if (type %in% c("keyantibiotics", "keyantimicrobials", "specimen")) {
|
||||
msg <- paste(msg, "Use", font_bold(paste0("col_", type), "= FALSE"), "to prevent this.")
|
||||
}
|
||||
message_(msg)
|
||||
@ -506,7 +516,7 @@ dataset_UTF8_to_ASCII <- function(df) {
|
||||
|
||||
# for eucast_rules() and mdro(), creates markdown output with URLs and names
|
||||
create_eucast_ab_documentation <- function() {
|
||||
x <- trimws(unique(toupper(unlist(strsplit(eucast_rules_file$then_change_these_antibiotics, ",")))))
|
||||
x <- trimws(unique(toupper(unlist(strsplit(EUCAST_RULES_DF$then_change_these_antibiotics, ",")))))
|
||||
ab <- character()
|
||||
for (val in x) {
|
||||
if (val %in% ls(envir = asNamespace("AMR"))) {
|
||||
@ -696,7 +706,7 @@ meet_criteria <- function(object,
|
||||
ifelse(!is.null(has_length) && length(has_length) == 1 && has_length == 1,
|
||||
"be a finite number",
|
||||
"all be finite numbers"),
|
||||
" (i.e., not be infinite)",
|
||||
" (i.e. not be infinite)",
|
||||
call = call_depth)
|
||||
}
|
||||
if (!is.null(contains_column_class)) {
|
||||
@ -714,11 +724,6 @@ meet_criteria <- function(object,
|
||||
}
|
||||
|
||||
get_current_data <- function(arg_name, call) {
|
||||
# check if retrieved before, then get it from package environment
|
||||
if (identical(unique_call_id(entire_session = FALSE), pkg_env$get_current_data.call)) {
|
||||
return(pkg_env$get_current_data.out)
|
||||
}
|
||||
|
||||
# try dplyr::cur_data_all() first to support dplyr groups
|
||||
# only useful for e.g. dplyr::filter(), dplyr::mutate() and dplyr::summarise()
|
||||
# not useful (throws error) with e.g. dplyr::select() - but that will be caught later in this function
|
||||
@ -726,72 +731,32 @@ get_current_data <- function(arg_name, call) {
|
||||
if (!is.null(cur_data_all)) {
|
||||
out <- tryCatch(cur_data_all(), error = function(e) NULL)
|
||||
if (is.data.frame(out)) {
|
||||
out <- structure(out, type = "dplyr_cur_data_all")
|
||||
pkg_env$get_current_data.call <- unique_call_id(entire_session = FALSE)
|
||||
pkg_env$get_current_data.out <- out
|
||||
return(out)
|
||||
return(structure(out, type = "dplyr_cur_data_all"))
|
||||
}
|
||||
}
|
||||
|
||||
if (getRversion() < "3.2") {
|
||||
# R-3.0 and R-3.1 do not have an `x` element in the call stack, rendering this function useless
|
||||
if (is.na(arg_name)) {
|
||||
# like in carbapenems() etc.
|
||||
warning_("this function can only be used in R >= 3.2", call = call)
|
||||
return(data.frame())
|
||||
} else {
|
||||
# mimic a default R error, e.g. for example_isolates[which(mo_name() %like% "^ent"), ]
|
||||
stop_("argument `", arg_name, "` is missing with no default", call = call)
|
||||
# try a manual (base R) method, by going over all underlying environments with sys.frames()
|
||||
for (el in sys.frames()) {
|
||||
if (!is.null(el$`.Generic`)) {
|
||||
# don't check `".Generic" %in% names(el)`, because in R < 3.2, `names(el)` is always NULL
|
||||
|
||||
if (!is.null(el$`.data`) && is.data.frame(el$`.data`)) {
|
||||
# an element `.data` will be in the environment when using `dplyr::select()`
|
||||
# (but not when using `dplyr::filter()`, `dplyr::mutate()` or `dplyr::summarise()`)
|
||||
return(structure(el$`.data`, type = "dplyr_selector"))
|
||||
|
||||
} else if (!is.null(el$xx) && is.data.frame(el$xx)) {
|
||||
# an element `xx` will be in the environment for rows + cols, e.g. `example_isolates[c(1:3), carbapenems()]`
|
||||
return(structure(el$xx, type = "base_R"))
|
||||
|
||||
} else if (!is.null(el$x) && is.data.frame(el$x)) {
|
||||
# an element `x` will be in the environment for only cols, e.g. `example_isolates[, carbapenems()]`
|
||||
return(structure(el$x, type = "base_R"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# try a (base R) method, by going over the complete system call stack with sys.frames()
|
||||
not_set <- TRUE
|
||||
source <- "base_R"
|
||||
frms <- lapply(sys.frames(), function(el) {
|
||||
if (not_set == TRUE && ".Generic" %in% names(el)) {
|
||||
if (tryCatch(".data" %in% names(el) && is.data.frame(el$`.data`), error = function(e) FALSE)) {
|
||||
# - - - -
|
||||
# dplyr
|
||||
# - - - -
|
||||
# an element `.data` will be in the system call stack when using dplyr::select()
|
||||
# [but not when using dplyr::filter(), dplyr::mutate() or dplyr::summarise()]
|
||||
not_set <<- FALSE
|
||||
source <<- "dplyr_selector"
|
||||
el$`.data`
|
||||
} else if (tryCatch(any(c("x", "xx") %in% names(el)), error = function(e) FALSE)) {
|
||||
# - - - -
|
||||
# base R
|
||||
# - - - -
|
||||
# an element `x` will be in this environment for only cols, e.g. `example_isolates[, carbapenems()]`
|
||||
# an element `xx` will be in this environment for rows + cols, e.g. `example_isolates[c(1:3), carbapenems()]`
|
||||
if (tryCatch(is.data.frame(el$xx), error = function(e) FALSE)) {
|
||||
not_set <<- FALSE
|
||||
el$xx
|
||||
} else if (tryCatch(is.data.frame(el$x))) {
|
||||
not_set <<- FALSE
|
||||
el$x
|
||||
} else {
|
||||
NULL
|
||||
}
|
||||
} else {
|
||||
NULL
|
||||
}
|
||||
} else {
|
||||
NULL
|
||||
}
|
||||
})
|
||||
|
||||
# lookup the matched frame and return its value: a data.frame
|
||||
vars_df <- tryCatch(frms[[which(!vapply(FUN.VALUE = logical(1), frms, is.null))]], error = function(e) NULL)
|
||||
if (is.data.frame(vars_df)) {
|
||||
out <- structure(vars_df, type = source)
|
||||
pkg_env$get_current_data.call <- unique_call_id(entire_session = FALSE)
|
||||
pkg_env$get_current_data.out <- out
|
||||
return(out)
|
||||
}
|
||||
|
||||
# nothing worked, so:
|
||||
# no data.frame found, so an error must be returned:
|
||||
if (is.na(arg_name)) {
|
||||
if (isTRUE(is.numeric(call))) {
|
||||
fn <- as.character(sys.call(call + 1)[1])
|
||||
@ -980,8 +945,8 @@ font_grey_bg <- function(..., collapse = " ") {
|
||||
# similar to HTML #444444
|
||||
try_colour(..., before = "\033[48;5;238m", after = "\033[49m", collapse = collapse)
|
||||
} else {
|
||||
# similar to HTML #eeeeee
|
||||
try_colour(..., before = "\033[48;5;254m", after = "\033[49m", collapse = collapse)
|
||||
# similar to HTML #f0f0f0
|
||||
try_colour(..., before = "\033[48;5;255m", after = "\033[49m", collapse = collapse)
|
||||
}
|
||||
}
|
||||
font_green_bg <- function(..., collapse = " ") {
|
||||
|
6
R/ab.R
6
R/ab.R
@ -325,9 +325,9 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
|
||||
function(y) {
|
||||
for (i in seq_len(length(y))) {
|
||||
for (lang in LANGUAGES_SUPPORTED[LANGUAGES_SUPPORTED != "en"]) {
|
||||
y[i] <- ifelse(tolower(y[i]) %in% tolower(translations_file[, lang, drop = TRUE]),
|
||||
translations_file[which(tolower(translations_file[, lang, drop = TRUE]) == tolower(y[i]) &
|
||||
!isFALSE(translations_file$fixed)), "pattern"],
|
||||
y[i] <- ifelse(tolower(y[i]) %in% tolower(TRANSLATIONS[, lang, drop = TRUE]),
|
||||
TRANSLATIONS[which(tolower(TRANSLATIONS[, lang, drop = TRUE]) == tolower(y[i]) &
|
||||
!isFALSE(TRANSLATIONS$fixed)), "pattern"],
|
||||
y[i])
|
||||
}
|
||||
}
|
||||
|
@ -25,18 +25,18 @@
|
||||
|
||||
#' Antibiotic Class Selectors
|
||||
#'
|
||||
#' These functions help to filter and select columns with antibiotic test results that are of a specific antibiotic class, without the need to define the columns or antibiotic abbreviations. \strong{\Sexpr{ifelse(getRversion() < "3.2", paste0("NOTE: THESE FUNCTIONS DO NOT WORK ON YOUR CURRENT R VERSION. These functions require R version 3.2 or later - you have ", R.version.string, "."), "")}}
|
||||
#' These functions allow for filtering rows and selecting columns based on antibiotic test results that are of a specific antibiotic class, without the need to define the columns or antibiotic abbreviations.
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @param ab_class an antimicrobial class, such as `"carbapenems"`. The columns `group`, `atc_group1` and `atc_group2` of the [antibiotics] data set will be searched (case-insensitive) for this value.
|
||||
#' @param only_rsi_columns a [logical] to indicate whether only columns of class `<rsi>` must be selected (defaults to `FALSE`), see [as.rsi()]
|
||||
#' @details \strong{\Sexpr{ifelse(getRversion() < "3.2", paste0("NOTE: THESE FUNCTIONS DO NOT WORK ON YOUR CURRENT R VERSION. These functions require R version 3.2 or later - you have ", R.version.string, "."), "")}}
|
||||
#' @details
|
||||
#' These functions can be used in data set calls for selecting columns and filtering rows. They are heavily inspired by the [Tidyverse selection helpers](https://tidyselect.r-lib.org/reference/language.html), but also work in base \R and not only in `dplyr` verbs. Nonetheless, they are very convenient to use with `dplyr` functions such as [`select()`][dplyr::select()], [`filter()`][dplyr::filter()] and [`summarise()`][dplyr::summarise()], see *Examples*.
|
||||
#'
|
||||
#' All columns in the data in which these functions are called will be searched for known antibiotic names, abbreviations, brand names, and codes (ATC, EARS-Net, WHO, etc.) in the [antibiotics] data set. This means that a selector such as [aminoglycosides()] will pick up column names like 'gen', 'genta', 'J01GB03', 'tobra', 'Tobracin', etc. Use the [ab_class()] function to filter/select on a manually defined antibiotic class.
|
||||
#'
|
||||
#' These functions can be used in data set calls for selecting columns and filtering rows, see *Examples*. They support base R, but work more convenient in dplyr functions such as [`select()`][dplyr::select()], [`filter()`][dplyr::filter()] and [`summarise()`][dplyr::summarise()].
|
||||
#' @section Full list of supported agents:
|
||||
#'
|
||||
#' All columns in the data in which these functions are called will be searched for known antibiotic names, abbreviations, brand names, and codes (ATC, EARS-Net, WHO, etc.) in the [antibiotics] data set. This means that a selector like e.g. [aminoglycosides()] will pick up column names like 'gen', 'genta', 'J01GB03', 'tobra', 'Tobracin', etc.
|
||||
#'
|
||||
#' The group of betalactams consists of all carbapenems, cephalosporins and penicillins.
|
||||
#' `r paste0("* ", sapply(c("AMINOGLYCOSIDES", "AMINOPENICILLINS", "BETALACTAMS", "CARBAPENEMS", "CEPHALOSPORINS", "CEPHALOSPORINS_1ST", "CEPHALOSPORINS_2ND", "CEPHALOSPORINS_3RD", "CEPHALOSPORINS_4TH", "CEPHALOSPORINS_5TH", "FLUOROQUINOLONES", "GLYCOPEPTIDES", "LINCOSAMIDES", "LIPOGLYCOPEPTIDES", "MACROLIDES", "OXAZOLIDINONES", "PENICILLINS", "POLYMYXINS", "STREPTOGRAMINS", "QUINOLONES", "TETRACYCLINES", "UREIDOPENICILLINS"), function(x) paste0("``", tolower(x), "()`` can select ", vector_and(paste0(ab_name(eval(parse(text = x), envir = asNamespace("AMR")), language = NULL, tolower = TRUE), " (", eval(parse(text = x), envir = asNamespace("AMR")), ")"), quotes = FALSE))), "\n", collapse = "")`
|
||||
#' @rdname antibiotic_class_selectors
|
||||
#' @name antibiotic_class_selectors
|
||||
#' @export
|
||||
@ -46,7 +46,7 @@
|
||||
#' # `example_isolates` is a data set available in the AMR package.
|
||||
#' # See ?example_isolates.
|
||||
#'
|
||||
#' # Base R ------------------------------------------------------------------
|
||||
#' # base R ------------------------------------------------------------------
|
||||
#'
|
||||
#' # select columns 'IPM' (imipenem) and 'MEM' (meropenem)
|
||||
#' example_isolates[, carbapenems()]
|
||||
@ -104,7 +104,6 @@
|
||||
#' example_isolates %>%
|
||||
#' select(mo, ab_class("mycobact"))
|
||||
#'
|
||||
#'
|
||||
#' # get bug/drug combinations for only macrolides in Gram-positives:
|
||||
#' example_isolates %>%
|
||||
#' filter(mo_is_gram_positive()) %>%
|
||||
@ -112,14 +111,12 @@
|
||||
#' bug_drug_combinations() %>%
|
||||
#' format()
|
||||
#'
|
||||
#'
|
||||
#' data.frame(some_column = "some_value",
|
||||
#' J01CA01 = "S") %>% # ATC code of ampicillin
|
||||
#' select(penicillins()) # only the 'J01CA01' column will be selected
|
||||
#'
|
||||
#'
|
||||
#' # 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[carbapenems() == "R", ]
|
||||
#' example_isolates %>% filter(carbapenems() == "R")
|
||||
#' example_isolates %>% filter(across(carbapenems(), ~.x == "R"))
|
||||
@ -127,147 +124,196 @@
|
||||
#' }
|
||||
ab_class <- function(ab_class,
|
||||
only_rsi_columns = FALSE) {
|
||||
ab_selector(ab_class, function_name = "ab_class", only_rsi_columns = only_rsi_columns)
|
||||
meet_criteria(ab_class, allow_class = "character", has_length = 1)
|
||||
ab_selector(NULL, only_rsi_columns = only_rsi_columns, ab_class = ab_class)
|
||||
}
|
||||
|
||||
#' @rdname antibiotic_class_selectors
|
||||
#' @export
|
||||
aminoglycosides <- function(only_rsi_columns = FALSE) {
|
||||
ab_selector("aminoglycoside", function_name = "aminoglycosides", only_rsi_columns = only_rsi_columns)
|
||||
ab_selector("aminoglycosides", only_rsi_columns = only_rsi_columns)
|
||||
}
|
||||
|
||||
#' @rdname antibiotic_class_selectors
|
||||
#' @export
|
||||
aminopenicillins <- function(only_rsi_columns = FALSE) {
|
||||
ab_selector("aminopenicillins", only_rsi_columns = only_rsi_columns)
|
||||
}
|
||||
|
||||
#' @rdname antibiotic_class_selectors
|
||||
#' @export
|
||||
betalactams <- function(only_rsi_columns = FALSE) {
|
||||
ab_selector("carbapenem|cephalosporin|penicillin", function_name = "betalactams", only_rsi_columns = only_rsi_columns)
|
||||
ab_selector("betalactams", only_rsi_columns = only_rsi_columns)
|
||||
}
|
||||
|
||||
#' @rdname antibiotic_class_selectors
|
||||
#' @export
|
||||
carbapenems <- function(only_rsi_columns = FALSE) {
|
||||
ab_selector("carbapenem", function_name = "carbapenems", only_rsi_columns = only_rsi_columns)
|
||||
ab_selector("carbapenems", only_rsi_columns = only_rsi_columns)
|
||||
}
|
||||
|
||||
#' @rdname antibiotic_class_selectors
|
||||
#' @export
|
||||
cephalosporins <- function(only_rsi_columns = FALSE) {
|
||||
ab_selector("cephalosporin", function_name = "cephalosporins", only_rsi_columns = only_rsi_columns)
|
||||
ab_selector("cephalosporins", only_rsi_columns = only_rsi_columns)
|
||||
}
|
||||
|
||||
#' @rdname antibiotic_class_selectors
|
||||
#' @export
|
||||
cephalosporins_1st <- function(only_rsi_columns = FALSE) {
|
||||
ab_selector("cephalosporins.*1", function_name = "cephalosporins_1st", only_rsi_columns = only_rsi_columns)
|
||||
ab_selector("cephalosporins_1st", only_rsi_columns = only_rsi_columns)
|
||||
}
|
||||
|
||||
#' @rdname antibiotic_class_selectors
|
||||
#' @export
|
||||
cephalosporins_2nd <- function(only_rsi_columns = FALSE) {
|
||||
ab_selector("cephalosporins.*2", function_name = "cephalosporins_2nd", only_rsi_columns = only_rsi_columns)
|
||||
ab_selector("cephalosporins_2nd", only_rsi_columns = only_rsi_columns)
|
||||
}
|
||||
|
||||
#' @rdname antibiotic_class_selectors
|
||||
#' @export
|
||||
cephalosporins_3rd <- function(only_rsi_columns = FALSE) {
|
||||
ab_selector("cephalosporins.*3", function_name = "cephalosporins_3rd", only_rsi_columns = only_rsi_columns)
|
||||
ab_selector("cephalosporins_3rd", only_rsi_columns = only_rsi_columns)
|
||||
}
|
||||
|
||||
#' @rdname antibiotic_class_selectors
|
||||
#' @export
|
||||
cephalosporins_4th <- function(only_rsi_columns = FALSE) {
|
||||
ab_selector("cephalosporins.*4", function_name = "cephalosporins_4th", only_rsi_columns = only_rsi_columns)
|
||||
ab_selector("cephalosporins_4th", only_rsi_columns = only_rsi_columns)
|
||||
}
|
||||
|
||||
#' @rdname antibiotic_class_selectors
|
||||
#' @export
|
||||
cephalosporins_5th <- function(only_rsi_columns = FALSE) {
|
||||
ab_selector("cephalosporins.*5", function_name = "cephalosporins_5th", only_rsi_columns = only_rsi_columns)
|
||||
ab_selector("cephalosporins_5th", only_rsi_columns = only_rsi_columns)
|
||||
}
|
||||
|
||||
#' @rdname antibiotic_class_selectors
|
||||
#' @export
|
||||
fluoroquinolones <- function(only_rsi_columns = FALSE) {
|
||||
ab_selector("fluoroquinolone", function_name = "fluoroquinolones", only_rsi_columns = only_rsi_columns)
|
||||
ab_selector("fluoroquinolones", only_rsi_columns = only_rsi_columns)
|
||||
}
|
||||
|
||||
#' @rdname antibiotic_class_selectors
|
||||
#' @export
|
||||
glycopeptides <- function(only_rsi_columns = FALSE) {
|
||||
ab_selector("glycopeptide", function_name = "glycopeptides", only_rsi_columns = only_rsi_columns)
|
||||
ab_selector("glycopeptides", only_rsi_columns = only_rsi_columns)
|
||||
}
|
||||
|
||||
#' @rdname antibiotic_class_selectors
|
||||
#' @export
|
||||
lincosamides <- function(only_rsi_columns = FALSE) {
|
||||
ab_selector("lincosamides", only_rsi_columns = only_rsi_columns)
|
||||
}
|
||||
|
||||
#' @rdname antibiotic_class_selectors
|
||||
#' @export
|
||||
lipoglycopeptides <- function(only_rsi_columns = FALSE) {
|
||||
ab_selector("lipoglycopeptides", only_rsi_columns = only_rsi_columns)
|
||||
}
|
||||
|
||||
#' @rdname antibiotic_class_selectors
|
||||
#' @export
|
||||
macrolides <- function(only_rsi_columns = FALSE) {
|
||||
ab_selector("macrolide", function_name = "macrolides", only_rsi_columns = only_rsi_columns)
|
||||
ab_selector("macrolides", only_rsi_columns = only_rsi_columns)
|
||||
}
|
||||
|
||||
#' @rdname antibiotic_class_selectors
|
||||
#' @export
|
||||
oxazolidinones <- function(only_rsi_columns = FALSE) {
|
||||
ab_selector("oxazolidinone", function_name = "oxazolidinones", only_rsi_columns = only_rsi_columns)
|
||||
ab_selector("oxazolidinones", only_rsi_columns = only_rsi_columns)
|
||||
}
|
||||
|
||||
#' @rdname antibiotic_class_selectors
|
||||
#' @export
|
||||
penicillins <- function(only_rsi_columns = FALSE) {
|
||||
ab_selector("penicillin", function_name = "penicillins", only_rsi_columns = only_rsi_columns)
|
||||
ab_selector("penicillins", only_rsi_columns = only_rsi_columns)
|
||||
}
|
||||
|
||||
#' @rdname antibiotic_class_selectors
|
||||
#' @export
|
||||
polymyxins <- function(only_rsi_columns = FALSE) {
|
||||
ab_selector("polymyxins", only_rsi_columns = only_rsi_columns)
|
||||
}
|
||||
|
||||
#' @rdname antibiotic_class_selectors
|
||||
#' @export
|
||||
streptogramins <- function(only_rsi_columns = FALSE) {
|
||||
ab_selector("streptogramins", only_rsi_columns = only_rsi_columns)
|
||||
}
|
||||
|
||||
#' @rdname antibiotic_class_selectors
|
||||
#' @export
|
||||
quinolones <- function(only_rsi_columns = FALSE) {
|
||||
ab_selector("quinolones", only_rsi_columns = only_rsi_columns)
|
||||
}
|
||||
|
||||
#' @rdname antibiotic_class_selectors
|
||||
#' @export
|
||||
tetracyclines <- function(only_rsi_columns = FALSE) {
|
||||
ab_selector("tetracycline", function_name = "tetracyclines", only_rsi_columns = only_rsi_columns)
|
||||
ab_selector("tetracyclines", only_rsi_columns = only_rsi_columns)
|
||||
}
|
||||
|
||||
ab_selector <- function(ab_class,
|
||||
function_name,
|
||||
only_rsi_columns) {
|
||||
meet_criteria(ab_class, allow_class = "character", has_length = 1, .call_depth = 1)
|
||||
meet_criteria(function_name, allow_class = "character", has_length = 1, .call_depth = 1)
|
||||
#' @rdname antibiotic_class_selectors
|
||||
#' @export
|
||||
ureidopenicillins <- function(only_rsi_columns = FALSE) {
|
||||
ab_selector("ureidopenicillins", only_rsi_columns = only_rsi_columns)
|
||||
}
|
||||
|
||||
ab_selector <- function(function_name,
|
||||
only_rsi_columns,
|
||||
ab_class = NULL) {
|
||||
meet_criteria(function_name, allow_class = "character", has_length = 1, allow_NULL = TRUE, .call_depth = 1)
|
||||
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1, .call_depth = 1)
|
||||
meet_criteria(ab_class, allow_class = "character", has_length = 1, allow_NULL = TRUE, .call_depth = 1)
|
||||
|
||||
if (getRversion() < "3.2") {
|
||||
warning_("antibiotic class selectors such as ", function_name,
|
||||
"() require R version 3.2 or later - you have ", R.version.string,
|
||||
call = FALSE)
|
||||
return(NULL)
|
||||
}
|
||||
|
||||
# to improve speed, get_current_data() and get_column_abx() only run once when e.g. in a select or group call
|
||||
# get_current_data() has to run each time, for cases where e.g., filter() and select() are used in same call
|
||||
vars_df <- get_current_data(arg_name = NA, call = -3)
|
||||
# to improve speed, get_column_abx() will only run once when e.g. in a select or group call
|
||||
ab_in_data <- get_column_abx(vars_df, info = FALSE, only_rsi_columns = only_rsi_columns, sort = FALSE)
|
||||
|
||||
if (length(ab_in_data) == 0) {
|
||||
message_("No antimicrobial agents found.")
|
||||
message_("No antimicrobial agents found in the data.")
|
||||
return(NULL)
|
||||
}
|
||||
|
||||
ab_reference <- subset(antibiotics,
|
||||
if (is.null(ab_class)) {
|
||||
# their upper case equivalent are vectors with class <ab>, created in data-raw/_internals.R
|
||||
abx <- get(toupper(function_name), envir = asNamespace("AMR"))
|
||||
ab_group <- function_name
|
||||
examples <- paste0(" (such as ", vector_or(ab_name(sample(abx, size = min(2, length(abx)), replace = FALSE),
|
||||
tolower = TRUE,
|
||||
language = NULL),
|
||||
quotes = FALSE), ")")
|
||||
} else {
|
||||
# this for the 'manual' ab_class() function
|
||||
abx <- subset(AB_lookup,
|
||||
group %like% ab_class |
|
||||
atc_group1 %like% ab_class |
|
||||
atc_group2 %like% ab_class)
|
||||
atc_group2 %like% ab_class)$ab
|
||||
ab_group <- find_ab_group(ab_class)
|
||||
if (ab_group == "") {
|
||||
ab_group <- paste0("'", ab_class, "'")
|
||||
examples <- ""
|
||||
} else {
|
||||
function_name <- "ab_class"
|
||||
examples <- paste0(" (such as ", find_ab_names(ab_class, 2), ")")
|
||||
}
|
||||
|
||||
# get the columns with a group names in the chosen ab class
|
||||
agents <- ab_in_data[names(ab_in_data) %in% ab_reference$ab]
|
||||
agents <- ab_in_data[names(ab_in_data) %in% abx]
|
||||
|
||||
if (message_not_thrown_before(function_name)) {
|
||||
if (length(agents) == 0) {
|
||||
message_("No antimicrobial agents of class ", ab_group, " found", examples, ".")
|
||||
message_("No antimicrobial agents of class '", ab_group, "' found", examples, ".")
|
||||
} else {
|
||||
agents_formatted <- paste0("'", font_bold(agents, collapse = NULL), "'")
|
||||
agents_names <- ab_name(names(agents), tolower = TRUE, language = NULL)
|
||||
need_name <- tolower(gsub("[^a-zA-Z]", "", agents)) != tolower(gsub("[^a-zA-Z]", "", agents_names))
|
||||
agents_formatted[need_name] <- paste0(agents_formatted[need_name],
|
||||
" (", agents_names[need_name], ")")
|
||||
message_("For `", function_name, "(", ifelse(function_name == "ab_class", paste0("\"", ab_class, "\""), ""), ")` using ",
|
||||
need_name <- generalise_antibiotic_name(agents) != generalise_antibiotic_name(agents_names)
|
||||
agents_formatted[need_name] <- paste0(agents_formatted[need_name], " (", agents_names[need_name], ")")
|
||||
message_("For `", function_name, "(",
|
||||
ifelse(function_name == "ab_class",
|
||||
paste0("\"", ab_class, "\""),
|
||||
""),
|
||||
")` using ",
|
||||
ifelse(length(agents) == 1, "column: ", "columns: "),
|
||||
vector_and(agents_formatted, quotes = FALSE))
|
||||
vector_and(agents_formatted, quotes = FALSE, sort = FALSE))
|
||||
}
|
||||
remember_thrown_message(function_name)
|
||||
}
|
||||
@ -423,19 +469,8 @@ is_all <- function(el1) {
|
||||
|
||||
|
||||
find_ab_group <- function(ab_class) {
|
||||
ab_class[ab_class == "carbapenem|cephalosporin|penicillin"] <- "betalactam"
|
||||
ab_class <- gsub("[^a-zA-Z0-9]", ".*", ab_class)
|
||||
ifelse(ab_class %in% c("aminoglycoside",
|
||||
"betalactam",
|
||||
"carbapenem",
|
||||
"cephalosporin",
|
||||
"fluoroquinolone",
|
||||
"glycopeptide",
|
||||
"macrolide",
|
||||
"oxazolidinone",
|
||||
"tetracycline"),
|
||||
paste0(ab_class, "s"),
|
||||
antibiotics %pm>%
|
||||
AB_lookup %pm>%
|
||||
subset(group %like% ab_class |
|
||||
atc_group1 %like% ab_class |
|
||||
atc_group2 %like% ab_class) %pm>%
|
||||
@ -444,7 +479,6 @@ find_ab_group <- function(ab_class) {
|
||||
tolower() %pm>%
|
||||
sort() %pm>%
|
||||
paste(collapse = "/")
|
||||
)
|
||||
}
|
||||
|
||||
find_ab_names <- function(ab_group, n = 3) {
|
||||
@ -462,6 +496,9 @@ find_ab_names <- function(ab_group, n = 3) {
|
||||
antibiotics$atc_group2 %like% ab_group) &
|
||||
antibiotics$ab %unlike% "[0-9]$"), ]$name
|
||||
}
|
||||
if (length(drugs) == 0) {
|
||||
return("??")
|
||||
}
|
||||
vector_or(ab_name(sample(drugs, size = min(n, length(drugs)), replace = FALSE),
|
||||
tolower = TRUE,
|
||||
language = NULL),
|
||||
|
2
R/amr.R
2
R/amr.R
@ -61,7 +61,7 @@
|
||||
#' Matthijs S. Berends \cr
|
||||
#' m.s.berends \[at\] umcg \[dot\] nl \cr
|
||||
#' University of Groningen
|
||||
#' Department of Medical Microbiology and Infection Prevention
|
||||
#' Department of Medical Microbiology and Infection Prevention \cr
|
||||
#' University Medical Center Groningen \cr
|
||||
#' Post Office Box 30001 \cr
|
||||
#' 9700 RB Groningen \cr
|
||||
|
50
R/count.R
50
R/count.R
@ -83,6 +83,12 @@
|
||||
#' n2 = n_rsi(CIP), # same - analogous to n_distinct
|
||||
#' total = n()) # NOT the number of tested isolates!
|
||||
#'
|
||||
#' # Number of available isolates for a whole antibiotic class
|
||||
#' # (i.e., in this data set columns GEN, TOB, AMK, KAN)
|
||||
#' example_isolates %>%
|
||||
#' group_by(hospital_id) %>%
|
||||
#' summarise(across(aminoglycosides(), n_rsi))
|
||||
#'
|
||||
#' # Count co-resistance between amoxicillin/clav acid and gentamicin,
|
||||
#' # so we can see that combination therapy does a lot more than mono therapy.
|
||||
#' # Please mind that `susceptibility()` calculates percentages right away instead.
|
||||
@ -108,81 +114,97 @@
|
||||
#' }
|
||||
#' }
|
||||
count_resistant <- function(..., only_all_tested = FALSE) {
|
||||
tryCatch(
|
||||
rsi_calc(...,
|
||||
ab_result = "R",
|
||||
only_all_tested = only_all_tested,
|
||||
only_count = TRUE)
|
||||
only_count = TRUE),
|
||||
error = function(e) stop_(e$message, call = -5))
|
||||
}
|
||||
|
||||
#' @rdname count
|
||||
#' @export
|
||||
count_susceptible <- function(..., only_all_tested = FALSE) {
|
||||
tryCatch(
|
||||
rsi_calc(...,
|
||||
ab_result = c("S", "I"),
|
||||
only_all_tested = only_all_tested,
|
||||
only_count = TRUE)
|
||||
only_count = TRUE),
|
||||
error = function(e) stop_(e$message, call = -5))
|
||||
}
|
||||
|
||||
#' @rdname count
|
||||
#' @export
|
||||
count_R <- function(..., only_all_tested = FALSE) {
|
||||
tryCatch(
|
||||
rsi_calc(...,
|
||||
ab_result = "R",
|
||||
only_all_tested = only_all_tested,
|
||||
only_count = TRUE)
|
||||
only_count = TRUE),
|
||||
error = function(e) stop_(e$message, call = -5))
|
||||
}
|
||||
|
||||
#' @rdname count
|
||||
#' @export
|
||||
count_IR <- function(..., only_all_tested = FALSE) {
|
||||
if (message_not_thrown_before("count_IR")) {
|
||||
warning_("Using count_IR() is discouraged; use count_resistant() instead to not consider \"I\" being resistant.", call = FALSE)
|
||||
if (message_not_thrown_before("count_IR", entire_session = TRUE)) {
|
||||
message_("Using `count_IR()` is discouraged; use `count_resistant()` instead to not consider \"I\" being resistant. This note will be shown once for this session.", as_note = FALSE)
|
||||
remember_thrown_message("count_IR")
|
||||
}
|
||||
tryCatch(
|
||||
rsi_calc(...,
|
||||
ab_result = c("I", "R"),
|
||||
only_all_tested = only_all_tested,
|
||||
only_count = TRUE)
|
||||
only_count = TRUE),
|
||||
error = function(e) stop_(e$message, call = -5))
|
||||
}
|
||||
|
||||
#' @rdname count
|
||||
#' @export
|
||||
count_I <- function(..., only_all_tested = FALSE) {
|
||||
tryCatch(
|
||||
rsi_calc(...,
|
||||
ab_result = "I",
|
||||
only_all_tested = only_all_tested,
|
||||
only_count = TRUE)
|
||||
only_count = TRUE),
|
||||
error = function(e) stop_(e$message, call = -5))
|
||||
}
|
||||
|
||||
#' @rdname count
|
||||
#' @export
|
||||
count_SI <- function(..., only_all_tested = FALSE) {
|
||||
tryCatch(
|
||||
rsi_calc(...,
|
||||
ab_result = c("S", "I"),
|
||||
only_all_tested = only_all_tested,
|
||||
only_count = TRUE)
|
||||
only_count = TRUE),
|
||||
error = function(e) stop_(e$message, call = -5))
|
||||
}
|
||||
|
||||
#' @rdname count
|
||||
#' @export
|
||||
count_S <- function(..., only_all_tested = FALSE) {
|
||||
if (message_not_thrown_before("count_S")) {
|
||||
warning_("Using count_S() is discouraged; use count_susceptible() instead to also consider \"I\" being susceptible.", call = FALSE)
|
||||
if (message_not_thrown_before("count_S", entire_session = TRUE)) {
|
||||
message_("Using `count_S()` is discouraged; use `count_susceptible()` instead to also consider \"I\" being susceptible. This note will be shown once for this session.", as_note = FALSE)
|
||||
remember_thrown_message("count_S")
|
||||
}
|
||||
tryCatch(
|
||||
rsi_calc(...,
|
||||
ab_result = "S",
|
||||
only_all_tested = only_all_tested,
|
||||
only_count = TRUE)
|
||||
only_count = TRUE),
|
||||
error = function(e) stop_(e$message, call = -5))
|
||||
}
|
||||
|
||||
#' @rdname count
|
||||
#' @export
|
||||
count_all <- function(..., only_all_tested = FALSE) {
|
||||
tryCatch(
|
||||
rsi_calc(...,
|
||||
ab_result = c("S", "I", "R"),
|
||||
only_all_tested = only_all_tested,
|
||||
only_count = TRUE)
|
||||
only_count = TRUE),
|
||||
error = function(e) stop_(e$message, call = -5))
|
||||
}
|
||||
|
||||
#' @rdname count
|
||||
@ -196,11 +218,13 @@ count_df <- function(data,
|
||||
language = get_locale(),
|
||||
combine_SI = TRUE,
|
||||
combine_IR = FALSE) {
|
||||
tryCatch(
|
||||
rsi_calc_df(type = "count",
|
||||
data = data,
|
||||
translate_ab = translate_ab,
|
||||
language = language,
|
||||
combine_SI = combine_SI,
|
||||
combine_IR = combine_IR,
|
||||
combine_SI_missing = missing(combine_SI))
|
||||
combine_SI_missing = missing(combine_SI)),
|
||||
error = function(e) stop_(e$message, call = -5))
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ format_eucast_version_nr <- function(version, markdown = TRUE) {
|
||||
#' @param verbose a [logical] to turn Verbose mode on and off (default is off). In Verbose mode, the function does not apply rules to the data, but instead returns a data set in logbook form with extensive info about which rows and columns would be effected and in which way. Using Verbose mode takes a lot more time.
|
||||
#' @param version_breakpoints the version number to use for the EUCAST Clinical Breakpoints guideline. Can be either `r vector_or(names(EUCAST_VERSION_BREAKPOINTS), reverse = TRUE)`.
|
||||
#' @param version_expertrules the version number to use for the EUCAST Expert Rules and Intrinsic Resistance guideline. Can be either `r vector_or(names(EUCAST_VERSION_EXPERT_RULES), reverse = TRUE)`.
|
||||
#' @param ampc_cephalosporin_resistance a [character] value that should be applied to cefotaxime, ceftriaxone and ceftazidime for AmpC de-repressed cephalosporin-resistant mutants, defaults to `NA`. Currently only works when `version_expertrules` is `3.2`; '*EUCAST Expert Rules v3.2 on Enterobacterales*' states that results of cefotaxime, ceftriaxone and ceftazidime should be reported with a note, or results should be suppressed (emptied) for these three agents. A value of `NA` (the default) for this argument will remove results for these three agents, while e.g. a value of `"R"` will make the results for these agents resistant. Use `NULL` or `FALSE` to not alter results for these three agents of AmpC de-repressed cephalosporin-resistant mutants. Using `TRUE` is equal to using `"R"`. \cr For *EUCAST Expert Rules* v3.2, this rule applies to: `r vector_and(gsub("[^a-zA-Z ]+", "", unlist(strsplit(eucast_rules_file[which(eucast_rules_file$reference.version == 3.2 & eucast_rules_file$reference.rule %like% "ampc"), "this_value"][1], "|", fixed = TRUE))), quotes = "*")`.
|
||||
#' @param ampc_cephalosporin_resistance a [character] value that should be applied to cefotaxime, ceftriaxone and ceftazidime for AmpC de-repressed cephalosporin-resistant mutants, defaults to `NA`. Currently only works when `version_expertrules` is `3.2`; '*EUCAST Expert Rules v3.2 on Enterobacterales*' states that results of cefotaxime, ceftriaxone and ceftazidime should be reported with a note, or results should be suppressed (emptied) for these three agents. A value of `NA` (the default) for this argument will remove results for these three agents, while e.g. a value of `"R"` will make the results for these agents resistant. Use `NULL` or `FALSE` to not alter results for these three agents of AmpC de-repressed cephalosporin-resistant mutants. Using `TRUE` is equal to using `"R"`. \cr For *EUCAST Expert Rules* v3.2, this rule applies to: `r vector_and(gsub("[^a-zA-Z ]+", "", unlist(strsplit(EUCAST_RULES_DF[which(EUCAST_RULES_DF$reference.version == 3.2 & EUCAST_RULES_DF$reference.rule %like% "ampc"), "this_value"][1], "|", fixed = TRUE))), quotes = "*")`.
|
||||
#' @param ... column name of an antibiotic, see section *Antibiotics* below
|
||||
#' @param ab any (vector of) text that can be coerced to a valid antibiotic code with [as.ab()]
|
||||
#' @param administration route of administration, either `r vector_or(dosage$administration)`
|
||||
@ -561,11 +561,11 @@ eucast_rules <- function(x,
|
||||
# Official EUCAST rules ---------------------------------------------------
|
||||
eucast_notification_shown <- FALSE
|
||||
if (!is.null(list(...)$eucast_rules_df)) {
|
||||
# this allows: eucast_rules(x, eucast_rules_df = AMR:::eucast_rules_file %>% filter(is.na(have_these_values)))
|
||||
# this allows: eucast_rules(x, eucast_rules_df = AMR:::EUCAST_RULES_DF %>% filter(is.na(have_these_values)))
|
||||
eucast_rules_df <- list(...)$eucast_rules_df
|
||||
} else {
|
||||
# otherwise internal data file, created in data-raw/_internals.R
|
||||
eucast_rules_df <- eucast_rules_file
|
||||
eucast_rules_df <- EUCAST_RULES_DF
|
||||
}
|
||||
|
||||
# filter on user-set guideline versions ----
|
||||
|
@ -131,11 +131,8 @@
|
||||
#' # `example_isolates` is a data set available in the AMR package.
|
||||
#' # See ?example_isolates.
|
||||
#'
|
||||
#' example_isolates[first_isolate(example_isolates), ]
|
||||
#' \donttest{
|
||||
#' # faster way, only works in R 3.2 and later:
|
||||
#' example_isolates[first_isolate(), ]
|
||||
#'
|
||||
#' \donttest{
|
||||
#' # get all first Gram-negatives
|
||||
#' example_isolates[which(first_isolate() & mo_is_gram_negative()), ]
|
||||
#'
|
||||
|
@ -386,15 +386,15 @@ scale_rsi_colours <- function(...,
|
||||
}
|
||||
|
||||
names_susceptible <- c("S", "SI", "IS", "S+I", "I+S", "susceptible", "Susceptible",
|
||||
unique(translations_file[which(translations_file$pattern == "Susceptible"),
|
||||
unique(TRANSLATIONS[which(TRANSLATIONS$pattern == "Susceptible"),
|
||||
"replacement", drop = TRUE]))
|
||||
names_incr_exposure <- c("I", "intermediate", "increased exposure", "incr. exposure", "Increased exposure", "Incr. exposure",
|
||||
unique(translations_file[which(translations_file$pattern == "Intermediate"),
|
||||
unique(TRANSLATIONS[which(TRANSLATIONS$pattern == "Intermediate"),
|
||||
"replacement", drop = TRUE]),
|
||||
unique(translations_file[which(translations_file$pattern == "Incr. exposure"),
|
||||
unique(TRANSLATIONS[which(TRANSLATIONS$pattern == "Incr. exposure"),
|
||||
"replacement", drop = TRUE]))
|
||||
names_resistant <- c("R", "IR", "RI", "R+I", "I+R", "resistant", "Resistant",
|
||||
unique(translations_file[which(translations_file$pattern == "Resistant"),
|
||||
unique(TRANSLATIONS[which(TRANSLATIONS$pattern == "Resistant"),
|
||||
"replacement", drop = TRUE]))
|
||||
|
||||
susceptible <- rep("#3CAEA3", length(names_susceptible))
|
||||
|
@ -36,7 +36,7 @@
|
||||
#' @param ... ignored, only in place to allow future extensions
|
||||
#' @details **Note:** As opposed to the `join()` functions of `dplyr`, [character] vectors are supported and at default existing columns will get a suffix `"2"` and the newly joined columns will not get a suffix.
|
||||
#'
|
||||
#' If the `dplyr` package is installed, their join functions will be used. Otherwise, the much slower [merge()] and [interaction()] functions from base R will be used.
|
||||
#' If the `dplyr` package is installed, their join functions will be used. Otherwise, the much slower [merge()] and [interaction()] functions from base \R will be used.
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @return a [data.frame]
|
||||
#' @export
|
||||
|
25
R/mo.R
25
R/mo.R
@ -469,7 +469,7 @@ exec_as.mo <- function(x,
|
||||
x <- strip_whitespace(x, dyslexia_mode)
|
||||
# translate 'unknown' names back to English
|
||||
if (any(x %like% "unbekannt|onbekend|desconocid|sconosciut|iconnu|desconhecid", na.rm = TRUE)) {
|
||||
trns <- subset(translations_file, pattern %like% "unknown" | affect_mo_name == TRUE)
|
||||
trns <- subset(TRANSLATIONS, pattern %like% "unknown" | affect_mo_name == TRUE)
|
||||
langs <- LANGUAGES_SUPPORTED[LANGUAGES_SUPPORTED != "en"]
|
||||
for (l in langs) {
|
||||
for (i in seq_len(nrow(trns))) {
|
||||
@ -1664,16 +1664,23 @@ pillar_shaft.mo <- function(x, ...) {
|
||||
out[is.na(x)] <- font_na(" NA")
|
||||
out[x == "UNKNOWN"] <- font_na(" UNKNOWN")
|
||||
|
||||
if (!all(x[!is.na(x)] %in% MO_lookup$mo)) {
|
||||
df <- tryCatch(get_current_data(arg_name = "x", call = 0),
|
||||
error = function(e) NULL)
|
||||
if (!is.null(df)) {
|
||||
mo_cols <- vapply(FUN.VALUE = logical(1), df, is.mo)
|
||||
} else {
|
||||
mo_cols <- NULL
|
||||
}
|
||||
|
||||
if (!all(x[!is.na(x)] %in% MO_lookup$mo) |
|
||||
(!is.null(df) && !all(unlist(df[, which(mo_cols), drop = FALSE]) %in% MO_lookup$mo))) {
|
||||
# markup old mo codes
|
||||
out[!x %in% MO_lookup$mo] <- font_italic(font_na(x[!x %in% MO_lookup$mo],
|
||||
collapse = NULL),
|
||||
collapse = NULL)
|
||||
# throw a warning with the affected column name
|
||||
mo <- tryCatch(search_type_in_df(get_current_data(arg_name = "x", call = 0), type = "mo", info = FALSE),
|
||||
error = function(e) NULL)
|
||||
if (!is.null(mo)) {
|
||||
col <- paste0("Column '", mo, "'")
|
||||
# throw a warning with the affected column name(s)
|
||||
if (!is.null(mo_cols)) {
|
||||
col <- paste0("Column ", vector_or(colnames(df)[mo_cols], quotes = TRUE, sort = FALSE))
|
||||
} else {
|
||||
col <- "The data"
|
||||
}
|
||||
@ -2039,12 +2046,12 @@ parse_and_convert <- function(x) {
|
||||
x <- as.data.frame(x, stringsAsFactors = FALSE)[[1]]
|
||||
}
|
||||
}
|
||||
x[is.null(x)] <- NA
|
||||
parsed <- iconv(x, to = "UTF-8")
|
||||
parsed <- iconv(as.character(x), to = "UTF-8")
|
||||
parsed[is.na(parsed) & !is.na(x)] <- iconv(x[is.na(parsed) & !is.na(x)], from = "Latin1", to = "ASCII//TRANSLIT")
|
||||
parsed <- gsub('"', "", parsed, fixed = TRUE)
|
||||
parsed <- gsub(" +", " ", parsed, perl = TRUE)
|
||||
parsed <- trimws(parsed)
|
||||
parsed
|
||||
}, error = function(e) stop(e$message, call. = FALSE)) # this will also be thrown when running `as.mo(no_existing_object)`
|
||||
parsed
|
||||
}
|
||||
|
@ -754,7 +754,7 @@ find_mo_col <- function(fn) {
|
||||
}, silent = TRUE)
|
||||
if (!is.null(df) && !is.null(mo) && is.data.frame(df)) {
|
||||
if (message_not_thrown_before(fn = fn)) {
|
||||
message_("Using column '", font_bold(mo), "' as input for ", fn, "()")
|
||||
message_("Using column '", font_bold(mo), "' as input for `", fn, "()`")
|
||||
remember_thrown_message(fn = fn)
|
||||
}
|
||||
return(df[, mo, drop = TRUE])
|
||||
|
17
R/plot.R
17
R/plot.R
@ -25,7 +25,7 @@
|
||||
|
||||
#' Plotting for Classes `rsi`, `mic` and `disk`
|
||||
#'
|
||||
#' Functions to plot classes `rsi`, `mic` and `disk`, with support for base R and `ggplot2`.
|
||||
#' Functions to plot classes `rsi`, `mic` and `disk`, with support for base \R and `ggplot2`.
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @param x,data MIC values created with [as.mic()] or disk diffusion values created with [as.disk()]
|
||||
@ -287,6 +287,11 @@ ggplot.mic <- function(data,
|
||||
ggplot2::labs(title = title, x = xlab, y = ylab, subtitle = cols_sub$sub)
|
||||
}
|
||||
|
||||
#' @method autoplot mic
|
||||
#' @rdname plot
|
||||
# will be exported using s3_register() in R/zzz.R
|
||||
autoplot.mic <- ggplot.mic
|
||||
|
||||
#' @method plot disk
|
||||
#' @export
|
||||
#' @importFrom graphics barplot axis mtext legend
|
||||
@ -506,6 +511,11 @@ ggplot.disk <- function(data,
|
||||
ggplot2::labs(title = title, x = xlab, y = ylab, subtitle = cols_sub$sub)
|
||||
}
|
||||
|
||||
#' @method autoplot disk
|
||||
#' @rdname plot
|
||||
# will be exported using s3_register() in R/zzz.R
|
||||
autoplot.disk <- ggplot.disk
|
||||
|
||||
#' @method plot rsi
|
||||
#' @export
|
||||
#' @importFrom graphics plot text axis
|
||||
@ -657,6 +667,11 @@ ggplot.rsi <- function(data,
|
||||
ggplot2::theme(legend.position = "none")
|
||||
}
|
||||
|
||||
#' @method autoplot rsi
|
||||
#' @rdname plot
|
||||
# will be exported using s3_register() in R/zzz.R
|
||||
autoplot.rsi <- ggplot.rsi
|
||||
|
||||
plot_prepare_table <- function(x, expand) {
|
||||
x <- x[!is.na(x)]
|
||||
stop_if(length(x) == 0, "no observations to plot", call = FALSE)
|
||||
|
@ -167,12 +167,14 @@ resistance <- function(...,
|
||||
minimum = 30,
|
||||
as_percent = FALSE,
|
||||
only_all_tested = FALSE) {
|
||||
tryCatch(
|
||||
rsi_calc(...,
|
||||
ab_result = "R",
|
||||
minimum = minimum,
|
||||
as_percent = as_percent,
|
||||
only_all_tested = only_all_tested,
|
||||
only_count = FALSE)
|
||||
only_count = FALSE),
|
||||
error = function(e) stop_(e$message, call = -5))
|
||||
}
|
||||
|
||||
#' @rdname proportion
|
||||
@ -181,12 +183,14 @@ susceptibility <- function(...,
|
||||
minimum = 30,
|
||||
as_percent = FALSE,
|
||||
only_all_tested = FALSE) {
|
||||
tryCatch(
|
||||
rsi_calc(...,
|
||||
ab_result = c("S", "I"),
|
||||
minimum = minimum,
|
||||
as_percent = as_percent,
|
||||
only_all_tested = only_all_tested,
|
||||
only_count = FALSE)
|
||||
only_count = FALSE),
|
||||
error = function(e) stop_(e$message, call = -5))
|
||||
}
|
||||
|
||||
#' @rdname proportion
|
||||
@ -195,12 +199,14 @@ proportion_R <- function(...,
|
||||
minimum = 30,
|
||||
as_percent = FALSE,
|
||||
only_all_tested = FALSE) {
|
||||
tryCatch(
|
||||
rsi_calc(...,
|
||||
ab_result = "R",
|
||||
minimum = minimum,
|
||||
as_percent = as_percent,
|
||||
only_all_tested = only_all_tested,
|
||||
only_count = FALSE)
|
||||
only_count = FALSE),
|
||||
error = function(e) stop_(e$message, call = -5))
|
||||
}
|
||||
|
||||
#' @rdname proportion
|
||||
@ -209,12 +215,14 @@ proportion_IR <- function(...,
|
||||
minimum = 30,
|
||||
as_percent = FALSE,
|
||||
only_all_tested = FALSE) {
|
||||
tryCatch(
|
||||
rsi_calc(...,
|
||||
ab_result = c("I", "R"),
|
||||
minimum = minimum,
|
||||
as_percent = as_percent,
|
||||
only_all_tested = only_all_tested,
|
||||
only_count = FALSE)
|
||||
only_count = FALSE),
|
||||
error = function(e) stop_(e$message, call = -5))
|
||||
}
|
||||
|
||||
#' @rdname proportion
|
||||
@ -223,12 +231,14 @@ proportion_I <- function(...,
|
||||
minimum = 30,
|
||||
as_percent = FALSE,
|
||||
only_all_tested = FALSE) {
|
||||
tryCatch(
|
||||
rsi_calc(...,
|
||||
ab_result = "I",
|
||||
minimum = minimum,
|
||||
as_percent = as_percent,
|
||||
only_all_tested = only_all_tested,
|
||||
only_count = FALSE)
|
||||
only_count = FALSE),
|
||||
error = function(e) stop_(e$message, call = -5))
|
||||
}
|
||||
|
||||
#' @rdname proportion
|
||||
@ -237,12 +247,14 @@ proportion_SI <- function(...,
|
||||
minimum = 30,
|
||||
as_percent = FALSE,
|
||||
only_all_tested = FALSE) {
|
||||
tryCatch(
|
||||
rsi_calc(...,
|
||||
ab_result = c("S", "I"),
|
||||
minimum = minimum,
|
||||
as_percent = as_percent,
|
||||
only_all_tested = only_all_tested,
|
||||
only_count = FALSE)
|
||||
only_count = FALSE),
|
||||
error = function(e) stop_(e$message, call = -5))
|
||||
}
|
||||
|
||||
#' @rdname proportion
|
||||
@ -251,12 +263,14 @@ proportion_S <- function(...,
|
||||
minimum = 30,
|
||||
as_percent = FALSE,
|
||||
only_all_tested = FALSE) {
|
||||
tryCatch(
|
||||
rsi_calc(...,
|
||||
ab_result = "S",
|
||||
minimum = minimum,
|
||||
as_percent = as_percent,
|
||||
only_all_tested = only_all_tested,
|
||||
only_count = FALSE)
|
||||
only_count = FALSE),
|
||||
error = function(e) stop_(e$message, call = -5))
|
||||
}
|
||||
|
||||
#' @rdname proportion
|
||||
@ -268,6 +282,7 @@ proportion_df <- function(data,
|
||||
as_percent = FALSE,
|
||||
combine_SI = TRUE,
|
||||
combine_IR = FALSE) {
|
||||
tryCatch(
|
||||
rsi_calc_df(type = "proportion",
|
||||
data = data,
|
||||
translate_ab = translate_ab,
|
||||
@ -276,5 +291,6 @@ proportion_df <- function(data,
|
||||
as_percent = as_percent,
|
||||
combine_SI = combine_SI,
|
||||
combine_IR = combine_IR,
|
||||
combine_SI_missing = missing(combine_SI))
|
||||
combine_SI_missing = missing(combine_SI)),
|
||||
error = function(e) stop_(e$message, call = -5))
|
||||
}
|
||||
|
10
R/random.R
10
R/random.R
@ -32,7 +32,7 @@
|
||||
#' @param ab any [character] that can be coerced to a valid antimicrobial agent code with [as.ab()]
|
||||
#' @param prob_RSI a vector of length 3: the probabilities for R (1st value), S (2nd value) and I (3rd value)
|
||||
#' @param ... ignored, only in place to allow future extensions
|
||||
#' @details The base R function [sample()] is used for generating values.
|
||||
#' @details The base \R function [sample()] is used for generating values.
|
||||
#'
|
||||
#' Generated values are based on the latest EUCAST guideline implemented in the [rsi_translation] data set. To create specific generated values per bug or drug, set the `mo` and/or `ab` argument.
|
||||
#' @return class `<mic>` for [random_mic()] (see [as.mic()]) and class `<disk>` for [random_disk()] (see [as.disk()])
|
||||
@ -56,18 +56,26 @@
|
||||
#' random_disk(100, "Streptococcus pneumoniae", "ampicillin") # range 12-27
|
||||
#' }
|
||||
random_mic <- function(size, mo = NULL, ab = NULL, ...) {
|
||||
meet_criteria(size, allow_class = c("numeric", "integer"), has_length = 1, is_positive = TRUE, is_finite = TRUE)
|
||||
meet_criteria(mo, allow_class = "character", has_length = 1, allow_NULL = TRUE)
|
||||
meet_criteria(ab, allow_class = "character", has_length = 1, allow_NULL = TRUE)
|
||||
random_exec("MIC", size = size, mo = mo, ab = ab)
|
||||
}
|
||||
|
||||
#' @rdname random
|
||||
#' @export
|
||||
random_disk <- function(size, mo = NULL, ab = NULL, ...) {
|
||||
meet_criteria(size, allow_class = c("numeric", "integer"), has_length = 1, is_positive = TRUE, is_finite = TRUE)
|
||||
meet_criteria(mo, allow_class = "character", has_length = 1, allow_NULL = TRUE)
|
||||
meet_criteria(ab, allow_class = "character", has_length = 1, allow_NULL = TRUE)
|
||||
random_exec("DISK", size = size, mo = mo, ab = ab)
|
||||
}
|
||||
|
||||
#' @rdname random
|
||||
#' @export
|
||||
random_rsi <- function(size, prob_RSI = c(0.33, 0.33, 0.33), ...) {
|
||||
meet_criteria(size, allow_class = c("numeric", "integer"), has_length = 1, is_positive = TRUE, is_finite = TRUE)
|
||||
meet_criteria(prob_RSI, allow_class = c("numeric", "integer"), has_length = 3)
|
||||
sample(as.rsi(c("R", "S", "I")), size = size, replace = TRUE, prob = prob_RSI)
|
||||
}
|
||||
|
||||
|
@ -351,20 +351,6 @@ plot.resistance_predict <- function(x, main = paste("Resistance Prediction of",
|
||||
col = "grey40")
|
||||
}
|
||||
|
||||
|
||||
#' @method ggplot resistance_predict
|
||||
#' @rdname resistance_predict
|
||||
# will be exported using s3_register() in R/zzz.R
|
||||
ggplot.resistance_predict <- function(x,
|
||||
main = paste("Resistance Prediction of", x_name),
|
||||
ribbon = TRUE,
|
||||
...) {
|
||||
x_name <- paste0(ab_name(attributes(x)$ab), " (", attributes(x)$ab, ")")
|
||||
meet_criteria(main, allow_class = "character", has_length = 1)
|
||||
meet_criteria(ribbon, allow_class = "logical", has_length = 1)
|
||||
ggplot_rsi_predict(x = x, main = main, ribbon = ribbon, ...)
|
||||
}
|
||||
|
||||
#' @rdname resistance_predict
|
||||
#' @export
|
||||
ggplot_rsi_predict <- function(x,
|
||||
@ -407,3 +393,21 @@ ggplot_rsi_predict <- function(x,
|
||||
colour = "grey40")
|
||||
p
|
||||
}
|
||||
|
||||
#' @method ggplot resistance_predict
|
||||
#' @rdname resistance_predict
|
||||
# will be exported using s3_register() in R/zzz.R
|
||||
ggplot.resistance_predict <- function(x,
|
||||
main = paste("Resistance Prediction of", x_name),
|
||||
ribbon = TRUE,
|
||||
...) {
|
||||
x_name <- paste0(ab_name(attributes(x)$ab), " (", attributes(x)$ab, ")")
|
||||
meet_criteria(main, allow_class = "character", has_length = 1)
|
||||
meet_criteria(ribbon, allow_class = "logical", has_length = 1)
|
||||
ggplot_rsi_predict(x = x, main = main, ribbon = ribbon, ...)
|
||||
}
|
||||
|
||||
#' @method autoplot resistance_predict
|
||||
#' @rdname resistance_predict
|
||||
# will be exported using s3_register() in R/zzz.R
|
||||
autoplot.resistance_predict <- ggplot.resistance_predict
|
||||
|
4
R/rsi.R
4
R/rsi.R
@ -349,7 +349,7 @@ as.rsi.mic <- function(x,
|
||||
|
||||
# for dplyr's across()
|
||||
cur_column_dplyr <- import_fn("cur_column", "dplyr", error_on_fail = FALSE)
|
||||
if (!is.null(cur_column_dplyr) && tryCatch(is.data.frame(get_current_data("ab", 0)), error = function(e) FALSE)) {
|
||||
if (!is.null(cur_column_dplyr) && tryCatch(is.data.frame(get_current_data("ab", call = 0)), error = function(e) FALSE)) {
|
||||
# try to get current column, which will only be available when in across()
|
||||
ab <- tryCatch(cur_column_dplyr(),
|
||||
error = function(e) ab)
|
||||
@ -438,7 +438,7 @@ as.rsi.disk <- function(x,
|
||||
|
||||
# for dplyr's across()
|
||||
cur_column_dplyr <- import_fn("cur_column", "dplyr", error_on_fail = FALSE)
|
||||
if (!is.null(cur_column_dplyr) && tryCatch(is.data.frame(get_current_data("ab", 0)), error = function(e) FALSE)) {
|
||||
if (!is.null(cur_column_dplyr) && tryCatch(is.data.frame(get_current_data("ab", call = 0)), error = function(e) FALSE)) {
|
||||
# try to get current column, which will only be available when in across()
|
||||
ab <- tryCatch(cur_column_dplyr(),
|
||||
error = function(e) ab)
|
||||
|
BIN
R/sysdata.rda
BIN
R/sysdata.rda
Binary file not shown.
@ -136,7 +136,7 @@ translate_AMR <- function(from,
|
||||
return(from)
|
||||
}
|
||||
|
||||
df_trans <- translations_file # internal data file
|
||||
df_trans <- TRANSLATIONS # internal data file
|
||||
from.bak <- from
|
||||
from_unique <- unique(from)
|
||||
from_unique_translated <- from_unique
|
||||
|
4
R/zzz.R
4
R/zzz.R
@ -65,6 +65,10 @@ if (utf8_supported && !is_latex) {
|
||||
s3_register("ggplot2::ggplot", "mic")
|
||||
s3_register("ggplot2::ggplot", "disk")
|
||||
s3_register("ggplot2::ggplot", "resistance_predict")
|
||||
s3_register("ggplot2::autoplot", "rsi")
|
||||
s3_register("ggplot2::autoplot", "mic")
|
||||
s3_register("ggplot2::autoplot", "disk")
|
||||
s3_register("ggplot2::autoplot", "resistance_predict")
|
||||
|
||||
# if mo source exists, fire it up (see mo_source())
|
||||
try({
|
||||
|
Binary file not shown.
@ -26,7 +26,6 @@
|
||||
# some old R instances have trouble installing tinytest, so we ship it too
|
||||
install.packages("data-raw/tinytest_1.2.4.10.tar.gz")
|
||||
install.packages("data-raw/AMR_latest.tar.gz", dependencies = FALSE)
|
||||
install.packages("covr", repos = "https://cran.rstudio.com/")
|
||||
|
||||
pkg_suggests <- gsub("[^a-zA-Z0-9]+", "", unlist(strsplit(packageDescription("AMR", fields = "Suggests"), ", ?")))
|
||||
cat("Packages listed in Suggests:", paste(pkg_suggests, collapse = ", "), "\n")
|
||||
@ -37,7 +36,7 @@ if (length(to_install) == 0) {
|
||||
}
|
||||
for (i in seq_len(length(to_install))) {
|
||||
cat("Installing package", to_install[i], "\n")
|
||||
tryCatch(install.packages(to_install[i], repos = "https://cran.rstudio.com/", dependencies = TRUE, quiet = TRUE),
|
||||
tryCatch(install.packages(to_install[i], repos = "https://cran.rstudio.com/", dependencies = TRUE, quiet = FALSE),
|
||||
# message = function(m) invisible(),
|
||||
warning = function(w) message(w$message),
|
||||
error = function(e) message(e$message))
|
||||
|
@ -34,7 +34,7 @@ old_globalenv <- ls(envir = globalenv())
|
||||
# Save internal data to R/sysdata.rda -------------------------------------
|
||||
|
||||
# See 'data-raw/eucast_rules.tsv' for the EUCAST reference file
|
||||
eucast_rules_file <- utils::read.delim(file = "data-raw/eucast_rules.tsv",
|
||||
EUCAST_RULES_DF <- utils::read.delim(file = "data-raw/eucast_rules.tsv",
|
||||
skip = 10,
|
||||
sep = "\t",
|
||||
stringsAsFactors = FALSE,
|
||||
@ -54,7 +54,7 @@ eucast_rules_file <- utils::read.delim(file = "data-raw/eucast_rules.tsv",
|
||||
select(-sorting_rule)
|
||||
|
||||
# Translations
|
||||
translations_file <- utils::read.delim(file = "data-raw/translations.tsv",
|
||||
TRANSLATIONS <- utils::read.delim(file = "data-raw/translations.tsv",
|
||||
sep = "\t",
|
||||
stringsAsFactors = FALSE,
|
||||
header = TRUE,
|
||||
@ -68,7 +68,7 @@ translations_file <- utils::read.delim(file = "data-raw/translations.tsv",
|
||||
quote = "")
|
||||
|
||||
# for checking input in `language` argument in e.g. mo_*() and ab_*() functions
|
||||
LANGUAGES_SUPPORTED <- sort(c("en", colnames(translations_file)[nchar(colnames(translations_file)) == 2]))
|
||||
LANGUAGES_SUPPORTED <- sort(c("en", colnames(TRANSLATIONS)[nchar(colnames(TRANSLATIONS)) == 2]))
|
||||
|
||||
# vectors of CoNS and CoPS, improves speed in as.mo()
|
||||
create_species_cons_cops <- function(type = c("CoNS", "CoPS")) {
|
||||
@ -121,18 +121,21 @@ CEPHALOSPORINS <- antibiotics %>% filter(group %like% "cephalosporin") %>% pull(
|
||||
CEPHALOSPORINS_1ST <- antibiotics %>% filter(group %like% "cephalosporin.*1") %>% pull(ab)
|
||||
CEPHALOSPORINS_2ND <- antibiotics %>% filter(group %like% "cephalosporin.*2") %>% pull(ab)
|
||||
CEPHALOSPORINS_3RD <- antibiotics %>% filter(group %like% "cephalosporin.*3") %>% pull(ab)
|
||||
CEPHALOSPORINS_4TH <- antibiotics %>% filter(group %like% "cephalosporin.*4") %>% pull(ab)
|
||||
CEPHALOSPORINS_5TH <- antibiotics %>% filter(group %like% "cephalosporin.*5") %>% pull(ab)
|
||||
CEPHALOSPORINS_EXCEPT_CAZ <- CEPHALOSPORINS[CEPHALOSPORINS != "CAZ"]
|
||||
FLUOROQUINOLONES <- antibiotics %>% filter(atc_group2 %like% "fluoroquinolone") %>% pull(ab)
|
||||
FLUOROQUINOLONES <- antibiotics %>% filter(atc_group2 %like% "fluoroquinolone" | (group %like% "quinolone" & is.na(atc_group2))) %>% pull(ab)
|
||||
LIPOGLYCOPEPTIDES <- as.ab(c("DAL", "ORI", "TLV")) # dalba/orita/tela
|
||||
GLYCOPEPTIDES <- antibiotics %>% filter(group %like% "glycopeptide") %>% pull(ab)
|
||||
GLYCOPEPTIDES_EXCEPT_LIPO <- GLYCOPEPTIDES[!GLYCOPEPTIDES %in% LIPOGLYCOPEPTIDES]
|
||||
LINCOSAMIDES <- antibiotics %>% filter(atc_group2 %like% "lincosamide") %>% pull(ab) %>% c("PRL")
|
||||
MACROLIDES <- antibiotics %>% filter(atc_group2 %like% "macrolide") %>% pull(ab)
|
||||
LINCOSAMIDES <- antibiotics %>% filter(atc_group2 %like% "lincosamide" | (group %like% "lincosamide" & is.na(atc_group2))) %>% pull(ab)
|
||||
MACROLIDES <- antibiotics %>% filter(atc_group2 %like% "macrolide" | (group %like% "macrolide" & is.na(atc_group2))) %>% pull(ab)
|
||||
OXAZOLIDINONES <- antibiotics %>% filter(group %like% "oxazolidinone") %>% pull(ab)
|
||||
PENICILLINS <- antibiotics %>% filter(group %like% "penicillin") %>% pull(ab)
|
||||
POLYMYXINS <- antibiotics %>% filter(group %like% "polymyxin") %>% pull(ab)
|
||||
QUINOLONES <- antibiotics %>% filter(group %like% "quinolone") %>% pull(ab)
|
||||
STREPTOGRAMINS <- antibiotics %>% filter(atc_group2 %like% "streptogramin") %>% pull(ab)
|
||||
TETRACYCLINES <- antibiotics %>% filter(atc_group2 %like% "tetracycline") %>% pull(ab)
|
||||
TETRACYCLINES <- antibiotics %>% filter(group %like% "tetracycline") %>% pull(ab)
|
||||
TETRACYCLINES_EXCEPT_TGC <- TETRACYCLINES[TETRACYCLINES != "TGC"]
|
||||
UREIDOPENICILLINS <- as.ab(c("PIP", "TZP", "AZL", "MEZ"))
|
||||
BETALACTAMS <- c(PENICILLINS, CEPHALOSPORINS, CARBAPENEMS)
|
||||
@ -141,8 +144,8 @@ DEFINED_AB_GROUPS <- ls(envir = globalenv())
|
||||
DEFINED_AB_GROUPS <- DEFINED_AB_GROUPS[!DEFINED_AB_GROUPS %in% globalenv_before_ab]
|
||||
|
||||
# Export to package as internal data ----
|
||||
usethis::use_data(eucast_rules_file,
|
||||
translations_file,
|
||||
usethis::use_data(EUCAST_RULES_DF,
|
||||
TRANSLATIONS,
|
||||
LANGUAGES_SUPPORTED,
|
||||
MO_CONS,
|
||||
MO_COPS,
|
||||
@ -153,6 +156,8 @@ usethis::use_data(eucast_rules_file,
|
||||
CEPHALOSPORINS_1ST,
|
||||
CEPHALOSPORINS_2ND,
|
||||
CEPHALOSPORINS_3RD,
|
||||
CEPHALOSPORINS_4TH,
|
||||
CEPHALOSPORINS_5TH,
|
||||
CEPHALOSPORINS_EXCEPT_CAZ,
|
||||
FLUOROQUINOLONES,
|
||||
LIPOGLYCOPEPTIDES,
|
||||
@ -163,6 +168,7 @@ usethis::use_data(eucast_rules_file,
|
||||
OXAZOLIDINONES,
|
||||
PENICILLINS,
|
||||
POLYMYXINS,
|
||||
QUINOLONES,
|
||||
STREPTOGRAMINS,
|
||||
TETRACYCLINES,
|
||||
TETRACYCLINES_EXCEPT_TGC,
|
||||
|
@ -1 +1 @@
|
||||
f6b4a2325c4bf3a8d4da337c8cfa07be
|
||||
3231895277e8e2b157672822c1913639
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -44,7 +44,7 @@
|
||||
"BCZ" 65807 "Bicyclomycin (Bicozamycin)" "Other antibacterials" "" "c(\"aizumycin\", \"bacfeed\", \"bacteron\", \"bicozamicina\", \"bicozamycin\", \"bicozamycine\", \"bicozamycinum\")" "character(0)"
|
||||
"BDP" "J01EA02" 68760 "Brodimoprim" "Trimethoprims" "Sulfonamides and trimethoprim" "Trimethoprim and derivatives" "" "c(\"brodimoprim\", \"brodimoprima\", \"brodimoprime\", \"brodimoprimum\", \"bromdimoprim\", \"hyprim\", \"unitrim\")" 0.2 "g" "character(0)"
|
||||
"BUT" 47472 "Butoconazole" "Antifungals/antimycotics" "" "c(\"butaconazole\", \"butoconazol\", \"butoconazole\", \"butoconazolum\", \"compositenstarke\", \"dahlin\", \"femstat\", \"gynofort\", \"polyfructosanum\")" "character(0)"
|
||||
"CDZ" "J01DD09" 44242317 "Cadazolid" "Cephalosporins (3rd gen.)" "Other beta-lactam antibacterials" "Third-generation cephalosporins" "" "cadazolid" 2 "g" "character(0)"
|
||||
"CDZ" 44242317 "Cadazolid" "Oxazolidinones" "" "cadazolid" "character(0)"
|
||||
"CLA" "J04AA03" "Calcium aminosalicylate" "Antimycobacterials" "Drugs for treatment of tuberculosis" "Aminosalicylic acid and derivatives" "" "" 15 ""
|
||||
"CAP" "J04AB30" 135565060 "Capreomycin" "Antimycobacterials" "Drugs for treatment of tuberculosis" "Antibiotics" "c(\"\", \"capr\")" "" 1 "g" ""
|
||||
"CRB" "J01CA03" 20824 "Carbenicillin" "Beta-lactams/penicillins" "Beta-lactam antibacterials, penicillins" "Penicillins with extended spectrum" "c(\"bar\", \"carb\", \"cb\")" "c(\"anabactyl\", \"carbenicilina\", \"carbenicillin\", \"carbenicillina\", \"carbenicilline\", \"carbenicillinum\", \"geopen\", \"pyopen\")" 12 "g" "3434-8"
|
||||
@ -108,8 +108,8 @@
|
||||
"CPT" "J01DI02" 56841980 "Ceftaroline" "Cephalosporins (5th gen.)" "c(\"\", \"cfro\")" "c(\"teflaro\", \"zinforo\")" 1.2 "character(0)"
|
||||
"CPA" "Ceftaroline/avibactam" "Cephalosporins (5th gen.)" "" "" ""
|
||||
"CAZ" "J01DD02" 5481173 "Ceftazidime" "Cephalosporins (3rd gen.)" "Other beta-lactam antibacterials" "Third-generation cephalosporins" "c(\"caz\", \"cefta\", \"cfta\", \"cftz\", \"taz\", \"tz\", \"xtz\")" "c(\"ceftazidim\", \"ceftazidima\", \"ceftazidime\", \"ceftazidimum\", \"ceptaz\", \"fortaz\", \"fortum\", \"pentacef\", \"tazicef\", \"tazidime\")" 4 "g" "c(\"21151-6\", \"3449-6\", \"80960-8\")"
|
||||
"CZA" "J01DD52" 90643431 "Ceftazidime/avibactam" "Cephalosporins (3rd gen.)" "Other beta-lactam antibacterials" "Third-generation cephalosporins" "c(\"\", \"cfav\")" "c(\"avycaz\", \"zavicefta\")" 6 "g" ""
|
||||
"CCV" "J01DD52" 9575352 "Ceftazidime/clavulanic acid" "Cephalosporins (3rd gen.)" "Other beta-lactam antibacterials" "Third-generation cephalosporins" "c(\"czcl\", \"xtzl\")" "" 6 ""
|
||||
"CZA" 90643431 "Ceftazidime/avibactam" "Cephalosporins (3rd gen.)" "c(\"\", \"cfav\")" "c(\"avycaz\", \"zavicefta\")" ""
|
||||
"CCV" "J01DD52" 9575352 "Ceftazidime/clavulanic acid" "Cephalosporins (3rd gen.)" "Other beta-lactam antibacterials" "Third-generation cephalosporins" "c(\"czcl\", \"xtzl\")" "" 6 "g" ""
|
||||
"CEM" 6537431 "Cefteram" "Cephalosporins (3rd gen.)" "" "c(\"cefteram\", \"cefterame\", \"cefteramum\", \"ceftetrame\")" "character(0)"
|
||||
"CPL" 5362114 "Cefteram pivoxil" "Cephalosporins (3rd gen.)" "" "c(\"cefteram pivoxil\", \"tomiron\")" "character(0)"
|
||||
"CTL" "J01DB12" 65755 "Ceftezole" "Cephalosporins (1st gen.)" "Other beta-lactam antibacterials" "First-generation cephalosporins" "" "c(\"ceftezol\", \"ceftezole\", \"ceftezolo\", \"ceftezolum\", \"demethylcefazolin\")" 3 "g" "character(0)"
|
||||
@ -117,9 +117,9 @@
|
||||
"TIO" 6328657 "Ceftiofur" "Cephalosporins (3rd gen.)" "" "c(\"ceftiofur\", \"ceftiofurum\", \"excede\", \"excenel\", \"naxcel\")" "character(0)"
|
||||
"CZX" "J01DD07" 6533629 "Ceftizoxime" "Cephalosporins (3rd gen.)" "Other beta-lactam antibacterials" "Third-generation cephalosporins" "c(\"cfzx\", \"ctz\", \"cz\", \"czx\", \"tiz\", \"zox\")" "c(\"cefizox\", \"ceftisomin\", \"ceftix\", \"ceftizoxima\", \"ceftizoxime\", \"ceftizoximum\", \"epocelin\", \"eposerin\")" 4 "g" "c(\"25243-7\", \"3450-4\")"
|
||||
"CZP" 9578661 "Ceftizoxime alapivoxil" "Cephalosporins (3rd gen.)" "" "" ""
|
||||
"BPR" "J01DI01" 135413542 "Ceftobiprole" "Cephalosporins (5th gen.)" "" "ceftobiprole" 1.5 "character(0)"
|
||||
"CFM1" "J01DI01" 135413544 "Ceftobiprole medocaril" "Cephalosporins (5th gen.)" "Other beta-lactam antibacterials" "Other cephalosporins" "" "" 1.5 ""
|
||||
"CEI" "J01DI54" "Ceftolozane/enzyme inhibitor" "Cephalosporins (5th gen.)" "Other beta-lactam antibacterials" "Other cephalosporins" "" "" 3 ""
|
||||
"BPR" 135413542 "Ceftobiprole" "Cephalosporins (5th gen.)" "" "ceftobiprole" "character(0)"
|
||||
"CFM1" "J01DI01" 135413544 "Ceftobiprole medocaril" "Cephalosporins (5th gen.)" "Other beta-lactam antibacterials" "Other cephalosporins and penems" "" "" 1.5 "g" ""
|
||||
"CEI" "J01DI54" "Ceftolozane/enzyme inhibitor" "Cephalosporins (5th gen.)" "Other beta-lactam antibacterials" "Other cephalosporins and penems" "" "" 3 ""
|
||||
"CZT" "Ceftolozane/tazobactam" "Cephalosporins (5th gen.)" "" "" ""
|
||||
"CRO" "J01DD04" 5479530 "Ceftriaxone" "Cephalosporins (3rd gen.)" "Other beta-lactam antibacterials" "Third-generation cephalosporins" "c(\"axo\", \"cax\", \"cftr\", \"cro\", \"ctr\", \"frx\", \"tx\")" "c(\"biotrakson\", \"cefatriaxone\", \"cefatriaxone hydrate\", \"ceftriaxon\", \"ceftriaxona\", \"ceftriaxone\", \"ceftriaxone sodium\", \"ceftriaxonum\", \"ceftriazone\", \"cephtriaxone\", \"longacef\", \"rocefin\", \"rocephalin\", \"rocephin\", \"rocephine\", \"rophex\")" 2 "g" "c(\"25244-5\", \"3451-2\", \"80957-4\")"
|
||||
"CXM" "J01DC02" 5479529 "Cefuroxime" "Cephalosporins (2nd gen.)" "Other beta-lactam antibacterials" "Second-generation cephalosporins" "c(\"cfrx\", \"cfur\", \"cfx\", \"crm\", \"cxm\", \"fur\", \"rox\", \"xm\")" "c(\"biofuroksym\", \"cefuril\", \"cefuroxim\", \"cefuroxime\", \"cefuroximine\", \"cefuroximo\", \"cefuroximum\", \"cephuroxime\", \"kefurox\", \"sharox\", \"zinacef\", \"zinacef danmark\")" 0.5 "g" 3 "g" "c(\"25245-2\", \"3452-0\", \"80608-3\", \"80617-4\")"
|
||||
@ -173,7 +173,7 @@
|
||||
"DIR" "J01FA13" 6473883 "Dirithromycin" "Macrolides/lincosamides" "Macrolides, lincosamides and streptogramins" "Macrolides" "" "c(\"dirithromycin\", \"dirithromycine\", \"dirithromycinum\", \"diritromicina\", \"divitross\", \"dynabac\", \"noriclan\", \"valodin\")" 0.5 "g" "character(0)"
|
||||
"DOR" "J01DH04" 73303 "Doripenem" "Carbapenems" "Other beta-lactam antibacterials" "Carbapenems" "dori" "c(\"doribax\", \"doripenem\", \"doripenem hydrate\", \"finibax\")" 1.5 "character(0)"
|
||||
"DOX" "J01AA02" 54671203 "Doxycycline" "Tetracyclines" "Tetracyclines" "Tetracyclines" "c(\"dox\", \"doxy\")" "c(\"atridox\", \"azudoxat\", \"deoxymykoin\", \"dossiciclina\", \"doxcycline anhydrous\", \"doxiciclina\", \"doxitard\", \"doxivetin\", \"doxycen\", \"doxychel\", \"doxycin\", \"doxycyclin\", \"doxycycline\", \"doxycycline calcium\", \"doxycycline hyclate\", \"doxycyclinum\", \"doxylin\", \"doxysol\", \"doxytec\", \"doxytetracycline\", \"hydramycin\", \"investin\", \"jenacyclin\", \"liviatin\", \"monodox\", \"oracea\", \"periostat\", \"ronaxan\", \"spanor\", \"supracyclin\", \"vibramycin\", \"vibramycin novum\", \"vibramycine\", \"vibravenos\", \"zenavod\")" 0.1 "g" 0.1 "g" "c(\"10986-8\", \"21250-6\", \"26902-7\")"
|
||||
"ECO" "J01XDXX" 3198 "Econazole" "Antifungals/antimycotics" "econ" "c(\"econazol\", \"econazole\", \"econazolum\", \"ecostatin\", \"ecostatin cream\", \"palavale\", \"pevaryl\", \"spectazole\", \"spectazole cream\")" "character(0)"
|
||||
"ECO" "D01AC03" 3198 "Econazole" "Antifungals/antimycotics" "Antifungals for topical use" "Imidazole and triazole derivatives" "econ" "c(\"econazol\", \"econazole\", \"econazolum\", \"ecostatin\", \"ecostatin cream\", \"palavale\", \"pevaryl\", \"spectazole\", \"spectazole cream\")" "character(0)"
|
||||
"ENX" "J01MA04" 3229 "Enoxacin" "Quinolones" "Quinolone antibacterials" "Fluoroquinolones" "c(\"\", \"enox\")" "c(\"almitil\", \"bactidan\", \"bactidron\", \"comprecin\", \"enofloxacine\", \"enoksetin\", \"enoram\", \"enoxacin\", \"enoxacina\", \"enoxacine\", \"enoxacino\", \"enoxacinum\", \"enoxen\", \"enoxin\", \"enoxor\", \"flumark\", \"penetrex\")" 0.8 "g" "c(\"16816-1\", \"3590-7\")"
|
||||
"ENR" 71188 "Enrofloxacin" "Quinolones" "" "c(\"baytril\", \"enrofloxacin\", \"enrofloxacine\", \"enrofloxacino\", \"enrofloxacinum\")" "character(0)"
|
||||
"ENV" 135565326 "Enviomycin (Tuberactinomycin)" "Antimycobacterials" "" "c(\"enviomicina\", \"enviomycin\", \"enviomycina\", \"enviomycinum\")" "character(0)"
|
||||
@ -190,7 +190,7 @@
|
||||
"ETI1" "J04AD03" 2761171 "Ethionamide" "Antimycobacterials" "Drugs for treatment of tuberculosis" "Thiocarbamide derivatives" "ethi" "c(\"aethionamidum\", \"aetina\", \"aetiva\", \"amidazin\", \"amidazine\", \"ethatyl\", \"ethimide\", \"ethina\", \"ethinamide\", \"ethionamide\", \"ethionamidum\", \"ethioniamide\", \"ethylisothiamide\", \"ethyonomide\", \"etimid\", \"etiocidan\", \"etionamid\", \"etionamida\", \"etionamide\", \"etioniamid\", \"etionid\", \"etionizin\", \"etionizina\", \"etionizine\", \"fatoliamid\", \"iridocin\", \"iridocin bayer\", \"iridozin\", \"isothin\", \"isotiamida\", \"itiocide\", \"nicotion\", \"nisotin\", \"nizotin\", \"rigenicid\", \"sertinon\", \"teberus\", \"thianid\", \"thianide\",
|
||||
\"thioamide\", \"thiodine\", \"thiomid\", \"thioniden\", \"tianid\", \"tiomid\", \"trecator\", \"trecator sc\", \"trekator\", \"trescatyl\", \"trescazide\", \"tubenamide\", \"tubermin\", \"tuberoid\", \"tuberoson\")" 0.75 "g" "16845-0"
|
||||
"ETO" 6034 "Ethopabate" "Other antibacterials" "" "c(\"amprol plus\", \"ethopabat\", \"ethopabate\", \"ethyl pabate\")" "character(0)"
|
||||
"FAR" "J01DI03" 65894 "Faropenem" "Other antibacterials" "" "c(\"faropenem\", \"faropenem sodium\", \"fropenem\", \"fropenum sodium\")" 0.75 "character(0)"
|
||||
"FAR" "J01DI03" 65894 "Faropenem" "Other antibacterials" "Other beta-lactam antibacterials" "Other cephalosporins and penems" "" "c(\"faropenem\", \"faropenem sodium\", \"fropenem\", \"fropenum sodium\")" 0.75 "g" "character(0)"
|
||||
"FDX" 10034073 "Fidaxomicin" "Other antibacterials" "" "c(\"dificid\", \"dificlir\", \"difimicin\", \"fidaxomicin\", \"lipiarmycin\", \"tiacumicin b\")" "character(0)"
|
||||
"FIN" 11567473 "Finafloxacin" "Quinolones" "" "finafloxacin" "character(0)"
|
||||
"FLA" 46783781 "Flavomycin" "Other antibacterials" "" "moenomycin complex" "character(0)"
|
||||
@ -309,7 +309,7 @@
|
||||
"NTR" "J01XX07" 19910 "Nitroxoline" "Quinolones" "Other antibacterials" "Other antibacterials" "" "c(\"galinok\", \"isinok\", \"nibiol\", \"nicene forte\", \"nitroxolin\", \"nitroxolina\", \"nitroxoline\", \"nitroxolinum\", \"notroxoline\", \"noxibiol\")" 1 "g" "character(0)"
|
||||
"NOR" "J01MA06" 4539 "Norfloxacin" "Quinolones" "Quinolone antibacterials" "Fluoroquinolones" "c(\"nor\", \"norf\", \"nx\", \"nxn\")" "c(\"baccidal\", \"barazan\", \"chibroxin\", \"chibroxine\", \"chibroxol\", \"fulgram\", \"gonorcin\", \"lexinor\", \"nolicin\", \"noracin\", \"noraxin\", \"norflo\", \"norfloxacin\", \"norfloxacine\", \"norfloxacino\", \"norfloxacinum\", \"norocin\", \"noroxin\", \"noroxine\", \"norxacin\", \"sebercim\", \"uroxacin\", \"utinor\", \"zoroxin\")" 0.8 "g" "3867-9"
|
||||
"NVA" 10419027 "Norvancomycin" "Glycopeptides" "" "norvancomycin" "character(0)"
|
||||
"NOV" "QJ01XX95" 54675769 "Novobiocin" "Other antibacterials" "novo" "c(\"albamix\", \"albamycin\", \"cardelmycin\", \"cathocin\", \"cathomycin\", \"crystallinic acid\", \"inamycin\", \"novobiocin\", \"novobiocina\", \"novobiocine\", \"novobiocinum\", \"robiocina\", \"sirbiocina\", \"spheromycin\", \"stilbiocina\", \"streptonivicin\")" "17378-1"
|
||||
"NOV" 54675769 "Novobiocin" "Other antibacterials" "novo" "c(\"albamix\", \"albamycin\", \"cardelmycin\", \"cathocin\", \"cathomycin\", \"crystallinic acid\", \"inamycin\", \"novobiocin\", \"novobiocina\", \"novobiocine\", \"novobiocinum\", \"robiocina\", \"sirbiocina\", \"spheromycin\", \"stilbiocina\", \"streptonivicin\")" "17378-1"
|
||||
"NYS" "G01AA01" 6433272 "Nystatin" "Antifungals/antimycotics" "nyst" "c(\"biofanal\", \"candex lotion\", \"comycin\", \"diastatin\", \"herniocid\", \"moronal\", \"myconystatin\", \"mycostatin\", \"mycostatin pastilles\", \"mykinac\", \"mykostatyna\", \"nilstat\", \"nistatin\", \"nistatina\", \"nyamyc\", \"nyotran\", \"nyotrantrade mark\", \"nystaform\", \"nystan\", \"nystatin\", \"nystatin a\", \"nystatin g\", \"nystatin lf\", \"nystatine\", \"nystatinum\", \"nystatyna\", \"nystavescent\", \"nystex\", \"nystop\", \"stamycin\", \"terrastatin\", \"zydin e\")" "character(0)"
|
||||
"OFX" "J01MA01" 4583 "Ofloxacin" "Quinolones" "Quinolone antibacterials" "Fluoroquinolones" "c(\"of\", \"ofl\", \"oflo\", \"ofx\")" "c(\"bactocin\", \"danoflox\", \"effexin\", \"exocin\", \"exocine\", \"flobacin\", \"flodemex\", \"flotavid\", \"flovid\", \"floxal\", \"floxil\", \"floxin\", \"floxin otic\", \"floxstat\", \"fugacin\", \"inoflox\", \"kinflocin\", \"kinoxacin\", \"levofloxacin hcl\", \"liflox\", \"loxinter\", \"marfloxacin\", \"medofloxine\", \"mergexin\", \"monoflocet\", \"novecin\", \"nufafloqo\", \"occidal\", \"ocuflox\", \"oflocee\", \"oflocet\", \"oflocin\", \"oflodal\", \"oflodex\", \"oflodura\", \"ofloxacin\", \"ofloxacin otic\", \"ofloxacina\", \"ofloxacine\", \"ofloxacino\", \"ofloxacinum\",
|
||||
\"ofloxin\", \"onexacin\", \"operan\", \"orocin\", \"otonil\", \"oxaldin\", \"pharflox\", \"praxin\", \"puiritol\", \"qinolon\", \"quinolon\", \"quotavil\", \"sinflo\", \"tabrin\", \"taravid\", \"tariflox\", \"tarivid\", \"telbit\", \"tructum\", \"uro tarivid\", \"viotisone\", \"visiren\", \"zanocin\")" 0.4 "g" 0.4 "g" "c(\"25264-3\", \"3877-8\")"
|
||||
@ -344,7 +344,7 @@
|
||||
"PIS" "Piperacillin/sulbactam" "Beta-lactams/penicillins" "" "" ""
|
||||
"TZP" "J01CR05" 461573 "Piperacillin/tazobactam" "Beta-lactams/penicillins" "Beta-lactam antibacterials, penicillins" "Combinations of penicillins, incl. beta-lactamase inhibitors" "c(\"p/t\", \"piptaz\", \"piptazo\", \"pit\", \"pita\", \"pt\", \"ptc\", \"ptz\", \"tzp\")" "c(\"\", \"tazocel\", \"tazocillin\", \"tazocin\", \"zosyn\")" 14 "g" "character(0)"
|
||||
"PRC" 71978 "Piridicillin" "Beta-lactams/penicillins" "" "piridicillin" "character(0)"
|
||||
"PRL" 157385 "Pirlimycin" "Other antibacterials" "" "c(\"pirlimycin\", \"pirlimycina\", \"pirlimycine\", \"pirlimycinum\", \"pirsue\")" "character(0)"
|
||||
"PRL" 157385 "Pirlimycin" "Macrolides/lincosamides" "" "c(\"pirlimycin\", \"pirlimycina\", \"pirlimycine\", \"pirlimycinum\", \"pirsue\")" "character(0)"
|
||||
"PIR" "J01MB03" 4855 "Piromidic acid" "Quinolones" "Quinolone antibacterials" "Other quinolones" "" "c(\"acide piromidique\", \"acido piromidico\", \"acidum piromidicum\", \"actrun c\", \"bactramyl\", \"enterol\", \"gastrurol\", \"panacid\", \"pirodal\", \"piromidic acid\", \"pyrido\", \"reelon\", \"septural\", \"urisept\", \"uropir\", \"zaomeal\")" 2 "g" "character(0)"
|
||||
"PVM" "J01CA02" 33478 "Pivampicillin" "Beta-lactams/penicillins" "Beta-lactam antibacterials, penicillins" "Penicillins with extended spectrum" "" "c(\"berocillin\", \"pivaloylampicillin\", \"pivampicilina\", \"pivampicillin\", \"pivampicilline\", \"pivampicillinum\", \"pondocillin\")" 1.05 "g" "character(0)"
|
||||
"PME" "J01CA08" 115163 "Pivmecillinam" "Beta-lactams/penicillins" "Beta-lactam antibacterials, penicillins" "Penicillins with extended spectrum" "" "c(\"amdinocillin pivoxil\", \"coactabs\", \"hydroxymethyl\", \"pivmecilinamo\", \"pivmecillinam\", \"pivmecillinam hcl\", \"pivmecillinamum\")" 0.6 "g" "character(0)"
|
||||
@ -368,7 +368,7 @@
|
||||
"RAC" 56052 "Ractopamine" "Other antibacterials" "" "c(\"ractopamina\", \"ractopamine\", \"ractopaminum\")" "character(0)"
|
||||
"RAM" 16132338 "Ramoplanin" "Glycopeptides" "" "ramoplanin" "character(0)"
|
||||
"RZM" 10993211 "Razupenem" "Carbapenems" "" "razupenem" "character(0)"
|
||||
"RTP" "A07AA11" 6918462 "Retapamulin" "Other antibacterials" "Intestinal antiinfectives" "Antibiotics" "" "c(\"altabax\", \"altargo\", \"retapamulin\")" 0.6 "g" "character(0)"
|
||||
"RTP" "D06AX13" 6918462 "Retapamulin" "Other antibacterials" "Antibiotics for topical use" "Other antibiotics for topical use" "" "c(\"altabax\", \"altargo\", \"retapamulin\")" "character(0)"
|
||||
"RBC" "J02AC05" 44631912 "Ribociclib" "Antifungals/antimycotics" "Antimycotics for systemic use" "Triazole derivatives" "ribo" "c(\"kisqali\", \"ribociclib\")" 0.2 0.2 "character(0)"
|
||||
"RST" "J01GB10" 33042 "Ribostamycin" "Aminoglycosides" "Aminoglycoside antibacterials" "Other aminoglycosides" "" "c(\"dekamycin iv\", \"hetangmycin\", \"ribastamin\", \"ribostamicina\", \"ribostamycin\", \"ribostamycine\", \"ribostamycinum\", \"vistamycin\", \"xylostatin\")" 1 "g" "character(0)"
|
||||
"RID1" 16659285 "Ridinilazole" "Other antibacterials" "" "ridinilazole" "character(0)"
|
||||
@ -500,7 +500,7 @@
|
||||
"TVA" "J01MA13" 62959 "Trovafloxacin" "Quinolones" "Quinolone antibacterials" "Fluoroquinolones" "c(\"\", \"trov\")" "c(\"trovafloxacin\", \"trovan\")" 0.2 "g" 0.2 "g" "character(0)"
|
||||
"TUL" 9832301 "Tulathromycin" "Macrolides/lincosamides" "" "c(\"draxxin\", \"tulathrmycin a\", \"tulathromycin\", \"tulathromycin a\")" "character(0)"
|
||||
"TYL" 5280440 "Tylosin" "Macrolides/lincosamides" "" "c(\"fradizine\", \"tilosina\", \"tylocine\", \"tylosin\", \"tylosin a\", \"tylosine\", \"tylosinum\")" "87587-2"
|
||||
"TYL1" "A07AA11" 6441094 "Tylvalosin" "Other antibacterials" "Intestinal antiinfectives" "Antibiotics" "" "" 0.6 "g" ""
|
||||
"TYL1" 6441094 "Tylvalosin" "Macrolides/lincosamides" "" "" ""
|
||||
"PRU1" 124225 "Ulifloxacin (Prulifloxacin)" "Other antibacterials" "" "ulifloxacin" "character(0)"
|
||||
"VAN" "J01XA01" 14969 "Vancomycin" "Glycopeptides" "Other antibacterials" "Glycopeptide antibacterials" "c(\"va\", \"van\", \"vanc\")" "c(\"vancocin\", \"vancocin hcl\", \"vancoled\", \"vancomicina\", \"vancomycin\", \"vancomycin hcl\", \"vancomycine\", \"vancomycinum\", \"vancor\", \"viomycin derivative\")" 2 "g" "c(\"13586-3\", \"13587-1\", \"20578-1\", \"31012-8\", \"39092-2\", \"39796-8\", \"39797-6\", \"4089-9\", \"4090-7\", \"4091-5\", \"4092-3\", \"50938-0\", \"59381-4\")"
|
||||
"VAM" "Vancomycin-macromethod" "Glycopeptides" "" "" ""
|
||||
|
Binary file not shown.
28
data-raw/exploratory_data_analysis_test.R
Normal file
28
data-raw/exploratory_data_analysis_test.R
Normal file
@ -0,0 +1,28 @@
|
||||
library(dplyr)
|
||||
example_isolates %>%
|
||||
select(mo, where(is.rsi)) %>%
|
||||
tidyr::pivot_longer(cols = where(is.rsi)) %>%
|
||||
# remove intrisic R
|
||||
filter(!paste(mo, name) %in% AMR:::INTRINSIC_R) %>%
|
||||
mutate(name = as.ab(name),
|
||||
value = ifelse(value == "R", 1, 0),
|
||||
class = ab_group(name)) %>%
|
||||
group_by(mo, class) %>%
|
||||
summarise(n = n(),
|
||||
res = mean(value, na.rm = TRUE)) %>%
|
||||
filter(n > 30, !is.na(res))
|
||||
|
||||
|
||||
|
||||
df <- example_isolates
|
||||
search_mo <- "B_ESCHR_COLI"
|
||||
intrinsic_res <- INTRINSIC_R[INTRINSIC_R %like% search_mo]
|
||||
intrinsic_res <- gsub(".* (.*)", "\\1", intrinsic_res)
|
||||
|
||||
x <- df %>%
|
||||
select(mo, where(is.rsi)) %>%
|
||||
filter(mo == search_mo) %>%
|
||||
# at least 30 results available
|
||||
select(function(x) sum(!is.na(x)) >= 30) %>%
|
||||
# remove intrisic R
|
||||
select(!matches(paste(intrinsic_res, collapse = "|")))
|
@ -647,6 +647,7 @@ antibiotics <- antibiotics %>%
|
||||
|
||||
|
||||
# update DDDs from WHOCC website
|
||||
# last time checked: 2021-06-23
|
||||
ddd_oral <- double(length = nrow(antibiotics))
|
||||
ddd_iv <- double(length = nrow(antibiotics))
|
||||
progress <- progress_ticker(nrow(antibiotics))
|
||||
@ -667,7 +668,7 @@ antibiotics$iv_ddd <- ddd_iv
|
||||
# set as data.frame again
|
||||
antibiotics <- as.data.frame(antibiotics, stringsAsFactors = FALSE)
|
||||
class(antibiotics$ab) <- c("ab", "character")
|
||||
antibiotics <- antibiotics %>% dplyr::arrange(name)
|
||||
antibiotics <- dplyr::arrange(antibiotics, name)
|
||||
|
||||
# make all abbreviations and synonyms lower case, unique and alphabetically sorted ----
|
||||
for (i in 1:nrow(antibiotics)) {
|
||||
@ -683,5 +684,5 @@ for (i in 1:nrow(antibiotics)) {
|
||||
|
||||
# REFER TO data-raw/loinc.R FOR ADDING LOINC CODES
|
||||
|
||||
usethis::use_data(antibiotics, overwrite = TRUE, version = 2)
|
||||
usethis::use_data(antibiotics, overwrite = TRUE, version = 2, compress = "xz")
|
||||
rm(antibiotics)
|
||||
|
@ -32,7 +32,7 @@ for (i in seq_len(nrow(antibiotics))) {
|
||||
}
|
||||
|
||||
int_resis <- eucast_rules(int_resis,
|
||||
eucast_rules_df = subset(AMR:::eucast_rules_file,
|
||||
eucast_rules_df = subset(AMR:::EUCAST_RULES_DF,
|
||||
is.na(have_these_values) & reference.version == 3.2),
|
||||
info = FALSE)
|
||||
|
||||
|
Binary file not shown.
@ -81,7 +81,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="https://msberends.github.io/AMR//index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9008</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -81,7 +81,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9008</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9008</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -187,12 +187,12 @@
|
||||
|
||||
|
||||
|
||||
</header><script src="datasets_files/header-attrs-2.8/header-attrs.js"></script><div class="row">
|
||||
</header><script src="datasets_files/header-attrs-2.7/header-attrs.js"></script><div class="row">
|
||||
<div class="col-md-9 contents">
|
||||
<div class="page-header toc-ignore">
|
||||
<h1 data-toc-skip>Data sets for download / own use</h1>
|
||||
|
||||
<h4 class="date">03 June 2021</h4>
|
||||
<h4 class="date">23 June 2021</h4>
|
||||
|
||||
<small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/master/vignettes/datasets.Rmd"><code>vignettes/datasets.Rmd</code></a></small>
|
||||
<div class="hidden name"><code>datasets.Rmd</code></div>
|
||||
@ -497,7 +497,7 @@ If you are reading this page from within R, please <a href="https://msberends.gi
|
||||
<a href="#antibiotic-agents" class="anchor"></a>Antibiotic agents</h2>
|
||||
<p>A data set with 456 rows and 14 columns, containing the following column names:<br><em>ab</em>, <em>atc</em>, <em>cid</em>, <em>name</em>, <em>group</em>, <em>atc_group1</em>, <em>atc_group2</em>, <em>abbreviations</em>, <em>synonyms</em>, <em>oral_ddd</em>, <em>oral_units</em>, <em>iv_ddd</em>, <em>iv_units</em> and <em>loinc</em>.</p>
|
||||
<p>This data set is in R available as <code>antibiotics</code>, after you load the <code>AMR</code> package.</p>
|
||||
<p>It was last updated on 4 May 2021 13:38:27 UTC. Find more info about the structure of this data set <a href="https://msberends.github.io/AMR/reference/antibiotics.html">here</a>.</p>
|
||||
<p>It was last updated on 23 June 2021 07:50:24 UTC. Find more info about the structure of this data set <a href="https://msberends.github.io/AMR/reference/antibiotics.html">here</a>.</p>
|
||||
<p><strong>Direct download links:</strong></p>
|
||||
<ul>
|
||||
<li>Download as <a href="https://github.com/msberends/AMR/raw/master/data-raw/../data-raw/antibiotics.rds">R file</a> (32 kB)<br>
|
||||
@ -508,7 +508,7 @@ If you are reading this page from within R, please <a href="https://msberends.gi
|
||||
</li>
|
||||
<li>Download as <a href="https://github.com/msberends/AMR/raw/master/data-raw/../data-raw/antibiotics.sas">SAS file</a> (1.8 MB)<br>
|
||||
</li>
|
||||
<li>Download as <a href="https://github.com/msberends/AMR/raw/master/data-raw/../data-raw/antibiotics.sav">SPSS file</a> (1.3 MB)<br>
|
||||
<li>Download as <a href="https://github.com/msberends/AMR/raw/master/data-raw/../data-raw/antibiotics.sav">SPSS file</a> (0.3 MB)<br>
|
||||
</li>
|
||||
<li>Download as <a href="https://github.com/msberends/AMR/raw/master/data-raw/../data-raw/antibiotics.dta">Stata file</a> (0.3 MB)</li>
|
||||
</ul>
|
||||
|
@ -81,7 +81,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9008</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -81,7 +81,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9008</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -42,7 +42,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9008</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -213,20 +213,16 @@
|
||||
<a href="#with-amr-for-r-theres-always-a-knowledgeable-microbiologist-by-your-side" class="anchor"></a>With <code>AMR</code> (for R), there’s always a knowledgeable microbiologist by your side!</h5>
|
||||
<div class="sourceCode" id="cb1"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R"><span class="co"># AMR works great with dplyr, but it's not required or neccesary</span>
|
||||
<span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va"><a href="https://msberends.github.io/AMR/">AMR</a></span><span class="op">)</span>
|
||||
<span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va"><a href="https://github.com/msberends/AMR">AMR</a></span><span class="op">)</span>
|
||||
<span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va"><a href="https://dplyr.tidyverse.org">dplyr</a></span><span class="op">)</span>
|
||||
|
||||
<span class="va">example_isolates</span> <span class="op">%>%</span>
|
||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span><span class="op">(</span>bacteria <span class="op">=</span> <span class="fu"><a href="reference/mo_property.html">mo_fullname</a></span><span class="op">(</span><span class="va">mo</span><span class="op">)</span><span class="op">)</span> <span class="op">%>%</span>
|
||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span><span class="op">(</span><span class="fu"><a href="reference/mo_property.html">mo_is_gram_negative</a></span><span class="op">(</span><span class="op">)</span>, <span class="fu"><a href="reference/mo_property.html">mo_is_intrinsic_resistant</a></span><span class="op">(</span>ab <span class="op">=</span> <span class="st">"cefotax"</span><span class="op">)</span><span class="op">)</span> <span class="op">%>%</span>
|
||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span><span class="op">(</span><span class="va">bacteria</span>, <span class="fu"><a href="reference/antibiotic_class_selectors.html">aminoglycosides</a></span><span class="op">(</span><span class="op">)</span>, <span class="fu"><a href="reference/antibiotic_class_selectors.html">carbapenems</a></span><span class="op">(</span><span class="op">)</span><span class="op">)</span>
|
||||
<span class="co">#> ℹ Using column 'mo' as input for `mo_is_gram_negative()`</span>
|
||||
<span class="co">#> ℹ Using column 'mo' as input for `mo_is_intrinsic_resistant()`</span>
|
||||
<span class="co">#> ℹ Determining intrinsic resistance based on 'EUCAST Expert Rules' and 'EUCAST Intrinsic</span>
|
||||
<span class="co">#> Resistance and Unusual Phenotypes' v3.2 (2020)</span>
|
||||
<span class="co">#> ℹ For `aminoglycosides()` using columns: 'AMK' (amikacin), 'GEN' (gentamicin), 'KAN'</span>
|
||||
<span class="co">#> (kanamycin) and 'TOB' (tobramycin)</span>
|
||||
<span class="co">#> ℹ For `carbapenems()` using columns: 'IPM' (imipenem) and 'MEM' (meropenem)</span></code></pre></div>
|
||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span><span class="op">(</span>bacteria <span class="op">=</span> <span class="fu"><a href="reference/mo_property.html">mo_fullname</a></span><span class="op">(</span><span class="op">)</span><span class="op">)</span> <span class="op">%>%</span>
|
||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span><span class="op">(</span><span class="fu"><a href="reference/mo_property.html">mo_is_gram_negative</a></span><span class="op">(</span><span class="op">)</span>,
|
||||
<span class="fu"><a href="reference/mo_property.html">mo_is_intrinsic_resistant</a></span><span class="op">(</span>ab <span class="op">=</span> <span class="st">"cefotax"</span><span class="op">)</span><span class="op">)</span> <span class="op">%>%</span>
|
||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span><span class="op">(</span><span class="va">bacteria</span>,
|
||||
<span class="fu"><a href="reference/antibiotic_class_selectors.html">aminoglycosides</a></span><span class="op">(</span><span class="op">)</span>,
|
||||
<span class="fu"><a href="reference/antibiotic_class_selectors.html">carbapenems</a></span><span class="op">(</span><span class="op">)</span><span class="op">)</span></code></pre></div>
|
||||
<p>With only having defined a row filter on Gram-negative bacteria with intrinsic resistance to cefotaxime (<code><a href="reference/mo_property.html">mo_is_gram_negative()</a></code> and <code><a href="reference/mo_property.html">mo_is_intrinsic_resistant()</a></code>) and a column selection on two antibiotic groups (<code><a href="reference/antibiotic_class_selectors.html">aminoglycosides()</a></code> and <code><a href="reference/antibiotic_class_selectors.html">carbapenems()</a></code>), the reference data about <a href="./reference/microorganisms.html">all microorganisms</a> and <a href="./reference/antibiotics.html">all antibiotics</a> in the <code>AMR</code> package make sure you get what you meant:</p>
|
||||
<table class="table">
|
||||
<thead><tr class="header">
|
||||
@ -386,7 +382,7 @@
|
||||
<div id="latest-development-version" class="section level4">
|
||||
<h4 class="hasAnchor">
|
||||
<a href="#latest-development-version" class="anchor"></a>Latest development version</h4>
|
||||
<p><img src="https://github.com/msberends/AMR/workflows/R-code-check/badge.svg?branch=master" alt="R-code-check"><img src="https://www.codefactor.io/repository/github/msberends/amr" alt="CodeFactor"><img src="https://codecov.io/gh/msberends/AMR?branch=master" alt="Codecov"></p>
|
||||
<p>[R-code-check][<a href="https://github.com/msberends/AMR/workflows/R-code-check/badge.svg?branch=master" class="uri">https://github.com/msberends/AMR/workflows/R-code-check/badge.svg?branch=master</a>](<a href="https://github.com/msberends/AMR/actions" class="uri">https://github.com/msberends/AMR/actions</a>) [CodeFactor][<a href="https://www.codefactor.io/repository/github/msberends/amr/badge" class="uri">https://www.codefactor.io/repository/github/msberends/amr/badge</a>](<a href="https://www.codefactor.io/repository/github/msberends/amr" class="uri">https://www.codefactor.io/repository/github/msberends/amr</a>) [Codecov][<a href="https://codecov.io/gh/msberends/AMR/branch/master/graph/badge.svg" class="uri">https://codecov.io/gh/msberends/AMR/branch/master/graph/badge.svg</a>](<a href="https://codecov.io/gh/msberends/AMR?branch=master" class="uri">https://codecov.io/gh/msberends/AMR?branch=master</a>)</p>
|
||||
<p>The latest and unpublished development version can be installed from GitHub in two ways:</p>
|
||||
<ol>
|
||||
<li>
|
||||
@ -400,7 +396,7 @@
|
||||
<div class="sourceCode" id="cb5"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R"><span class="fu"><a href="https://rdrr.io/r/base/options.html">options</a></span><span class="op">(</span>repos <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/options.html">getOption</a></span><span class="op">(</span><span class="st">"repos"</span><span class="op">)</span>,
|
||||
msberends <span class="op">=</span> <span class="st">"https://msberends.r-universe.dev"</span><span class="op">)</span><span class="op">)</span></code></pre></div>
|
||||
<p>After this, you can install and update this <code>AMR</code> package like any official release (using <code><a href="https://rdrr.io/r/utils/install.packages.html">install.packages("AMR")</a></code> or in RStudio via <em>Tools</em> > <em>Check of Package Updates…</em>).</p>
|
||||
<p>After this, you can install and update this <code>AMR</code> package like any official release (e.g., using <code><a href="https://rdrr.io/r/utils/install.packages.html">install.packages("AMR")</a></code> or in RStudio via <em>Tools</em> > <em>Check for Package Updates…</em>).</p>
|
||||
</li>
|
||||
</ol>
|
||||
<p>You can also download the latest build from our repository: <a href="https://github.com/msberends/AMR/raw/master/data-raw/AMR_latest.tar.gz" class="uri">https://github.com/msberends/AMR/raw/master/data-raw/AMR_latest.tar.gz</a></p>
|
||||
|
@ -81,7 +81,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9008</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -236,14 +236,46 @@
|
||||
<small>Source: <a href='https://github.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small>
|
||||
</div>
|
||||
|
||||
<div id="amr-1719008" class="section level1">
|
||||
<h1 class="page-header" data-toc-text="1.7.1.9008">
|
||||
<a href="#amr-1719008" class="anchor"></a><small> Unreleased </small><code>AMR</code> 1.7.1.9008</h1>
|
||||
<div id="last-updated-23-june-2021" class="section level2">
|
||||
<h2 class="hasAnchor">
|
||||
<a href="#last-updated-23-june-2021" class="anchor"></a><small>Last updated: 23 June 2021</small>
|
||||
</h2>
|
||||
<div id="changed" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
<a href="#changed" class="anchor"></a>Changed</h3>
|
||||
<ul>
|
||||
<li>Antibiotic class selectors (see <code><a href="../reference/antibiotic_class_selectors.html">ab_class()</a></code>)
|
||||
<ul>
|
||||
<li>They now finally also work in R-3.0 and R-3.1, supporting every version of R since 2013</li>
|
||||
<li>Added more selectors: <code><a href="../reference/antibiotic_class_selectors.html">aminopenicillins()</a></code>, <code><a href="../reference/antibiotic_class_selectors.html">lincosamides()</a></code>, <code><a href="../reference/antibiotic_class_selectors.html">lipoglycopeptides()</a></code>, <code><a href="../reference/antibiotic_class_selectors.html">polymyxins()</a></code>, <code><a href="../reference/antibiotic_class_selectors.html">quinolones()</a></code>, <code><a href="../reference/antibiotic_class_selectors.html">streptogramins()</a></code> and <code><a href="../reference/antibiotic_class_selectors.html">ureidopenicillins()</a></code>
|
||||
</li>
|
||||
<li>Fix for using selectors multiple times in one call (e.g., using them in <code><a href="https://dplyr.tidyverse.org/reference/filter.html">dplyr::filter()</a></code> and immediately after in <code><a href="https://dplyr.tidyverse.org/reference/select.html">dplyr::select()</a></code>)</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Fixed duplicate ATC codes in the <code>antibiotics</code> data set</li>
|
||||
<li>Added <code><a href="https://ggplot2.tidyverse.org/reference/autoplot.html">ggplot2::autoplot()</a></code> generic for classes <code><mic></code>, <code><disk></code>, <code><rsi></code> and <code><resistance_predict></code>
|
||||
</li>
|
||||
<li>Fix to prevent introducing <code>NA</code>s for old MO codes when running <code><a href="../reference/as.mo.html">as.mo()</a></code> on them</li>
|
||||
<li>Added more informative error messages when any of the <code>proportion_*()</code> and <code>count_*()</code> functions fail</li>
|
||||
<li>When printing a tibble with any old MO code, a warning will be thrown that old codes should be updated using <code><a href="../reference/as.mo.html">as.mo()</a></code>
|
||||
</li>
|
||||
<li>Improved automatic column selector when <code>col_*</code> arguments are left blank, e.g. in <code><a href="../reference/first_isolate.html">first_isolate()</a></code>
|
||||
</li>
|
||||
<li>The right input types for <code><a href="../reference/random.html">random_mic()</a></code>, <code><a href="../reference/random.html">random_disk()</a></code> and <code><a href="../reference/random.html">random_rsi()</a></code> are now enforced</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="amr-171" class="section level1">
|
||||
<h1 class="page-header" data-toc-text="1.7.1">
|
||||
<a href="#amr-171" class="anchor"></a><small> Unreleased </small><code>AMR</code> 1.7.1</h1>
|
||||
<a href="#amr-171" class="anchor"></a><small> 2021-06-03 </small><code>AMR</code> 1.7.1</h1>
|
||||
<div id="breaking-change" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
<a href="#breaking-change" class="anchor"></a>Breaking change</h3>
|
||||
<ul>
|
||||
<li><p>Support for CLSI 2020 guideline for interpreting MICs and disk diffusion values (using <code><a href="../reference/as.rsi.html">as.rsi()</a></code>)</p></li>
|
||||
<li>
|
||||
<p>All antibiotic class selectors (such as <code><a href="../reference/antibiotic_class_selectors.html">carbapenems()</a></code>, <code><a href="../reference/antibiotic_class_selectors.html">aminoglycosides()</a></code>) can now be used for filtering as well, making all their accompanying <code>filter_*()</code> functions redundant (such as <code><a href="../reference/AMR-deprecated.html">filter_carbapenems()</a></code>, <code><a href="../reference/AMR-deprecated.html">filter_aminoglycosides()</a></code>). These functions are now deprecated and will be removed in a next release. Examples of how the selectors can be used for filtering:</p>
|
||||
<div class="sourceCode" id="cb1"><pre class="downlit sourceCode r">
|
||||
@ -269,6 +301,7 @@
|
||||
<h3 class="hasAnchor">
|
||||
<a href="#new" class="anchor"></a>New</h3>
|
||||
<ul>
|
||||
<li>Support for CLSI 2020 guideline for interpreting MICs and disk diffusion values (using <code><a href="../reference/as.rsi.html">as.rsi()</a></code>)</li>
|
||||
<li>Function <code><a href="../reference/custom_eucast_rules.html">custom_eucast_rules()</a></code> that brings support for custom AMR rules in <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code>
|
||||
</li>
|
||||
<li>Function <code><a href="../reference/italicise_taxonomy.html">italicise_taxonomy()</a></code> to make taxonomic names within a string italic, with support for markdown and ANSI</li>
|
||||
@ -289,9 +322,9 @@
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="changed" class="section level3">
|
||||
<div id="changed-1" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
<a href="#changed" class="anchor"></a>Changed</h3>
|
||||
<a href="#changed-1" class="anchor"></a>Changed</h3>
|
||||
<ul>
|
||||
<li>
|
||||
<code><a href="../reference/bug_drug_combinations.html">bug_drug_combinations()</a></code> now supports grouping using the <code>dplyr</code> package</li>
|
||||
@ -427,9 +460,9 @@
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="changed-1" class="section level3">
|
||||
<div id="changed-2" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
<a href="#changed-1" class="anchor"></a>Changed</h3>
|
||||
<a href="#changed-2" class="anchor"></a>Changed</h3>
|
||||
<ul>
|
||||
<li>Updated the bacterial taxonomy to 3 March 2021 (using <a href="https://lpsn.dsmz.de">LPSN</a>)
|
||||
<ul>
|
||||
@ -481,7 +514,7 @@
|
||||
<a href="#other-1" class="anchor"></a>Other</h3>
|
||||
<ul>
|
||||
<li>Big documentation updates</li>
|
||||
<li>Loading the package (i.e., <code><a href="https://msberends.github.io/AMR/">library(AMR)</a></code>) now is ~50 times faster than before, in costs of package size (which increased by ~3 MB)</li>
|
||||
<li>Loading the package (i.e., <code><a href="https://github.com/msberends/AMR">library(AMR)</a></code>) now is ~50 times faster than before, in costs of package size (which increased by ~3 MB)</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@ -506,9 +539,9 @@
|
||||
<li><p>Functions <code><a href="../reference/random.html">random_mic()</a></code>, <code><a href="../reference/random.html">random_disk()</a></code> and <code><a href="../reference/random.html">random_rsi()</a></code> for random value generation. The functions <code><a href="../reference/random.html">random_mic()</a></code> and <code><a href="../reference/random.html">random_disk()</a></code> take microorganism names and antibiotic names as input to make generation more realistic.</p></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="changed-2" class="section level3">
|
||||
<div id="changed-3" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
<a href="#changed-2" class="anchor"></a>Changed</h3>
|
||||
<a href="#changed-3" class="anchor"></a>Changed</h3>
|
||||
<ul>
|
||||
<li><p>New argument <code>ampc_cephalosporin_resistance</code> in <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code> to correct for AmpC de-repressed cephalosporin-resistant mutants</p></li>
|
||||
<li>
|
||||
@ -612,7 +645,7 @@
|
||||
<p>Curious about which enterococci are actually intrinsic resistant to vancomycin?</p>
|
||||
<div class="sourceCode" id="cb10"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va"><a href="https://msberends.github.io/AMR/">AMR</a></span><span class="op">)</span>
|
||||
<span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va"><a href="https://github.com/msberends/AMR">AMR</a></span><span class="op">)</span>
|
||||
<span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va"><a href="https://dplyr.tidyverse.org">dplyr</a></span><span class="op">)</span>
|
||||
<span class="va">intrinsic_resistant</span> <span class="op">%>%</span>
|
||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span><span class="op">(</span><span class="va">antibiotic</span> <span class="op">==</span> <span class="st">"Vancomycin"</span>, <span class="va">microorganism</span> <span class="op">%like%</span> <span class="st">"Enterococcus"</span><span class="op">)</span> <span class="op">%>%</span>
|
||||
@ -623,9 +656,9 @@
|
||||
<li><p>Support for skimming classes <code><rsi></code>, <code><mic></code>, <code><disk></code> and <code><mo></code> with the <code>skimr</code> package</p></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="changed-3" class="section level3">
|
||||
<div id="changed-4" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
<a href="#changed-3" class="anchor"></a>Changed</h3>
|
||||
<a href="#changed-4" class="anchor"></a>Changed</h3>
|
||||
<ul>
|
||||
<li><p>Although advertised that this package should work under R 3.0.0, we still had a dependency on R 3.6.0. This is fixed, meaning that our package should now work under R 3.0.0.</p></li>
|
||||
<li>
|
||||
@ -728,9 +761,9 @@
|
||||
<li><p>Added argument <code>conserve_capped_values</code> to <code><a href="../reference/as.rsi.html">as.rsi()</a></code> for interpreting MIC values - it makes sure that values starting with “<” (but not “<=”) will always return “S” and values starting with “>” (but not “>=”) will always return “R”. The default behaviour of <code><a href="../reference/as.rsi.html">as.rsi()</a></code> has not changed, so you need to specifically do <code><a href="../reference/as.rsi.html">as.rsi(..., conserve_capped_values = TRUE)</a></code>.</p></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="changed-4" class="section level3">
|
||||
<div id="changed-5" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
<a href="#changed-4" class="anchor"></a>Changed</h3>
|
||||
<a href="#changed-5" class="anchor"></a>Changed</h3>
|
||||
<ul>
|
||||
<li>
|
||||
<p>Big speed improvement for using any function on microorganism codes from earlier package versions (prior to <code>AMR</code> v1.2.0), such as <code><a href="../reference/as.mo.html">as.mo()</a></code>, <code><a href="../reference/mo_property.html">mo_name()</a></code>, <code><a href="../reference/first_isolate.html">first_isolate()</a></code>, <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code>, <code><a href="../reference/mdro.html">mdro()</a></code>, etc.</p>
|
||||
@ -803,9 +836,9 @@
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="changed-5" class="section level3">
|
||||
<div id="changed-6" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
<a href="#changed-5" class="anchor"></a>Changed</h3>
|
||||
<a href="#changed-6" class="anchor"></a>Changed</h3>
|
||||
<ul>
|
||||
<li>Taxonomy:
|
||||
<ul>
|
||||
@ -857,9 +890,9 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<li>Plotting biplots for principal component analysis using the new <code><a href="../reference/ggplot_pca.html">ggplot_pca()</a></code> function</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="changed-6" class="section level3">
|
||||
<div id="changed-7" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
<a href="#changed-6" class="anchor"></a>Changed</h3>
|
||||
<a href="#changed-7" class="anchor"></a>Changed</h3>
|
||||
<ul>
|
||||
<li>Improvements for the algorithm used by <code><a href="../reference/as.mo.html">as.mo()</a></code> (and consequently all <code>mo_*</code> functions, that use <code><a href="../reference/as.mo.html">as.mo()</a></code> internally):
|
||||
<ul>
|
||||
@ -890,9 +923,9 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<div id="amr-101" class="section level1">
|
||||
<h1 class="page-header" data-toc-text="1.0.1">
|
||||
<a href="#amr-101" class="anchor"></a><small> 2020-02-23 </small><code>AMR</code> 1.0.1</h1>
|
||||
<div id="changed-7" class="section level3">
|
||||
<div id="changed-8" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
<a href="#changed-7" class="anchor"></a>Changed</h3>
|
||||
<a href="#changed-8" class="anchor"></a>Changed</h3>
|
||||
<ul>
|
||||
<li><p>Fixed important floating point error for some MIC comparisons in EUCAST 2020 guideline</p></li>
|
||||
<li>
|
||||
@ -1198,9 +1231,9 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="changed-8" class="section level3">
|
||||
<div id="changed-9" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
<a href="#changed-8" class="anchor"></a>Changed</h3>
|
||||
<a href="#changed-9" class="anchor"></a>Changed</h3>
|
||||
<ul>
|
||||
<li>Many algorithm improvements for <code><a href="../reference/as.mo.html">as.mo()</a></code> (of which some led to additions to the <code>microorganisms</code> data set). Many thanks to all contributors that helped improving the algorithms.
|
||||
<ul>
|
||||
@ -1310,9 +1343,9 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<li><p>Function <code><a href="../reference/mo_property.html">mo_synonyms()</a></code> to get all previously accepted taxonomic names of a microorganism</p></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="changed-9" class="section level4">
|
||||
<div id="changed-10" class="section level4">
|
||||
<h4 class="hasAnchor">
|
||||
<a href="#changed-9" class="anchor"></a>Changed</h4>
|
||||
<a href="#changed-10" class="anchor"></a>Changed</h4>
|
||||
<ul>
|
||||
<li>Column names of output <code><a href="../reference/count.html">count_df()</a></code> and <code>portion_df()</code> are now lowercase</li>
|
||||
<li>Fixed bug in translation of microorganism names</li>
|
||||
@ -1358,9 +1391,9 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<li>Added guidelines of the WHO to determine multi-drug resistance (MDR) for TB (<code><a href="../reference/mdro.html">mdr_tb()</a></code>) and added a new vignette about MDR. Read this tutorial <a href="https://msberends.gitlab.io/AMR/articles/MDR.html">here on our website</a>.</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="changed-10" class="section level4">
|
||||
<div id="changed-11" class="section level4">
|
||||
<h4 class="hasAnchor">
|
||||
<a href="#changed-10" class="anchor"></a>Changed</h4>
|
||||
<a href="#changed-11" class="anchor"></a>Changed</h4>
|
||||
<ul>
|
||||
<li>Fixed a critical bug in <code><a href="../reference/first_isolate.html">first_isolate()</a></code> where missing species would lead to incorrect FALSEs. This bug was not present in AMR v0.5.0, but was in v0.6.0 and v0.6.1.</li>
|
||||
<li>Fixed a bug in <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code> where antibiotics from WHONET software would not be recognised</li>
|
||||
@ -1444,9 +1477,9 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<div id="amr-061" class="section level1">
|
||||
<h1 class="page-header" data-toc-text="0.6.1">
|
||||
<a href="#amr-061" class="anchor"></a><small> 2019-03-29 </small><code>AMR</code> 0.6.1</h1>
|
||||
<div id="changed-11" class="section level4">
|
||||
<div id="changed-12" class="section level4">
|
||||
<h4 class="hasAnchor">
|
||||
<a href="#changed-11" class="anchor"></a>Changed</h4>
|
||||
<a href="#changed-12" class="anchor"></a>Changed</h4>
|
||||
<ul>
|
||||
<li>Fixed a critical bug when using <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code> with <code>verbose = TRUE</code>
|
||||
</li>
|
||||
@ -1563,9 +1596,9 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<li><p>New vignettes about how to conduct AMR analysis, predict antimicrobial resistance, use the <em>G</em>-test and more. These are also available (and even easier readable) on our website: <a href="https://msberends.gitlab.io/AMR" class="uri">https://msberends.gitlab.io/AMR</a>.</p></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="changed-12" class="section level4">
|
||||
<div id="changed-13" class="section level4">
|
||||
<h4 class="hasAnchor">
|
||||
<a href="#changed-12" class="anchor"></a>Changed</h4>
|
||||
<a href="#changed-13" class="anchor"></a>Changed</h4>
|
||||
<ul>
|
||||
<li>Function <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code>:
|
||||
<ul>
|
||||
@ -1721,9 +1754,9 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<li>Functions <code>mo_authors</code> and <code>mo_year</code> to get specific values about the scientific reference of a taxonomic entry</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="changed-13" class="section level4">
|
||||
<div id="changed-14" class="section level4">
|
||||
<h4 class="hasAnchor">
|
||||
<a href="#changed-13" class="anchor"></a>Changed</h4>
|
||||
<a href="#changed-14" class="anchor"></a>Changed</h4>
|
||||
<ul>
|
||||
<li><p>Functions <code>MDRO</code>, <code>BRMO</code>, <code>MRGN</code> and <code>EUCAST_exceptional_phenotypes</code> were renamed to <code>mdro</code>, <code>brmo</code>, <code>mrgn</code> and <code>eucast_exceptional_phenotypes</code></p></li>
|
||||
<li><p><code>EUCAST_rules</code> was renamed to <code>eucast_rules</code>, the old function still exists as a deprecated function</p></li>
|
||||
@ -1911,9 +1944,9 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<li><p>Renamed <code>septic_patients$sex</code> to <code>septic_patients$gender</code></p></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="changed-14" class="section level4">
|
||||
<div id="changed-15" class="section level4">
|
||||
<h4 class="hasAnchor">
|
||||
<a href="#changed-14" class="anchor"></a>Changed</h4>
|
||||
<a href="#changed-15" class="anchor"></a>Changed</h4>
|
||||
<ul>
|
||||
<li><p>Added three antimicrobial agents to the <code>antibiotics</code> data set: Terbinafine (D01BA02), Rifaximin (A07AA11) and Isoconazole (D01AC05)</p></li>
|
||||
<li>
|
||||
@ -2052,9 +2085,9 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="changed-15" class="section level4">
|
||||
<div id="changed-16" class="section level4">
|
||||
<h4 class="hasAnchor">
|
||||
<a href="#changed-15" class="anchor"></a>Changed</h4>
|
||||
<a href="#changed-16" class="anchor"></a>Changed</h4>
|
||||
<ul>
|
||||
<li>Improvements for forecasting with <code>resistance_predict</code> and added more examples</li>
|
||||
<li>More antibiotics added as arguments for EUCAST rules</li>
|
||||
@ -2137,9 +2170,9 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<li>New print format for <code>tibble</code>s and <code>data.table</code>s</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="changed-16" class="section level4">
|
||||
<div id="changed-17" class="section level4">
|
||||
<h4 class="hasAnchor">
|
||||
<a href="#changed-16" class="anchor"></a>Changed</h4>
|
||||
<a href="#changed-17" class="anchor"></a>Changed</h4>
|
||||
<ul>
|
||||
<li>Fixed <code>rsi</code> class for vectors that contain only invalid antimicrobial interpretations</li>
|
||||
<li>Renamed dataset <code>ablist</code> to <code>antibiotics</code>
|
||||
|
@ -12,7 +12,7 @@ articles:
|
||||
datasets: datasets.html
|
||||
resistance_predict: resistance_predict.html
|
||||
welcome_to_AMR: welcome_to_AMR.html
|
||||
last_built: 2021-06-03T13:04Z
|
||||
last_built: 2021-06-23T08:16Z
|
||||
urls:
|
||||
reference: https://msberends.github.io/AMR//reference
|
||||
article: https://msberends.github.io/AMR//articles
|
||||
|
@ -82,7 +82,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9002</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -286,7 +286,7 @@
|
||||
<p>Matthijs S. Berends <br />
|
||||
m.s.berends [at] umcg [dot] nl <br />
|
||||
University of Groningen
|
||||
Department of Medical Microbiology and Infection Prevention
|
||||
Department of Medical Microbiology and Infection Prevention <br />
|
||||
University Medical Center Groningen <br />
|
||||
Post Office Box 30001 <br />
|
||||
9700 RB Groningen <br />
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -83,7 +83,7 @@ count_resistant() should be used to count resistant isolates, count_susceptible(
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9005</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -410,6 +410,12 @@ A microorganism is categorised as <em>Susceptible, Increased exposure</em> when
|
||||
n2 <span class='op'>=</span> <span class='fu'>n_rsi</span><span class='op'>(</span><span class='va'>CIP</span><span class='op'>)</span>, <span class='co'># same - analogous to n_distinct</span>
|
||||
total <span class='op'>=</span> <span class='fu'><a href='https://dplyr.tidyverse.org/reference/context.html'>n</a></span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span> <span class='co'># NOT the number of tested isolates!</span>
|
||||
|
||||
<span class='co'># Number of available isolates for a whole antibiotic class</span>
|
||||
<span class='co'># (i.e., in this data set columns GEN, TOB, AMK, KAN)</span>
|
||||
<span class='va'>example_isolates</span> <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span><span class='op'>(</span><span class='va'>hospital_id</span><span class='op'>)</span> <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/summarise.html'>summarise</a></span><span class='op'>(</span><span class='fu'><a href='https://dplyr.tidyverse.org/reference/across.html'>across</a></span><span class='op'>(</span><span class='fu'><a href='antibiotic_class_selectors.html'>aminoglycosides</a></span><span class='op'>(</span><span class='op'>)</span>, <span class='va'>n_rsi</span><span class='op'>)</span><span class='op'>)</span>
|
||||
|
||||
<span class='co'># Count co-resistance between amoxicillin/clav acid and gentamicin,</span>
|
||||
<span class='co'># so we can see that combination therapy does a lot more than mono therapy.</span>
|
||||
<span class='co'># Please mind that `susceptibility()` calculates percentages right away instead.</span>
|
||||
|
@ -82,7 +82,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9007</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -315,25 +315,28 @@
|
||||
<p>It is possible to define antibiotic groups instead of single antibiotics for the rule consequence, the part <em>after</em> the tilde. In above examples, the antibiotic group <code>aminopenicillins</code> is used to include ampicillin and amoxicillin. The following groups are allowed (case-insensitive). Within parentheses are the antibiotic agents that will be matched when running the rule.</p><ul>
|
||||
<li><p><code>aminoglycosides</code><br />(amikacin, amikacin/fosfomycin, amphotericin B-high, apramycin, arbekacin, astromicin, bekanamycin, dibekacin, framycetin, gentamicin, gentamicin-high, habekacin, hygromycin, isepamicin, kanamycin, kanamycin-high, kanamycin/cephalexin, micronomicin, neomycin, netilmicin, pentisomicin, plazomicin, propikacin, ribostamycin, sisomicin, streptoduocin, streptomycin, streptomycin-high, tobramycin, tobramycin-high)</p></li>
|
||||
<li><p><code>aminopenicillins</code><br />(amoxicillin, ampicillin)</p></li>
|
||||
<li><p><code>betalactams</code><br />(amoxicillin, amoxicillin/clavulanic acid, amoxicillin/sulbactam, ampicillin, ampicillin/sulbactam, apalcillin, aspoxicillin, avibactam, azidocillin, azlocillin, aztreonam, aztreonam/avibactam, bacampicillin, benzathine benzylpenicillin, benzathine phenoxymethylpenicillin, benzylpenicillin, biapenem, cadazolid, carbenicillin, carindacillin, cefacetrile, cefaclor, cefadroxil, cefaloridine, cefamandole, cefatrizine, cefazedone, cefazolin, cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime, cefepime/clavulanic acid, cefepime/tazobactam, cefetamet, cefetamet pivoxil, cefetecol (Cefcatacol), cefetrizole, cefixime, cefmenoxime, cefmetazole, cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam, ceforanide, cefoselis, cefotaxime, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam, cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening, cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil, cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline, ceftaroline/avibactam, ceftazidime, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftobiprole, ceftobiprole medocaril, ceftolozane/enzyme inhibitor, ceftolozane/tazobactam, ceftriaxone, cefuroxime, cefuroxime axetil, cephalexin, cephalothin, cephapirin, cephradine, ciclacillin, clometocillin, cloxacillin, dicloxacillin, doripenem, epicillin, ertapenem, flucloxacillin, hetacillin, imipenem, imipenem/EDTA, imipenem/relebactam, latamoxef, lenampicillin, loracarbef, mecillinam (Amdinocillin), meropenem, meropenem/nacubactam, meropenem/vaborbactam, metampicillin, methicillin, mezlocillin, mezlocillin/sulbactam, nacubactam, nafcillin, oxacillin, panipenem, penamecillin, penicillin/novobiocin, penicillin/sulbactam, phenethicillin, phenoxymethylpenicillin, piperacillin, piperacillin/sulbactam, piperacillin/tazobactam, piridicillin, pivampicillin, pivmecillinam, procaine benzylpenicillin, propicillin, razupenem, ritipenem, ritipenem acoxil, sarmoxicillin, sulbactam, sulbenicillin, sultamicillin, talampicillin, tazobactam, tebipenem, temocillin, ticarcillin, ticarcillin/clavulanic acid)</p></li>
|
||||
<li><p><code>betalactams</code><br />(amoxicillin, amoxicillin/clavulanic acid, amoxicillin/sulbactam, ampicillin, ampicillin/sulbactam, apalcillin, aspoxicillin, avibactam, azidocillin, azlocillin, aztreonam, aztreonam/avibactam, bacampicillin, benzathine benzylpenicillin, benzathine phenoxymethylpenicillin, benzylpenicillin, biapenem, carbenicillin, carindacillin, cefacetrile, cefaclor, cefadroxil, cefaloridine, cefamandole, cefatrizine, cefazedone, cefazolin, cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime, cefepime/clavulanic acid, cefepime/tazobactam, cefetamet, cefetamet pivoxil, cefetecol (Cefcatacol), cefetrizole, cefixime, cefmenoxime, cefmetazole, cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam, ceforanide, cefoselis, cefotaxime, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam, cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening, cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil, cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline, ceftaroline/avibactam, ceftazidime, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftobiprole, ceftobiprole medocaril, ceftolozane/enzyme inhibitor, ceftolozane/tazobactam, ceftriaxone, cefuroxime, cefuroxime axetil, cephalexin, cephalothin, cephapirin, cephradine, ciclacillin, clometocillin, cloxacillin, dicloxacillin, doripenem, epicillin, ertapenem, flucloxacillin, hetacillin, imipenem, imipenem/EDTA, imipenem/relebactam, latamoxef, lenampicillin, loracarbef, mecillinam (Amdinocillin), meropenem, meropenem/nacubactam, meropenem/vaborbactam, metampicillin, methicillin, mezlocillin, mezlocillin/sulbactam, nacubactam, nafcillin, oxacillin, panipenem, penamecillin, penicillin/novobiocin, penicillin/sulbactam, phenethicillin, phenoxymethylpenicillin, piperacillin, piperacillin/sulbactam, piperacillin/tazobactam, piridicillin, pivampicillin, pivmecillinam, procaine benzylpenicillin, propicillin, razupenem, ritipenem, ritipenem acoxil, sarmoxicillin, sulbactam, sulbenicillin, sultamicillin, talampicillin, tazobactam, tebipenem, temocillin, ticarcillin, ticarcillin/clavulanic acid)</p></li>
|
||||
<li><p><code>carbapenems</code><br />(biapenem, doripenem, ertapenem, imipenem, imipenem/EDTA, imipenem/relebactam, meropenem, meropenem/nacubactam, meropenem/vaborbactam, panipenem, razupenem, ritipenem, ritipenem acoxil, tebipenem)</p></li>
|
||||
<li><p><code>cephalosporins</code><br />(cadazolid, cefacetrile, cefaclor, cefadroxil, cefaloridine, cefamandole, cefatrizine, cefazedone, cefazolin, cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime, cefepime/clavulanic acid, cefepime/tazobactam, cefetamet, cefetamet pivoxil, cefetecol (Cefcatacol), cefetrizole, cefixime, cefmenoxime, cefmetazole, cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam, ceforanide, cefoselis, cefotaxime, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam, cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening, cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil, cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline, ceftaroline/avibactam, ceftazidime, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftobiprole, ceftobiprole medocaril, ceftolozane/enzyme inhibitor, ceftolozane/tazobactam, ceftriaxone, cefuroxime, cefuroxime axetil, cephalexin, cephalothin, cephapirin, cephradine, latamoxef, loracarbef)</p></li>
|
||||
<li><p><code>cephalosporins</code><br />(cefacetrile, cefaclor, cefadroxil, cefaloridine, cefamandole, cefatrizine, cefazedone, cefazolin, cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime, cefepime/clavulanic acid, cefepime/tazobactam, cefetamet, cefetamet pivoxil, cefetecol (Cefcatacol), cefetrizole, cefixime, cefmenoxime, cefmetazole, cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam, ceforanide, cefoselis, cefotaxime, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam, cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening, cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil, cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline, ceftaroline/avibactam, ceftazidime, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftobiprole, ceftobiprole medocaril, ceftolozane/enzyme inhibitor, ceftolozane/tazobactam, ceftriaxone, cefuroxime, cefuroxime axetil, cephalexin, cephalothin, cephapirin, cephradine, latamoxef, loracarbef)</p></li>
|
||||
<li><p><code>cephalosporins_1st</code><br />(cefacetrile, cefadroxil, cefaloridine, cefatrizine, cefazedone, cefazolin, cefroxadine, ceftezole, cephalexin, cephalothin, cephapirin, cephradine)</p></li>
|
||||
<li><p><code>cephalosporins_2nd</code><br />(cefaclor, cefamandole, cefmetazole, cefonicid, ceforanide, cefotetan, cefotiam, cefoxitin, cefoxitin screening, cefprozil, cefuroxime, cefuroxime axetil, loracarbef)</p></li>
|
||||
<li><p><code>cephalosporins_3rd</code><br />(cadazolid, cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefetamet, cefetamet pivoxil, cefixime, cefmenoxime, cefodizime, cefoperazone, cefoperazone/sulbactam, cefotaxime, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotiam hexetil, cefovecin, cefpimizole, cefpiramide, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefsulodin, ceftazidime, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftriaxone, latamoxef)</p></li>
|
||||
<li><p><code>cephalosporins_except_caz</code><br />(cadazolid, cefacetrile, cefaclor, cefadroxil, cefaloridine, cefamandole, cefatrizine, cefazedone, cefazolin, cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime, cefepime/clavulanic acid, cefepime/tazobactam, cefetamet, cefetamet pivoxil, cefetecol (Cefcatacol), cefetrizole, cefixime, cefmenoxime, cefmetazole, cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam, ceforanide, cefoselis, cefotaxime, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam, cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening, cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil, cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline, ceftaroline/avibactam, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftobiprole, ceftobiprole medocaril, ceftolozane/enzyme inhibitor, ceftolozane/tazobactam, ceftriaxone, cefuroxime, cefuroxime axetil, cephalexin, cephalothin, cephapirin, cephradine, latamoxef, loracarbef)</p></li>
|
||||
<li><p><code>fluoroquinolones</code><br />(ciprofloxacin, enoxacin, fleroxacin, gatifloxacin, gemifloxacin, grepafloxacin, levofloxacin, lomefloxacin, moxifloxacin, norfloxacin, ofloxacin, pazufloxacin, pefloxacin, prulifloxacin, rufloxacin, sparfloxacin, temafloxacin, trovafloxacin)</p></li>
|
||||
<li><p><code>cephalosporins_3rd</code><br />(cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefetamet, cefetamet pivoxil, cefixime, cefmenoxime, cefodizime, cefoperazone, cefoperazone/sulbactam, cefotaxime, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotiam hexetil, cefovecin, cefpimizole, cefpiramide, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefsulodin, ceftazidime, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftriaxone, latamoxef)</p></li>
|
||||
<li><p><code>cephalosporins_4th</code><br />(cefepime, cefepime/clavulanic acid, cefepime/tazobactam, cefetecol (Cefcatacol), cefoselis, cefozopran, cefpirome, cefquinome)</p></li>
|
||||
<li><p><code>cephalosporins_5th</code><br />(ceftaroline, ceftaroline/avibactam, ceftobiprole, ceftobiprole medocaril, ceftolozane/enzyme inhibitor, ceftolozane/tazobactam)</p></li>
|
||||
<li><p><code>cephalosporins_except_caz</code><br />(cefacetrile, cefaclor, cefadroxil, cefaloridine, cefamandole, cefatrizine, cefazedone, cefazolin, cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime, cefepime/clavulanic acid, cefepime/tazobactam, cefetamet, cefetamet pivoxil, cefetecol (Cefcatacol), cefetrizole, cefixime, cefmenoxime, cefmetazole, cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam, ceforanide, cefoselis, cefotaxime, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam, cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening, cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil, cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline, ceftaroline/avibactam, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftobiprole, ceftobiprole medocaril, ceftolozane/enzyme inhibitor, ceftolozane/tazobactam, ceftriaxone, cefuroxime, cefuroxime axetil, cephalexin, cephalothin, cephapirin, cephradine, latamoxef, loracarbef)</p></li>
|
||||
<li><p><code>fluoroquinolones</code><br />(besifloxacin, ciprofloxacin, clinafloxacin, danofloxacin, delafloxacin, difloxacin, enoxacin, enrofloxacin, finafloxacin, fleroxacin, garenoxacin, gatifloxacin, gemifloxacin, grepafloxacin, levofloxacin, levonadifloxacin, lomefloxacin, marbofloxacin, metioxate, miloxacin, moxifloxacin, nadifloxacin, nifuroquine, norfloxacin, ofloxacin, orbifloxacin, pazufloxacin, pefloxacin, pradofloxacin, premafloxacin, prulifloxacin, rufloxacin, sarafloxacin, sitafloxacin, sparfloxacin, temafloxacin, tilbroquinol, tioxacin, tosufloxacin, trovafloxacin)</p></li>
|
||||
<li><p><code>glycopeptides</code><br />(avoparcin, dalbavancin, norvancomycin, oritavancin, ramoplanin, teicoplanin, teicoplanin-macromethod, telavancin, vancomycin, vancomycin-macromethod)</p></li>
|
||||
<li><p><code>glycopeptides_except_lipo</code><br />(avoparcin, norvancomycin, ramoplanin, teicoplanin, teicoplanin-macromethod, vancomycin, vancomycin-macromethod)</p></li>
|
||||
<li><p><code>lincosamides</code><br />(clindamycin, lincomycin, pirlimycin)</p></li>
|
||||
<li><p><code>lincosamides</code><br />(acetylmidecamycin, acetylspiramycin, clindamycin, gamithromycin, kitasamycin (Leucomycin), lincomycin, meleumycin, nafithromycin, pirlimycin, primycin, solithromycin, tildipirosin, tilmicosin, tulathromycin, tylosin, tylvalosin)</p></li>
|
||||
<li><p><code>lipoglycopeptides</code><br />(dalbavancin, oritavancin, telavancin)</p></li>
|
||||
<li><p><code>macrolides</code><br />(azithromycin, clarithromycin, dirithromycin, erythromycin, flurithromycin, josamycin, midecamycin, miocamycin, oleandomycin, rokitamycin, roxithromycin, spiramycin, telithromycin, troleandomycin)</p></li>
|
||||
<li><p><code>oxazolidinones</code><br />(cycloserine, linezolid, tedizolid, thiacetazone)</p></li>
|
||||
<li><p><code>macrolides</code><br />(acetylmidecamycin, acetylspiramycin, azithromycin, clarithromycin, dirithromycin, erythromycin, flurithromycin, gamithromycin, josamycin, kitasamycin (Leucomycin), meleumycin, midecamycin, miocamycin, nafithromycin, oleandomycin, pirlimycin, primycin, rokitamycin, roxithromycin, solithromycin, spiramycin, telithromycin, tildipirosin, tilmicosin, troleandomycin, tulathromycin, tylosin, tylvalosin)</p></li>
|
||||
<li><p><code>oxazolidinones</code><br />(cadazolid, cycloserine, linezolid, tedizolid, thiacetazone)</p></li>
|
||||
<li><p><code>penicillins</code><br />(amoxicillin, amoxicillin/clavulanic acid, amoxicillin/sulbactam, ampicillin, ampicillin/sulbactam, apalcillin, aspoxicillin, avibactam, azidocillin, azlocillin, aztreonam, aztreonam/avibactam, bacampicillin, benzathine benzylpenicillin, benzathine phenoxymethylpenicillin, benzylpenicillin, carbenicillin, carindacillin, ciclacillin, clometocillin, cloxacillin, dicloxacillin, epicillin, flucloxacillin, hetacillin, lenampicillin, mecillinam (Amdinocillin), metampicillin, methicillin, mezlocillin, mezlocillin/sulbactam, nacubactam, nafcillin, oxacillin, penamecillin, penicillin/novobiocin, penicillin/sulbactam, phenethicillin, phenoxymethylpenicillin, piperacillin, piperacillin/sulbactam, piperacillin/tazobactam, piridicillin, pivampicillin, pivmecillinam, procaine benzylpenicillin, propicillin, sarmoxicillin, sulbactam, sulbenicillin, sultamicillin, talampicillin, tazobactam, temocillin, ticarcillin, ticarcillin/clavulanic acid)</p></li>
|
||||
<li><p><code>polymyxins</code><br />(colistin, polymyxin B, polymyxin B/polysorbate 80)</p></li>
|
||||
<li><p><code>quinolones</code><br />(besifloxacin, cinoxacin, ciprofloxacin, clinafloxacin, danofloxacin, delafloxacin, difloxacin, enoxacin, enrofloxacin, finafloxacin, fleroxacin, flumequine, garenoxacin, gatifloxacin, gemifloxacin, grepafloxacin, levofloxacin, levonadifloxacin, lomefloxacin, marbofloxacin, metioxate, miloxacin, moxifloxacin, nadifloxacin, nalidixic acid, nifuroquine, nitroxoline, norfloxacin, ofloxacin, orbifloxacin, oxolinic acid, pazufloxacin, pefloxacin, pipemidic acid, piromidic acid, pradofloxacin, premafloxacin, prulifloxacin, rosoxacin, rufloxacin, sarafloxacin, sitafloxacin, sparfloxacin, temafloxacin, tilbroquinol, tioxacin, tosufloxacin, trovafloxacin)</p></li>
|
||||
<li><p><code>streptogramins</code><br />(pristinamycin, quinupristin/dalfopristin)</p></li>
|
||||
<li><p><code>tetracyclines</code><br />(chlortetracycline, clomocycline, demeclocycline, doxycycline, eravacycline, lymecycline, metacycline, minocycline, oxytetracycline, penimepicycline, rolitetracycline, tetracycline, tigecycline)</p></li>
|
||||
<li><p><code>tetracyclines_except_tgc</code><br />(chlortetracycline, clomocycline, demeclocycline, doxycycline, eravacycline, lymecycline, metacycline, minocycline, oxytetracycline, penimepicycline, rolitetracycline, tetracycline)</p></li>
|
||||
<li><p><code>tetracyclines</code><br />(cetocycline, chlortetracycline, clomocycline, demeclocycline, doxycycline, eravacycline, lymecycline, metacycline, minocycline, omadacycline, oxytetracycline, penimepicycline, rolitetracycline, tetracycline, tigecycline)</p></li>
|
||||
<li><p><code>tetracyclines_except_tgc</code><br />(cetocycline, chlortetracycline, clomocycline, demeclocycline, doxycycline, eravacycline, lymecycline, metacycline, minocycline, omadacycline, oxytetracycline, penimepicycline, rolitetracycline, tetracycline)</p></li>
|
||||
<li><p><code>ureidopenicillins</code><br />(azlocillin, mezlocillin, piperacillin, piperacillin/tazobactam)</p></li>
|
||||
</ul>
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -83,7 +83,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9005</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -457,11 +457,8 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
|
||||
<pre class="examples"><span class='co'># `example_isolates` is a data set available in the AMR package.</span>
|
||||
<span class='co'># See ?example_isolates.</span>
|
||||
|
||||
<span class='va'>example_isolates</span><span class='op'>[</span><span class='fu'>first_isolate</span><span class='op'>(</span><span class='va'>example_isolates</span><span class='op'>)</span>, <span class='op'>]</span>
|
||||
<span class='co'># \donttest{</span>
|
||||
<span class='co'># faster way, only works in R 3.2 and later:</span>
|
||||
<span class='va'>example_isolates</span><span class='op'>[</span><span class='fu'>first_isolate</span><span class='op'>(</span><span class='op'>)</span>, <span class='op'>]</span>
|
||||
|
||||
<span class='co'># \donttest{</span>
|
||||
<span class='co'># get all first Gram-negatives</span>
|
||||
<span class='va'>example_isolates</span><span class='op'>[</span><span class='fu'><a href='https://rdrr.io/r/base/which.html'>which</a></span><span class='op'>(</span><span class='fu'>first_isolate</span><span class='op'>(</span><span class='op'>)</span> <span class='op'>&</span> <span class='fu'><a href='mo_property.html'>mo_is_gram_negative</a></span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span>, <span class='op'>]</span>
|
||||
|
||||
|
@ -81,7 +81,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9008</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -508,7 +508,7 @@
|
||||
</tr><tr>
|
||||
|
||||
<td>
|
||||
<p><code><a href="plot.html">plot(<i><mic></i>)</a></code> <code><a href="plot.html">ggplot(<i><mic></i>)</a></code> <code><a href="plot.html">plot(<i><disk></i>)</a></code> <code><a href="plot.html">ggplot(<i><disk></i>)</a></code> <code><a href="plot.html">plot(<i><rsi></i>)</a></code> <code><a href="plot.html">ggplot(<i><rsi></i>)</a></code> </p>
|
||||
<p><code><a href="plot.html">plot(<i><mic></i>)</a></code> <code><a href="plot.html">ggplot(<i><mic></i>)</a></code> <code><a href="plot.html">autoplot(<i><mic></i>)</a></code> <code><a href="plot.html">plot(<i><disk></i>)</a></code> <code><a href="plot.html">ggplot(<i><disk></i>)</a></code> <code><a href="plot.html">autoplot(<i><disk></i>)</a></code> <code><a href="plot.html">plot(<i><rsi></i>)</a></code> <code><a href="plot.html">ggplot(<i><rsi></i>)</a></code> <code><a href="plot.html">autoplot(<i><rsi></i>)</a></code> </p>
|
||||
</td>
|
||||
<td><p>Plotting for Classes <code>rsi</code>, <code>mic</code> and <code>disk</code></p></td>
|
||||
</tr><tr>
|
||||
@ -526,13 +526,13 @@
|
||||
</tr><tr>
|
||||
|
||||
<td>
|
||||
<p><code><a href="antibiotic_class_selectors.html">ab_class()</a></code> <code><a href="antibiotic_class_selectors.html">aminoglycosides()</a></code> <code><a href="antibiotic_class_selectors.html">betalactams()</a></code> <code><a href="antibiotic_class_selectors.html">carbapenems()</a></code> <code><a href="antibiotic_class_selectors.html">cephalosporins()</a></code> <code><a href="antibiotic_class_selectors.html">cephalosporins_1st()</a></code> <code><a href="antibiotic_class_selectors.html">cephalosporins_2nd()</a></code> <code><a href="antibiotic_class_selectors.html">cephalosporins_3rd()</a></code> <code><a href="antibiotic_class_selectors.html">cephalosporins_4th()</a></code> <code><a href="antibiotic_class_selectors.html">cephalosporins_5th()</a></code> <code><a href="antibiotic_class_selectors.html">fluoroquinolones()</a></code> <code><a href="antibiotic_class_selectors.html">glycopeptides()</a></code> <code><a href="antibiotic_class_selectors.html">macrolides()</a></code> <code><a href="antibiotic_class_selectors.html">oxazolidinones()</a></code> <code><a href="antibiotic_class_selectors.html">penicillins()</a></code> <code><a href="antibiotic_class_selectors.html">tetracyclines()</a></code> </p>
|
||||
<p><code><a href="antibiotic_class_selectors.html">ab_class()</a></code> <code><a href="antibiotic_class_selectors.html">aminoglycosides()</a></code> <code><a href="antibiotic_class_selectors.html">aminopenicillins()</a></code> <code><a href="antibiotic_class_selectors.html">betalactams()</a></code> <code><a href="antibiotic_class_selectors.html">carbapenems()</a></code> <code><a href="antibiotic_class_selectors.html">cephalosporins()</a></code> <code><a href="antibiotic_class_selectors.html">cephalosporins_1st()</a></code> <code><a href="antibiotic_class_selectors.html">cephalosporins_2nd()</a></code> <code><a href="antibiotic_class_selectors.html">cephalosporins_3rd()</a></code> <code><a href="antibiotic_class_selectors.html">cephalosporins_4th()</a></code> <code><a href="antibiotic_class_selectors.html">cephalosporins_5th()</a></code> <code><a href="antibiotic_class_selectors.html">fluoroquinolones()</a></code> <code><a href="antibiotic_class_selectors.html">glycopeptides()</a></code> <code><a href="antibiotic_class_selectors.html">lincosamides()</a></code> <code><a href="antibiotic_class_selectors.html">lipoglycopeptides()</a></code> <code><a href="antibiotic_class_selectors.html">macrolides()</a></code> <code><a href="antibiotic_class_selectors.html">oxazolidinones()</a></code> <code><a href="antibiotic_class_selectors.html">penicillins()</a></code> <code><a href="antibiotic_class_selectors.html">polymyxins()</a></code> <code><a href="antibiotic_class_selectors.html">streptogramins()</a></code> <code><a href="antibiotic_class_selectors.html">quinolones()</a></code> <code><a href="antibiotic_class_selectors.html">tetracyclines()</a></code> <code><a href="antibiotic_class_selectors.html">ureidopenicillins()</a></code> </p>
|
||||
</td>
|
||||
<td><p>Antibiotic Class Selectors</p></td>
|
||||
</tr><tr>
|
||||
|
||||
<td>
|
||||
<p><code><a href="resistance_predict.html">resistance_predict()</a></code> <code><a href="resistance_predict.html">rsi_predict()</a></code> <code><a href="resistance_predict.html">plot(<i><resistance_predict></i>)</a></code> <code><a href="resistance_predict.html">ggplot(<i><resistance_predict></i>)</a></code> <code><a href="resistance_predict.html">ggplot_rsi_predict()</a></code> </p>
|
||||
<p><code><a href="resistance_predict.html">resistance_predict()</a></code> <code><a href="resistance_predict.html">rsi_predict()</a></code> <code><a href="resistance_predict.html">plot(<i><resistance_predict></i>)</a></code> <code><a href="resistance_predict.html">ggplot_rsi_predict()</a></code> <code><a href="resistance_predict.html">ggplot(<i><resistance_predict></i>)</a></code> <code><a href="resistance_predict.html">autoplot(<i><resistance_predict></i>)</a></code> </p>
|
||||
</td>
|
||||
<td><p>Predict antimicrobial resistance</p></td>
|
||||
</tr><tr>
|
||||
|
@ -82,7 +82,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9005</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -281,7 +281,7 @@
|
||||
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
|
||||
|
||||
<p><strong>Note:</strong> As opposed to the <code>join()</code> functions of <code>dplyr</code>, <a href='https://rdrr.io/r/base/character.html'>character</a> vectors are supported and at default existing columns will get a suffix <code>"2"</code> and the newly joined columns will not get a suffix.</p>
|
||||
<p>If the <code>dplyr</code> package is installed, their join functions will be used. Otherwise, the much slower <code><a href='https://rdrr.io/r/base/merge.html'>merge()</a></code> and <code><a href='https://rdrr.io/r/base/interaction.html'>interaction()</a></code> functions from base R will be used.</p>
|
||||
<p>If the <code>dplyr</code> package is installed, their join functions will be used. Otherwise, the much slower <code><a href='https://rdrr.io/r/base/merge.html'>merge()</a></code> and <code><a href='https://rdrr.io/r/base/interaction.html'>interaction()</a></code> functions from base <span style="R">R</span> will be used.</p>
|
||||
<h2 class="hasAnchor" id="stable-lifecycle"><a class="anchor" href="#stable-lifecycle"></a>Stable Lifecycle</h2>
|
||||
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -82,7 +82,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9005</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -239,7 +239,7 @@
|
||||
</div>
|
||||
|
||||
<div class="ref-description">
|
||||
<p>Functions to plot classes <code>rsi</code>, <code>mic</code> and <code>disk</code>, with support for base R and <code>ggplot2</code>.</p>
|
||||
<p>Functions to plot classes <code>rsi</code>, <code>mic</code> and <code>disk</code>, with support for base <span style="R">R</span> and <code>ggplot2</code>.</p>
|
||||
</div>
|
||||
|
||||
<pre class="usage"><span class='co'># S3 method for mic</span>
|
||||
@ -258,7 +258,23 @@
|
||||
<span class='op'>)</span>
|
||||
|
||||
<span class='co'># S3 method for mic</span>
|
||||
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/ggplot.html'>ggplot</a></span><span class='op'>(</span>
|
||||
<span class='fu'>ggplot</span><span class='op'>(</span>
|
||||
<span class='va'>data</span>,
|
||||
mapping <span class='op'>=</span> <span class='cn'>NULL</span>,
|
||||
title <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/paste.html'>paste</a></span><span class='op'>(</span><span class='st'>"MIC values of"</span>, <span class='fu'><a href='https://rdrr.io/r/base/deparse.html'>deparse</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/substitute.html'>substitute</a></span><span class='op'>(</span><span class='va'>data</span><span class='op'>)</span><span class='op'>)</span><span class='op'>)</span>,
|
||||
ylab <span class='op'>=</span> <span class='st'>"Frequency"</span>,
|
||||
xlab <span class='op'>=</span> <span class='st'>"Minimum Inhibitory Concentration (mg/L)"</span>,
|
||||
mo <span class='op'>=</span> <span class='cn'>NULL</span>,
|
||||
ab <span class='op'>=</span> <span class='cn'>NULL</span>,
|
||||
guideline <span class='op'>=</span> <span class='st'>"EUCAST"</span>,
|
||||
colours_RSI <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span><span class='st'>"#ED553B"</span>, <span class='st'>"#3CAEA3"</span>, <span class='st'>"#F6D55C"</span><span class='op'>)</span>,
|
||||
language <span class='op'>=</span> <span class='fu'><a href='translate.html'>get_locale</a></span><span class='op'>(</span><span class='op'>)</span>,
|
||||
expand <span class='op'>=</span> <span class='cn'>TRUE</span>,
|
||||
<span class='va'>...</span>
|
||||
<span class='op'>)</span>
|
||||
|
||||
<span class='co'># S3 method for mic</span>
|
||||
<span class='fu'>autoplot</span><span class='op'>(</span>
|
||||
<span class='va'>data</span>,
|
||||
mapping <span class='op'>=</span> <span class='cn'>NULL</span>,
|
||||
title <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/paste.html'>paste</a></span><span class='op'>(</span><span class='st'>"MIC values of"</span>, <span class='fu'><a href='https://rdrr.io/r/base/deparse.html'>deparse</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/substitute.html'>substitute</a></span><span class='op'>(</span><span class='va'>data</span><span class='op'>)</span><span class='op'>)</span><span class='op'>)</span>,
|
||||
@ -289,7 +305,23 @@
|
||||
<span class='op'>)</span>
|
||||
|
||||
<span class='co'># S3 method for disk</span>
|
||||
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/ggplot.html'>ggplot</a></span><span class='op'>(</span>
|
||||
<span class='fu'>ggplot</span><span class='op'>(</span>
|
||||
<span class='va'>data</span>,
|
||||
mapping <span class='op'>=</span> <span class='cn'>NULL</span>,
|
||||
title <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/paste.html'>paste</a></span><span class='op'>(</span><span class='st'>"Disk zones of"</span>, <span class='fu'><a href='https://rdrr.io/r/base/deparse.html'>deparse</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/substitute.html'>substitute</a></span><span class='op'>(</span><span class='va'>data</span><span class='op'>)</span><span class='op'>)</span><span class='op'>)</span>,
|
||||
ylab <span class='op'>=</span> <span class='st'>"Frequency"</span>,
|
||||
xlab <span class='op'>=</span> <span class='st'>"Disk diffusion diameter (mm)"</span>,
|
||||
mo <span class='op'>=</span> <span class='cn'>NULL</span>,
|
||||
ab <span class='op'>=</span> <span class='cn'>NULL</span>,
|
||||
guideline <span class='op'>=</span> <span class='st'>"EUCAST"</span>,
|
||||
colours_RSI <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span><span class='st'>"#ED553B"</span>, <span class='st'>"#3CAEA3"</span>, <span class='st'>"#F6D55C"</span><span class='op'>)</span>,
|
||||
language <span class='op'>=</span> <span class='fu'><a href='translate.html'>get_locale</a></span><span class='op'>(</span><span class='op'>)</span>,
|
||||
expand <span class='op'>=</span> <span class='cn'>TRUE</span>,
|
||||
<span class='va'>...</span>
|
||||
<span class='op'>)</span>
|
||||
|
||||
<span class='co'># S3 method for disk</span>
|
||||
<span class='fu'>autoplot</span><span class='op'>(</span>
|
||||
<span class='va'>data</span>,
|
||||
mapping <span class='op'>=</span> <span class='cn'>NULL</span>,
|
||||
title <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/paste.html'>paste</a></span><span class='op'>(</span><span class='st'>"Disk zones of"</span>, <span class='fu'><a href='https://rdrr.io/r/base/deparse.html'>deparse</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/substitute.html'>substitute</a></span><span class='op'>(</span><span class='va'>data</span><span class='op'>)</span><span class='op'>)</span><span class='op'>)</span>,
|
||||
@ -314,7 +346,19 @@
|
||||
<span class='op'>)</span>
|
||||
|
||||
<span class='co'># S3 method for rsi</span>
|
||||
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/ggplot.html'>ggplot</a></span><span class='op'>(</span>
|
||||
<span class='fu'>ggplot</span><span class='op'>(</span>
|
||||
<span class='va'>data</span>,
|
||||
mapping <span class='op'>=</span> <span class='cn'>NULL</span>,
|
||||
title <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/paste.html'>paste</a></span><span class='op'>(</span><span class='st'>"Resistance Overview of"</span>, <span class='fu'><a href='https://rdrr.io/r/base/deparse.html'>deparse</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/substitute.html'>substitute</a></span><span class='op'>(</span><span class='va'>data</span><span class='op'>)</span><span class='op'>)</span><span class='op'>)</span>,
|
||||
xlab <span class='op'>=</span> <span class='st'>"Antimicrobial Interpretation"</span>,
|
||||
ylab <span class='op'>=</span> <span class='st'>"Frequency"</span>,
|
||||
colours_RSI <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span><span class='st'>"#ED553B"</span>, <span class='st'>"#3CAEA3"</span>, <span class='st'>"#F6D55C"</span><span class='op'>)</span>,
|
||||
language <span class='op'>=</span> <span class='fu'><a href='translate.html'>get_locale</a></span><span class='op'>(</span><span class='op'>)</span>,
|
||||
<span class='va'>...</span>
|
||||
<span class='op'>)</span>
|
||||
|
||||
<span class='co'># S3 method for rsi</span>
|
||||
<span class='fu'>autoplot</span><span class='op'>(</span>
|
||||
<span class='va'>data</span>,
|
||||
mapping <span class='op'>=</span> <span class='cn'>NULL</span>,
|
||||
title <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/paste.html'>paste</a></span><span class='op'>(</span><span class='st'>"Resistance Overview of"</span>, <span class='fu'><a href='https://rdrr.io/r/base/deparse.html'>deparse</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/substitute.html'>substitute</a></span><span class='op'>(</span><span class='va'>data</span><span class='op'>)</span><span class='op'>)</span><span class='op'>)</span>,
|
||||
|
@ -82,7 +82,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9005</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -278,7 +278,7 @@
|
||||
<p>class <code><mic></code> for <code>random_mic()</code> (see <code><a href='as.mic.html'>as.mic()</a></code>) and class <code><disk></code> for <code>random_disk()</code> (see <code><a href='as.disk.html'>as.disk()</a></code>)</p>
|
||||
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
|
||||
|
||||
<p>The base R function <code><a href='https://rdrr.io/r/base/sample.html'>sample()</a></code> is used for generating values.</p>
|
||||
<p>The base <span style="R">R</span> function <code><a href='https://rdrr.io/r/base/sample.html'>sample()</a></code> is used for generating values.</p>
|
||||
<p>Generated values are based on the latest EUCAST guideline implemented in the <a href='rsi_translation.html'>rsi_translation</a> data set. To create specific generated values per bug or drug, set the <code>mo</code> and/or <code>ab</code> argument.</p>
|
||||
<h2 class="hasAnchor" id="stable-lifecycle"><a class="anchor" href="#stable-lifecycle"></a>Stable Lifecycle</h2>
|
||||
|
||||
|
@ -82,7 +82,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9005</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -275,10 +275,18 @@
|
||||
<span class='co'># S3 method for resistance_predict</span>
|
||||
<span class='fu'><a href='plot.html'>plot</a></span><span class='op'>(</span><span class='va'>x</span>, main <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/paste.html'>paste</a></span><span class='op'>(</span><span class='st'>"Resistance Prediction of"</span>, <span class='va'>x_name</span><span class='op'>)</span>, <span class='va'>...</span><span class='op'>)</span>
|
||||
|
||||
<span class='fu'>ggplot_rsi_predict</span><span class='op'>(</span>
|
||||
<span class='va'>x</span>,
|
||||
main <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/paste.html'>paste</a></span><span class='op'>(</span><span class='st'>"Resistance Prediction of"</span>, <span class='va'>x_name</span><span class='op'>)</span>,
|
||||
ribbon <span class='op'>=</span> <span class='cn'>TRUE</span>,
|
||||
<span class='va'>...</span>
|
||||
<span class='op'>)</span>
|
||||
|
||||
<span class='co'># S3 method for resistance_predict</span>
|
||||
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/ggplot.html'>ggplot</a></span><span class='op'>(</span><span class='va'>x</span>, main <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/paste.html'>paste</a></span><span class='op'>(</span><span class='st'>"Resistance Prediction of"</span>, <span class='va'>x_name</span><span class='op'>)</span>, ribbon <span class='op'>=</span> <span class='cn'>TRUE</span>, <span class='va'>...</span><span class='op'>)</span>
|
||||
|
||||
<span class='fu'>ggplot_rsi_predict</span><span class='op'>(</span>
|
||||
<span class='co'># S3 method for resistance_predict</span>
|
||||
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/autoplot.html'>autoplot</a></span><span class='op'>(</span>
|
||||
<span class='va'>x</span>,
|
||||
main <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/paste.html'>paste</a></span><span class='op'>(</span><span class='st'>"Resistance Prediction of"</span>, <span class='va'>x_name</span><span class='op'>)</span>,
|
||||
ribbon <span class='op'>=</span> <span class='cn'>TRUE</span>,
|
||||
|
@ -81,7 +81,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9008</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
22
index.md
22
index.md
@ -25,16 +25,12 @@ library(AMR)
|
||||
library(dplyr)
|
||||
|
||||
example_isolates %>%
|
||||
mutate(bacteria = mo_fullname(mo)) %>%
|
||||
filter(mo_is_gram_negative(), mo_is_intrinsic_resistant(ab = "cefotax")) %>%
|
||||
select(bacteria, aminoglycosides(), carbapenems())
|
||||
#> ℹ Using column 'mo' as input for `mo_is_gram_negative()`
|
||||
#> ℹ Using column 'mo' as input for `mo_is_intrinsic_resistant()`
|
||||
#> ℹ Determining intrinsic resistance based on 'EUCAST Expert Rules' and 'EUCAST Intrinsic
|
||||
#> Resistance and Unusual Phenotypes' v3.2 (2020)
|
||||
#> ℹ For `aminoglycosides()` using columns: 'AMK' (amikacin), 'GEN' (gentamicin), 'KAN'
|
||||
#> (kanamycin) and 'TOB' (tobramycin)
|
||||
#> ℹ For `carbapenems()` using columns: 'IPM' (imipenem) and 'MEM' (meropenem)
|
||||
mutate(bacteria = mo_fullname()) %>%
|
||||
filter(mo_is_gram_negative(),
|
||||
mo_is_intrinsic_resistant(ab = "cefotax")) %>%
|
||||
select(bacteria,
|
||||
aminoglycosides(),
|
||||
carbapenems())
|
||||
```
|
||||
|
||||
With only having defined a row filter on Gram-negative bacteria with intrinsic resistance to cefotaxime (`mo_is_gram_negative()` and `mo_is_intrinsic_resistant()`) and a column selection on two antibiotic groups (`aminoglycosides()` and `carbapenems()`), the reference data about [all microorganisms](./reference/microorganisms.html) and [all antibiotics](./reference/antibiotics.html) in the `AMR` package make sure you get what you meant:
|
||||
@ -114,9 +110,9 @@ It will be downloaded and installed automatically. For RStudio, click on the men
|
||||
|
||||
#### Latest development version
|
||||
|
||||

|
||||
](https://www.codefactor.io/repository/github/msberends/amr)
|
||||
](https://codecov.io/gh/msberends/AMR?branch=master)
|
||||
![R-code-check][https://github.com/msberends/AMR/workflows/R-code-check/badge.svg?branch=master](https://github.com/msberends/AMR/actions)
|
||||
![CodeFactor][https://www.codefactor.io/repository/github/msberends/amr/badge](https://www.codefactor.io/repository/github/msberends/amr)
|
||||
![Codecov][https://codecov.io/gh/msberends/AMR/branch/master/graph/badge.svg](https://codecov.io/gh/msberends/AMR?branch=master)
|
||||
|
||||
The latest and unpublished development version can be installed from GitHub in two ways:
|
||||
|
||||
|
@ -23,41 +23,48 @@
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
if (getRversion() >= "3.2") {
|
||||
# antibiotic class selectors require at least R-3.2
|
||||
expect_true(ncol(example_isolates[, aminoglycosides(), drop = FALSE]) < ncol(example_isolates))
|
||||
expect_true(ncol(example_isolates[, betalactams(), drop = FALSE]) < ncol(example_isolates))
|
||||
expect_true(ncol(example_isolates[, carbapenems(), drop = FALSE]) < ncol(example_isolates))
|
||||
expect_true(ncol(example_isolates[, cephalosporins(), drop = FALSE]) < ncol(example_isolates))
|
||||
expect_true(ncol(example_isolates[, cephalosporins_1st(), drop = FALSE]) < ncol(example_isolates))
|
||||
expect_true(ncol(example_isolates[, cephalosporins_2nd(), drop = FALSE]) < ncol(example_isolates))
|
||||
expect_true(ncol(example_isolates[, cephalosporins_3rd(), drop = FALSE]) < ncol(example_isolates))
|
||||
expect_true(ncol(example_isolates[, cephalosporins_4th(), drop = FALSE]) < ncol(example_isolates))
|
||||
expect_true(ncol(example_isolates[, cephalosporins_5th(), drop = FALSE]) < ncol(example_isolates))
|
||||
expect_true(ncol(example_isolates[, fluoroquinolones(), drop = FALSE]) < ncol(example_isolates))
|
||||
expect_true(ncol(example_isolates[, glycopeptides(), drop = FALSE]) < ncol(example_isolates))
|
||||
expect_true(ncol(example_isolates[, macrolides(), drop = FALSE]) < ncol(example_isolates))
|
||||
expect_true(ncol(example_isolates[, oxazolidinones(), drop = FALSE]) < ncol(example_isolates))
|
||||
expect_true(ncol(example_isolates[, penicillins(), drop = FALSE]) < ncol(example_isolates))
|
||||
expect_true(ncol(example_isolates[, tetracyclines(), drop = FALSE]) < ncol(example_isolates))
|
||||
# antibiotic class selectors
|
||||
expect_true(ncol(example_isolates[, ab_class("antimyco"), drop = FALSE]) < ncol(example_isolates))
|
||||
expect_true(ncol(example_isolates[, aminoglycosides(), drop = FALSE]) < ncol(example_isolates))
|
||||
expect_true(ncol(example_isolates[, aminopenicillins(), drop = FALSE]) < ncol(example_isolates))
|
||||
expect_true(ncol(example_isolates[, betalactams(), drop = FALSE]) < ncol(example_isolates))
|
||||
expect_true(ncol(example_isolates[, carbapenems(), drop = FALSE]) < ncol(example_isolates))
|
||||
expect_true(ncol(example_isolates[, cephalosporins(), drop = FALSE]) < ncol(example_isolates))
|
||||
expect_true(ncol(example_isolates[, cephalosporins_1st(), drop = FALSE]) < ncol(example_isolates))
|
||||
expect_true(ncol(example_isolates[, cephalosporins_2nd(), drop = FALSE]) < ncol(example_isolates))
|
||||
expect_true(ncol(example_isolates[, cephalosporins_3rd(), drop = FALSE]) < ncol(example_isolates))
|
||||
expect_true(ncol(example_isolates[, cephalosporins_4th(), drop = FALSE]) < ncol(example_isolates))
|
||||
expect_true(ncol(example_isolates[, cephalosporins_5th(), drop = FALSE]) < ncol(example_isolates))
|
||||
expect_true(ncol(example_isolates[, fluoroquinolones(), drop = FALSE]) < ncol(example_isolates))
|
||||
expect_true(ncol(example_isolates[, glycopeptides(), drop = FALSE]) < ncol(example_isolates))
|
||||
expect_true(ncol(example_isolates[, lincosamides(), drop = FALSE]) < ncol(example_isolates))
|
||||
expect_true(ncol(example_isolates[, lipoglycopeptides(), drop = FALSE]) < ncol(example_isolates))
|
||||
expect_true(ncol(example_isolates[, macrolides(), drop = FALSE]) < ncol(example_isolates))
|
||||
expect_true(ncol(example_isolates[, oxazolidinones(), drop = FALSE]) < ncol(example_isolates))
|
||||
expect_true(ncol(example_isolates[, penicillins(), drop = FALSE]) < ncol(example_isolates))
|
||||
expect_true(ncol(example_isolates[, polymyxins(), drop = FALSE]) < ncol(example_isolates))
|
||||
expect_true(ncol(example_isolates[, streptogramins(), drop = FALSE]) < ncol(example_isolates))
|
||||
expect_true(ncol(example_isolates[, quinolones(), drop = FALSE]) < ncol(example_isolates))
|
||||
expect_true(ncol(example_isolates[, tetracyclines(), drop = FALSE]) < ncol(example_isolates))
|
||||
expect_true(ncol(example_isolates[, ureidopenicillins(), drop = FALSE]) < ncol(example_isolates))
|
||||
|
||||
# Examples:
|
||||
# Examples:
|
||||
|
||||
# select columns 'mo', 'AMK', 'GEN', 'KAN' and 'TOB'
|
||||
expect_equal(ncol(example_isolates[, c("mo", aminoglycosides())]), 5, tolerance = 0.5)
|
||||
# select columns 'mo', 'AMK', 'GEN', 'KAN' and 'TOB'
|
||||
expect_equal(ncol(example_isolates[, c("mo", aminoglycosides())]), 5, tolerance = 0.5)
|
||||
|
||||
# filter using any() or all()
|
||||
expect_equal(nrow(example_isolates[any(carbapenems() == "R"), ]), 55, tolerance = 0.5)
|
||||
expect_equal(nrow(subset(example_isolates, any(carbapenems() == "R"))), 55, tolerance = 0.5)
|
||||
# filter using any() or all()
|
||||
expect_equal(nrow(example_isolates[any(carbapenems() == "R"), ]), 55, tolerance = 0.5)
|
||||
expect_equal(nrow(subset(example_isolates, any(carbapenems() == "R"))), 55, tolerance = 0.5)
|
||||
|
||||
# filter on any or all results in the carbapenem columns (i.e., IPM, MEM):
|
||||
expect_equal(nrow(example_isolates[any(carbapenems()), ]), 962, tolerance = 0.5)
|
||||
expect_equal(nrow(example_isolates[all(carbapenems()), ]), 756, tolerance = 0.5)
|
||||
# filter on any or all results in the carbapenem columns (i.e., IPM, MEM):
|
||||
expect_equal(nrow(example_isolates[any(carbapenems()), ]), 962, tolerance = 0.5)
|
||||
expect_equal(nrow(example_isolates[all(carbapenems()), ]), 756, tolerance = 0.5)
|
||||
|
||||
# filter with multiple antibiotic selectors using c()
|
||||
expect_equal(nrow(example_isolates[all(c(carbapenems(), aminoglycosides()) == "R"), ]), 26, tolerance = 0.5)
|
||||
# filter with multiple antibiotic selectors using c()
|
||||
expect_equal(nrow(example_isolates[all(c(carbapenems(), aminoglycosides()) == "R"), ]), 26, tolerance = 0.5)
|
||||
|
||||
# filter + select in one go: get penicillins in carbapenems-resistant strains
|
||||
expect_equal(nrow(example_isolates[any(carbapenems() == "R"), penicillins()]), 55, tolerance = 0.5)
|
||||
expect_equal(ncol(example_isolates[any(carbapenems() == "R"), penicillins()]), 7, tolerance = 0.5)
|
||||
|
||||
# filter + select in one go: get penicillins in carbapenems-resistant strains
|
||||
expect_equal(nrow(example_isolates[any(carbapenems() == "R"), penicillins()]), 55, tolerance = 0.5)
|
||||
expect_equal(ncol(example_isolates[any(carbapenems() == "R"), penicillins()]), 7, tolerance = 0.5)
|
||||
}
|
||||
|
@ -30,5 +30,4 @@ if (AMR:::pkg_is_available("curl", also_load = FALSE) &&
|
||||
expect_true(length(atc_online_groups(ab_atc("AMX"))) >= 1)
|
||||
expect_equal(atc_online_ddd(ab_atc("AMX"), administration = "O"), 1.5)
|
||||
expect_equal(atc_online_ddd(ab_atc("AMX"), administration = "P"), 3)
|
||||
expect_warning(atc_online_ddd(ab_atc("Novobiocin"), administration = "P"))
|
||||
}
|
||||
|
@ -28,3 +28,9 @@ expect_inherits(b, "bug_drug_combinations")
|
||||
expect_stdout(suppressMessages(print(b)))
|
||||
expect_true(is.data.frame(format(b)))
|
||||
expect_true(is.data.frame(format(b, combine_IR = TRUE, add_ab_group = FALSE)))
|
||||
if (AMR:::pkg_is_available("dplyr")) {
|
||||
expect_true(example_isolates %>%
|
||||
group_by(hospital_id) %>%
|
||||
bug_drug_combinations(FUN = mo_gramstain) %>%
|
||||
is.data.frame())
|
||||
}
|
||||
|
@ -29,8 +29,10 @@ expect_true(AMR:::check_dataset_integrity()) # in misc.R
|
||||
expect_identical(nrow(microorganisms), length(unique(microorganisms$mo)))
|
||||
expect_identical(class(microorganisms$mo), c("mo", "character"))
|
||||
expect_identical(nrow(antibiotics), length(unique(antibiotics$ab)))
|
||||
expect_true(all(is.na(antibiotics$atc[duplicated(antibiotics$atc)])))
|
||||
expect_identical(class(antibiotics$ab), c("ab", "character"))
|
||||
|
||||
|
||||
# check cross table reference
|
||||
expect_true(all(microorganisms.codes$mo %in% microorganisms$mo))
|
||||
expect_true(all(example_isolates$mo %in% microorganisms$mo))
|
||||
|
@ -24,14 +24,14 @@
|
||||
# ==================================================================== #
|
||||
|
||||
# thoroughly check input table
|
||||
expect_equal(colnames(AMR:::eucast_rules_file),
|
||||
expect_equal(colnames(AMR:::EUCAST_RULES_DF),
|
||||
c("if_mo_property", "like.is.one_of", "this_value",
|
||||
"and_these_antibiotics", "have_these_values",
|
||||
"then_change_these_antibiotics", "to_value",
|
||||
"reference.rule", "reference.rule_group",
|
||||
"reference.version",
|
||||
"note"))
|
||||
MOs_mentioned <- unique(AMR:::eucast_rules_file$this_value)
|
||||
MOs_mentioned <- unique(AMR:::EUCAST_RULES_DF$this_value)
|
||||
MOs_mentioned <- sort(AMR:::trimws(unlist(strsplit(MOs_mentioned[!AMR:::is_valid_regex(MOs_mentioned)], ",", fixed = TRUE))))
|
||||
MOs_test <- suppressWarnings(suppressMessages(mo_name(MOs_mentioned)))
|
||||
expect_true(length(MOs_mentioned[MOs_test != MOs_mentioned]) == 0)
|
||||
|
@ -24,7 +24,7 @@
|
||||
# ==================================================================== #
|
||||
|
||||
# Check if these function still exist in the package (all are in Suggests field)
|
||||
# Since GitHub Action runs every night, we will get emailed when a dependency fails based on this unit test
|
||||
# Since GitHub Actions runs every night, we will get emailed when a dependency fails based on this unit test
|
||||
# functions used by import_fn()
|
||||
import_functions <- c(
|
||||
"anti_join" = "dplyr",
|
||||
@ -53,14 +53,23 @@ call_functions <- c(
|
||||
# skimr
|
||||
"inline_hist" = "skimr",
|
||||
"sfl" = "skimr",
|
||||
# set_mo_source
|
||||
# readxl
|
||||
"read_excel" = "readxl",
|
||||
# ggplot_rsi
|
||||
# ggplot2
|
||||
"aes" = "ggplot2",
|
||||
"aes_string" = "ggplot2",
|
||||
"arrow" = "ggplot2",
|
||||
"autoplot" = "ggplot2",
|
||||
"element_blank" = "ggplot2",
|
||||
"element_line" = "ggplot2",
|
||||
"element_text" = "ggplot2",
|
||||
"expand_limits" = "ggplot2",
|
||||
"facet_wrap" = "ggplot2",
|
||||
"geom_errorbar" = "ggplot2",
|
||||
"geom_path" = "ggplot2",
|
||||
"geom_point" = "ggplot2",
|
||||
"geom_ribbon" = "ggplot2",
|
||||
"geom_segment" = "ggplot2",
|
||||
"geom_text" = "ggplot2",
|
||||
"ggplot" = "ggplot2",
|
||||
"labs" = "ggplot2",
|
||||
@ -70,31 +79,9 @@ call_functions <- c(
|
||||
"scale_y_continuous" = "ggplot2",
|
||||
"theme" = "ggplot2",
|
||||
"theme_minimal" = "ggplot2",
|
||||
# ggplot_pca
|
||||
"aes" = "ggplot2",
|
||||
"arrow" = "ggplot2",
|
||||
"element_blank" = "ggplot2",
|
||||
"element_line" = "ggplot2",
|
||||
"element_text" = "ggplot2",
|
||||
"expand_limits" = "ggplot2",
|
||||
"geom_path" = "ggplot2",
|
||||
"geom_point" = "ggplot2",
|
||||
"geom_segment" = "ggplot2",
|
||||
"geom_text" = "ggplot2",
|
||||
"ggplot" = "ggplot2",
|
||||
"labs" = "ggplot2",
|
||||
"theme" = "ggplot2",
|
||||
"theme_minimal" = "ggplot2",
|
||||
"unit" = "ggplot2",
|
||||
"xlab" = "ggplot2",
|
||||
"ylab" = "ggplot2",
|
||||
# resistance_predict
|
||||
"aes" = "ggplot2",
|
||||
"geom_errorbar" = "ggplot2",
|
||||
"geom_point" = "ggplot2",
|
||||
"geom_ribbon" = "ggplot2",
|
||||
"ggplot" = "ggplot2",
|
||||
"labs" = "ggplot2"
|
||||
"ylab" = "ggplot2"
|
||||
)
|
||||
|
||||
import_functions <- c(import_functions, call_functions)
|
||||
|
@ -50,7 +50,7 @@ For suggestions, comments or questions, please contact us at:
|
||||
Matthijs S. Berends \cr
|
||||
m.s.berends [at] umcg [dot] nl \cr
|
||||
University of Groningen
|
||||
Department of Medical Microbiology and Infection Prevention
|
||||
Department of Medical Microbiology and Infection Prevention \cr
|
||||
University Medical Center Groningen \cr
|
||||
Post Office Box 30001 \cr
|
||||
9700 RB Groningen \cr
|
||||
|
@ -4,6 +4,7 @@
|
||||
\alias{antibiotic_class_selectors}
|
||||
\alias{ab_class}
|
||||
\alias{aminoglycosides}
|
||||
\alias{aminopenicillins}
|
||||
\alias{betalactams}
|
||||
\alias{carbapenems}
|
||||
\alias{cephalosporins}
|
||||
@ -14,16 +15,24 @@
|
||||
\alias{cephalosporins_5th}
|
||||
\alias{fluoroquinolones}
|
||||
\alias{glycopeptides}
|
||||
\alias{lincosamides}
|
||||
\alias{lipoglycopeptides}
|
||||
\alias{macrolides}
|
||||
\alias{oxazolidinones}
|
||||
\alias{penicillins}
|
||||
\alias{polymyxins}
|
||||
\alias{streptogramins}
|
||||
\alias{quinolones}
|
||||
\alias{tetracyclines}
|
||||
\alias{ureidopenicillins}
|
||||
\title{Antibiotic Class Selectors}
|
||||
\usage{
|
||||
ab_class(ab_class, only_rsi_columns = FALSE)
|
||||
|
||||
aminoglycosides(only_rsi_columns = FALSE)
|
||||
|
||||
aminopenicillins(only_rsi_columns = FALSE)
|
||||
|
||||
betalactams(only_rsi_columns = FALSE)
|
||||
|
||||
carbapenems(only_rsi_columns = FALSE)
|
||||
@ -44,13 +53,25 @@ fluoroquinolones(only_rsi_columns = FALSE)
|
||||
|
||||
glycopeptides(only_rsi_columns = FALSE)
|
||||
|
||||
lincosamides(only_rsi_columns = FALSE)
|
||||
|
||||
lipoglycopeptides(only_rsi_columns = FALSE)
|
||||
|
||||
macrolides(only_rsi_columns = FALSE)
|
||||
|
||||
oxazolidinones(only_rsi_columns = FALSE)
|
||||
|
||||
penicillins(only_rsi_columns = FALSE)
|
||||
|
||||
polymyxins(only_rsi_columns = FALSE)
|
||||
|
||||
streptogramins(only_rsi_columns = FALSE)
|
||||
|
||||
quinolones(only_rsi_columns = FALSE)
|
||||
|
||||
tetracyclines(only_rsi_columns = FALSE)
|
||||
|
||||
ureidopenicillins(only_rsi_columns = FALSE)
|
||||
}
|
||||
\arguments{
|
||||
\item{ab_class}{an antimicrobial class, such as \code{"carbapenems"}. The columns \code{group}, \code{atc_group1} and \code{atc_group2} of the \link{antibiotics} data set will be searched (case-insensitive) for this value.}
|
||||
@ -58,17 +79,41 @@ tetracyclines(only_rsi_columns = FALSE)
|
||||
\item{only_rsi_columns}{a \link{logical} to indicate whether only columns of class \verb{<rsi>} must be selected (defaults to \code{FALSE}), see \code{\link[=as.rsi]{as.rsi()}}}
|
||||
}
|
||||
\description{
|
||||
These functions help to filter and select columns with antibiotic test results that are of a specific antibiotic class, without the need to define the columns or antibiotic abbreviations. \strong{\Sexpr{ifelse(getRversion() < "3.2", paste0("NOTE: THESE FUNCTIONS DO NOT WORK ON YOUR CURRENT R VERSION. These functions require R version 3.2 or later - you have ", R.version.string, "."), "")}}
|
||||
These functions allow for filtering rows and selecting columns based on antibiotic test results that are of a specific antibiotic class, without the need to define the columns or antibiotic abbreviations.
|
||||
}
|
||||
\details{
|
||||
\strong{\Sexpr{ifelse(getRversion() < "3.2", paste0("NOTE: THESE FUNCTIONS DO NOT WORK ON YOUR CURRENT R VERSION. These functions require R version 3.2 or later - you have ", R.version.string, "."), "")}}
|
||||
These functions can be used in data set calls for selecting columns and filtering rows. They are heavily inspired by the \href{https://tidyselect.r-lib.org/reference/language.html}{Tidyverse selection helpers}, but also work in base \R and not only in \code{dplyr} verbs. Nonetheless, they are very convenient to use with \code{dplyr} functions such as \code{\link[dplyr:select]{select()}}, \code{\link[dplyr:filter]{filter()}} and \code{\link[dplyr:summarise]{summarise()}}, see \emph{Examples}.
|
||||
|
||||
These functions can be used in data set calls for selecting columns and filtering rows, see \emph{Examples}. They support base R, but work more convenient in dplyr functions such as \code{\link[dplyr:select]{select()}}, \code{\link[dplyr:filter]{filter()}} and \code{\link[dplyr:summarise]{summarise()}}.
|
||||
|
||||
All columns in the data in which these functions are called will be searched for known antibiotic names, abbreviations, brand names, and codes (ATC, EARS-Net, WHO, etc.) in the \link{antibiotics} data set. This means that a selector like e.g. \code{\link[=aminoglycosides]{aminoglycosides()}} will pick up column names like 'gen', 'genta', 'J01GB03', 'tobra', 'Tobracin', etc.
|
||||
|
||||
The group of betalactams consists of all carbapenems, cephalosporins and penicillins.
|
||||
All columns in the data in which these functions are called will be searched for known antibiotic names, abbreviations, brand names, and codes (ATC, EARS-Net, WHO, etc.) in the \link{antibiotics} data set. This means that a selector such as \code{\link[=aminoglycosides]{aminoglycosides()}} will pick up column names like 'gen', 'genta', 'J01GB03', 'tobra', 'Tobracin', etc. Use the \code{\link[=ab_class]{ab_class()}} function to filter/select on a manually defined antibiotic class.
|
||||
}
|
||||
\section{Full list of supported agents}{
|
||||
|
||||
\itemize{
|
||||
\item \code{aminoglycosides()} can select amikacin (AMK), amikacin/fosfomycin (AKF), amphotericin B-high (AMH), apramycin (APR), arbekacin (ARB), astromicin (AST), bekanamycin (BEK), dibekacin (DKB), framycetin (FRM), gentamicin (GEN), gentamicin-high (GEH), habekacin (HAB), hygromycin (HYG), isepamicin (ISE), kanamycin (KAN), kanamycin-high (KAH), kanamycin/cephalexin (KAC), micronomicin (MCR), neomycin (NEO), netilmicin (NET), pentisomicin (PIM), plazomicin (PLZ), propikacin (PKA), ribostamycin (RST), sisomicin (SIS), streptoduocin (STR), streptomycin (STR1), streptomycin-high (STH), tobramycin (TOB) and tobramycin-high (TOH)
|
||||
\item \code{aminopenicillins()} can select amoxicillin (AMX) and ampicillin (AMP)
|
||||
\item \code{betalactams()} can select amoxicillin (AMX), amoxicillin/clavulanic acid (AMC), amoxicillin/sulbactam (AXS), ampicillin (AMP), ampicillin/sulbactam (SAM), apalcillin (APL), aspoxicillin (APX), avibactam (AVB), azidocillin (AZD), azlocillin (AZL), aztreonam (ATM), aztreonam/avibactam (AZA), bacampicillin (BAM), benzathine benzylpenicillin (BNB), benzathine phenoxymethylpenicillin (BNP), benzylpenicillin (PEN), biapenem (BIA), carbenicillin (CRB), carindacillin (CRN), cefacetrile (CAC), cefaclor (CEC), cefadroxil (CFR), cefaloridine (RID), cefamandole (MAN), cefatrizine (CTZ), cefazedone (CZD), cefazolin (CZO), cefcapene (CCP), cefcapene pivoxil (CCX), cefdinir (CDR), cefditoren (DIT), cefditoren pivoxil (DIX), cefepime (FEP), cefepime/clavulanic acid (CPC), cefepime/tazobactam (FPT), cefetamet (CAT), cefetamet pivoxil (CPI), cefetecol (Cefcatacol) (CCL), cefetrizole (CZL), cefixime (CFM), cefmenoxime (CMX), cefmetazole (CMZ), cefodizime (DIZ), cefonicid (CID), cefoperazone (CFP), cefoperazone/sulbactam (CSL), ceforanide (CND), cefoselis (CSE), cefotaxime (CTX), cefotaxime/clavulanic acid (CTC), cefotaxime/sulbactam (CTS), cefotetan (CTT), cefotiam (CTF), cefotiam hexetil (CHE), cefovecin (FOV), cefoxitin (FOX), cefoxitin screening (FOX1), cefozopran (ZOP), cefpimizole (CFZ), cefpiramide (CPM), cefpirome (CPO), cefpodoxime (CPD), cefpodoxime proxetil (CPX), cefpodoxime/clavulanic acid (CDC), cefprozil (CPR), cefquinome (CEQ), cefroxadine (CRD), cefsulodin (CFS), cefsumide (CSU), ceftaroline (CPT), ceftaroline/avibactam (CPA), ceftazidime (CAZ), ceftazidime/avibactam (CZA), ceftazidime/clavulanic acid (CCV), cefteram (CEM), cefteram pivoxil (CPL), ceftezole (CTL), ceftibuten (CTB), ceftiofur (TIO), ceftizoxime (CZX), ceftizoxime alapivoxil (CZP), ceftobiprole (BPR), ceftobiprole medocaril (CFM1), ceftolozane/enzyme inhibitor (CEI), ceftolozane/tazobactam (CZT), ceftriaxone (CRO), cefuroxime (CXM), cefuroxime axetil (CXA), cephalexin (LEX), cephalothin (CEP), cephapirin (HAP), cephradine (CED), ciclacillin (CIC), clometocillin (CLM), cloxacillin (CLO), dicloxacillin (DIC), doripenem (DOR), epicillin (EPC), ertapenem (ETP), flucloxacillin (FLC), hetacillin (HET), imipenem (IPM), imipenem/EDTA (IPE), imipenem/relebactam (IMR), latamoxef (LTM), lenampicillin (LEN), loracarbef (LOR), mecillinam (Amdinocillin) (MEC), meropenem (MEM), meropenem/nacubactam (MNC), meropenem/vaborbactam (MEV), metampicillin (MTM), methicillin (MET), mezlocillin (MEZ), mezlocillin/sulbactam (MSU), nacubactam (NAC), nafcillin (NAF), oxacillin (OXA), panipenem (PAN), penamecillin (PNM), penicillin/novobiocin (PNO), penicillin/sulbactam (PSU), phenethicillin (PHE), phenoxymethylpenicillin (PHN), piperacillin (PIP), piperacillin/sulbactam (PIS), piperacillin/tazobactam (TZP), piridicillin (PRC), pivampicillin (PVM), pivmecillinam (PME), procaine benzylpenicillin (PRB), propicillin (PRP), razupenem (RZM), ritipenem (RIT), ritipenem acoxil (RIA), sarmoxicillin (SRX), sulbactam (SUL), sulbenicillin (SBC), sultamicillin (SLT6), talampicillin (TAL), tazobactam (TAZ), tebipenem (TBP), temocillin (TEM), ticarcillin (TIC) and ticarcillin/clavulanic acid (TCC)
|
||||
\item \code{carbapenems()} can select biapenem (BIA), doripenem (DOR), ertapenem (ETP), imipenem (IPM), imipenem/EDTA (IPE), imipenem/relebactam (IMR), meropenem (MEM), meropenem/nacubactam (MNC), meropenem/vaborbactam (MEV), panipenem (PAN), razupenem (RZM), ritipenem (RIT), ritipenem acoxil (RIA) and tebipenem (TBP)
|
||||
\item \code{cephalosporins()} can select cefacetrile (CAC), cefaclor (CEC), cefadroxil (CFR), cefaloridine (RID), cefamandole (MAN), cefatrizine (CTZ), cefazedone (CZD), cefazolin (CZO), cefcapene (CCP), cefcapene pivoxil (CCX), cefdinir (CDR), cefditoren (DIT), cefditoren pivoxil (DIX), cefepime (FEP), cefepime/clavulanic acid (CPC), cefepime/tazobactam (FPT), cefetamet (CAT), cefetamet pivoxil (CPI), cefetecol (Cefcatacol) (CCL), cefetrizole (CZL), cefixime (CFM), cefmenoxime (CMX), cefmetazole (CMZ), cefodizime (DIZ), cefonicid (CID), cefoperazone (CFP), cefoperazone/sulbactam (CSL), ceforanide (CND), cefoselis (CSE), cefotaxime (CTX), cefotaxime/clavulanic acid (CTC), cefotaxime/sulbactam (CTS), cefotetan (CTT), cefotiam (CTF), cefotiam hexetil (CHE), cefovecin (FOV), cefoxitin (FOX), cefoxitin screening (FOX1), cefozopran (ZOP), cefpimizole (CFZ), cefpiramide (CPM), cefpirome (CPO), cefpodoxime (CPD), cefpodoxime proxetil (CPX), cefpodoxime/clavulanic acid (CDC), cefprozil (CPR), cefquinome (CEQ), cefroxadine (CRD), cefsulodin (CFS), cefsumide (CSU), ceftaroline (CPT), ceftaroline/avibactam (CPA), ceftazidime (CAZ), ceftazidime/avibactam (CZA), ceftazidime/clavulanic acid (CCV), cefteram (CEM), cefteram pivoxil (CPL), ceftezole (CTL), ceftibuten (CTB), ceftiofur (TIO), ceftizoxime (CZX), ceftizoxime alapivoxil (CZP), ceftobiprole (BPR), ceftobiprole medocaril (CFM1), ceftolozane/enzyme inhibitor (CEI), ceftolozane/tazobactam (CZT), ceftriaxone (CRO), cefuroxime (CXM), cefuroxime axetil (CXA), cephalexin (LEX), cephalothin (CEP), cephapirin (HAP), cephradine (CED), latamoxef (LTM) and loracarbef (LOR)
|
||||
\item \code{cephalosporins_1st()} can select cefacetrile (CAC), cefadroxil (CFR), cefaloridine (RID), cefatrizine (CTZ), cefazedone (CZD), cefazolin (CZO), cefroxadine (CRD), ceftezole (CTL), cephalexin (LEX), cephalothin (CEP), cephapirin (HAP) and cephradine (CED)
|
||||
\item \code{cephalosporins_2nd()} can select cefaclor (CEC), cefamandole (MAN), cefmetazole (CMZ), cefonicid (CID), ceforanide (CND), cefotetan (CTT), cefotiam (CTF), cefoxitin (FOX), cefoxitin screening (FOX1), cefprozil (CPR), cefuroxime (CXM), cefuroxime axetil (CXA) and loracarbef (LOR)
|
||||
\item \code{cephalosporins_3rd()} can select cefcapene (CCP), cefcapene pivoxil (CCX), cefdinir (CDR), cefditoren (DIT), cefditoren pivoxil (DIX), cefetamet (CAT), cefetamet pivoxil (CPI), cefixime (CFM), cefmenoxime (CMX), cefodizime (DIZ), cefoperazone (CFP), cefoperazone/sulbactam (CSL), cefotaxime (CTX), cefotaxime/clavulanic acid (CTC), cefotaxime/sulbactam (CTS), cefotiam hexetil (CHE), cefovecin (FOV), cefpimizole (CFZ), cefpiramide (CPM), cefpodoxime (CPD), cefpodoxime proxetil (CPX), cefpodoxime/clavulanic acid (CDC), cefsulodin (CFS), ceftazidime (CAZ), ceftazidime/avibactam (CZA), ceftazidime/clavulanic acid (CCV), cefteram (CEM), cefteram pivoxil (CPL), ceftibuten (CTB), ceftiofur (TIO), ceftizoxime (CZX), ceftizoxime alapivoxil (CZP), ceftriaxone (CRO) and latamoxef (LTM)
|
||||
\item \code{cephalosporins_4th()} can select cefepime (FEP), cefepime/clavulanic acid (CPC), cefepime/tazobactam (FPT), cefetecol (Cefcatacol) (CCL), cefoselis (CSE), cefozopran (ZOP), cefpirome (CPO) and cefquinome (CEQ)
|
||||
\item \code{cephalosporins_5th()} can select ceftaroline (CPT), ceftaroline/avibactam (CPA), ceftobiprole (BPR), ceftobiprole medocaril (CFM1), ceftolozane/enzyme inhibitor (CEI) and ceftolozane/tazobactam (CZT)
|
||||
\item \code{fluoroquinolones()} can select besifloxacin (BES), ciprofloxacin (CIP), clinafloxacin (CLX), danofloxacin (DAN), delafloxacin (DFX), difloxacin (DIF), enoxacin (ENX), enrofloxacin (ENR), finafloxacin (FIN), fleroxacin (FLE), garenoxacin (GRN), gatifloxacin (GAT), gemifloxacin (GEM), grepafloxacin (GRX), levofloxacin (LVX), levonadifloxacin (LND), lomefloxacin (LOM), marbofloxacin (MAR), metioxate (MXT), miloxacin (MIL), moxifloxacin (MFX), nadifloxacin (NAD), nifuroquine (NIF), norfloxacin (NOR), ofloxacin (OFX), orbifloxacin (ORB), pazufloxacin (PAZ), pefloxacin (PEF), pradofloxacin (PRA), premafloxacin (PRX), prulifloxacin (PRU), rufloxacin (RFL), sarafloxacin (SAR), sitafloxacin (SIT), sparfloxacin (SPX), temafloxacin (TMX), tilbroquinol (TBQ), tioxacin (TXC), tosufloxacin (TFX) and trovafloxacin (TVA)
|
||||
\item \code{glycopeptides()} can select avoparcin (AVO), dalbavancin (DAL), norvancomycin (NVA), oritavancin (ORI), ramoplanin (RAM), teicoplanin (TEC), teicoplanin-macromethod (TCM), telavancin (TLV), vancomycin (VAN) and vancomycin-macromethod (VAM)
|
||||
\item \code{lincosamides()} can select acetylmidecamycin (ACM), acetylspiramycin (ASP), clindamycin (CLI), gamithromycin (GAM), kitasamycin (Leucomycin) (KIT), lincomycin (LIN), meleumycin (MEL), nafithromycin (ZWK), pirlimycin (PRL), primycin (PRM), solithromycin (SOL), tildipirosin (TIP), tilmicosin (TIL), tulathromycin (TUL), tylosin (TYL) and tylvalosin (TYL1)
|
||||
\item \code{lipoglycopeptides()} can select dalbavancin (DAL), oritavancin (ORI) and telavancin (TLV)
|
||||
\item \code{macrolides()} can select acetylmidecamycin (ACM), acetylspiramycin (ASP), azithromycin (AZM), clarithromycin (CLR), dirithromycin (DIR), erythromycin (ERY), flurithromycin (FLR1), gamithromycin (GAM), josamycin (JOS), kitasamycin (Leucomycin) (KIT), meleumycin (MEL), midecamycin (MID), miocamycin (MCM), nafithromycin (ZWK), oleandomycin (OLE), pirlimycin (PRL), primycin (PRM), rokitamycin (ROK), roxithromycin (RXT), solithromycin (SOL), spiramycin (SPI), telithromycin (TLT), tildipirosin (TIP), tilmicosin (TIL), troleandomycin (TRL), tulathromycin (TUL), tylosin (TYL) and tylvalosin (TYL1)
|
||||
\item \code{oxazolidinones()} can select cadazolid (CDZ), cycloserine (CYC), linezolid (LNZ), tedizolid (TZD) and thiacetazone (THA)
|
||||
\item \code{penicillins()} can select amoxicillin (AMX), amoxicillin/clavulanic acid (AMC), amoxicillin/sulbactam (AXS), ampicillin (AMP), ampicillin/sulbactam (SAM), apalcillin (APL), aspoxicillin (APX), avibactam (AVB), azidocillin (AZD), azlocillin (AZL), aztreonam (ATM), aztreonam/avibactam (AZA), bacampicillin (BAM), benzathine benzylpenicillin (BNB), benzathine phenoxymethylpenicillin (BNP), benzylpenicillin (PEN), carbenicillin (CRB), carindacillin (CRN), ciclacillin (CIC), clometocillin (CLM), cloxacillin (CLO), dicloxacillin (DIC), epicillin (EPC), flucloxacillin (FLC), hetacillin (HET), lenampicillin (LEN), mecillinam (Amdinocillin) (MEC), metampicillin (MTM), methicillin (MET), mezlocillin (MEZ), mezlocillin/sulbactam (MSU), nacubactam (NAC), nafcillin (NAF), oxacillin (OXA), penamecillin (PNM), penicillin/novobiocin (PNO), penicillin/sulbactam (PSU), phenethicillin (PHE), phenoxymethylpenicillin (PHN), piperacillin (PIP), piperacillin/sulbactam (PIS), piperacillin/tazobactam (TZP), piridicillin (PRC), pivampicillin (PVM), pivmecillinam (PME), procaine benzylpenicillin (PRB), propicillin (PRP), sarmoxicillin (SRX), sulbactam (SUL), sulbenicillin (SBC), sultamicillin (SLT6), talampicillin (TAL), tazobactam (TAZ), temocillin (TEM), ticarcillin (TIC) and ticarcillin/clavulanic acid (TCC)
|
||||
\item \code{polymyxins()} can select colistin (COL), polymyxin B (PLB) and polymyxin B/polysorbate 80 (POP)
|
||||
\item \code{streptogramins()} can select pristinamycin (PRI) and quinupristin/dalfopristin (QDA)
|
||||
\item \code{quinolones()} can select besifloxacin (BES), cinoxacin (CIN), ciprofloxacin (CIP), clinafloxacin (CLX), danofloxacin (DAN), delafloxacin (DFX), difloxacin (DIF), enoxacin (ENX), enrofloxacin (ENR), finafloxacin (FIN), fleroxacin (FLE), flumequine (FLM), garenoxacin (GRN), gatifloxacin (GAT), gemifloxacin (GEM), grepafloxacin (GRX), levofloxacin (LVX), levonadifloxacin (LND), lomefloxacin (LOM), marbofloxacin (MAR), metioxate (MXT), miloxacin (MIL), moxifloxacin (MFX), nadifloxacin (NAD), nalidixic acid (NAL), nifuroquine (NIF), nitroxoline (NTR), norfloxacin (NOR), ofloxacin (OFX), orbifloxacin (ORB), oxolinic acid (OXO), pazufloxacin (PAZ), pefloxacin (PEF), pipemidic acid (PPA), piromidic acid (PIR), pradofloxacin (PRA), premafloxacin (PRX), prulifloxacin (PRU), rosoxacin (ROS), rufloxacin (RFL), sarafloxacin (SAR), sitafloxacin (SIT), sparfloxacin (SPX), temafloxacin (TMX), tilbroquinol (TBQ), tioxacin (TXC), tosufloxacin (TFX) and trovafloxacin (TVA)
|
||||
\item \code{tetracyclines()} can select cetocycline (CTO), chlortetracycline (CTE), clomocycline (CLM1), demeclocycline (DEM), doxycycline (DOX), eravacycline (ERV), lymecycline (LYM), metacycline (MTC), minocycline (MNO), omadacycline (OMC), oxytetracycline (OXY), penimepicycline (PNM1), rolitetracycline (RLT), tetracycline (TCY) and tigecycline (TGC)
|
||||
\item \code{ureidopenicillins()} can select azlocillin (AZL), mezlocillin (MEZ), piperacillin (PIP) and piperacillin/tazobactam (TZP)
|
||||
}
|
||||
}
|
||||
|
||||
\section{Stable Lifecycle}{
|
||||
|
||||
\if{html}{\figure{lifecycle_stable.svg}{options: style=margin-bottom:5px} \cr}
|
||||
@ -91,7 +136,7 @@ On our website \url{https://msberends.github.io/AMR/} you can find \href{https:/
|
||||
# `example_isolates` is a data set available in the AMR package.
|
||||
# See ?example_isolates.
|
||||
|
||||
# Base R ------------------------------------------------------------------
|
||||
# base R ------------------------------------------------------------------
|
||||
|
||||
# select columns 'IPM' (imipenem) and 'MEM' (meropenem)
|
||||
example_isolates[, carbapenems()]
|
||||
@ -149,7 +194,6 @@ if (require("dplyr")) {
|
||||
example_isolates \%>\%
|
||||
select(mo, ab_class("mycobact"))
|
||||
|
||||
|
||||
# get bug/drug combinations for only macrolides in Gram-positives:
|
||||
example_isolates \%>\%
|
||||
filter(mo_is_gram_positive()) \%>\%
|
||||
@ -157,14 +201,12 @@ if (require("dplyr")) {
|
||||
bug_drug_combinations() \%>\%
|
||||
format()
|
||||
|
||||
|
||||
data.frame(some_column = "some_value",
|
||||
J01CA01 = "S") \%>\% # ATC code of ampicillin
|
||||
select(penicillins()) # only the 'J01CA01' column will be selected
|
||||
|
||||
|
||||
# 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[carbapenems() == "R", ]
|
||||
example_isolates \%>\% filter(carbapenems() == "R")
|
||||
example_isolates \%>\% filter(across(carbapenems(), ~.x == "R"))
|
||||
|
@ -168,6 +168,12 @@ if (require("dplyr")) {
|
||||
n2 = n_rsi(CIP), # same - analogous to n_distinct
|
||||
total = n()) # NOT the number of tested isolates!
|
||||
|
||||
# Number of available isolates for a whole antibiotic class
|
||||
# (i.e., in this data set columns GEN, TOB, AMK, KAN)
|
||||
example_isolates \%>\%
|
||||
group_by(hospital_id) \%>\%
|
||||
summarise(across(aminoglycosides(), n_rsi))
|
||||
|
||||
# Count co-resistance between amoxicillin/clav acid and gentamicin,
|
||||
# so we can see that combination therapy does a lot more than mono therapy.
|
||||
# Please mind that `susceptibility()` calculates percentages right away instead.
|
||||
|
@ -70,25 +70,28 @@ It is possible to define antibiotic groups instead of single antibiotics for the
|
||||
\itemize{
|
||||
\item \code{aminoglycosides}\cr(amikacin, amikacin/fosfomycin, amphotericin B-high, apramycin, arbekacin, astromicin, bekanamycin, dibekacin, framycetin, gentamicin, gentamicin-high, habekacin, hygromycin, isepamicin, kanamycin, kanamycin-high, kanamycin/cephalexin, micronomicin, neomycin, netilmicin, pentisomicin, plazomicin, propikacin, ribostamycin, sisomicin, streptoduocin, streptomycin, streptomycin-high, tobramycin, tobramycin-high)
|
||||
\item \code{aminopenicillins}\cr(amoxicillin, ampicillin)
|
||||
\item \code{betalactams}\cr(amoxicillin, amoxicillin/clavulanic acid, amoxicillin/sulbactam, ampicillin, ampicillin/sulbactam, apalcillin, aspoxicillin, avibactam, azidocillin, azlocillin, aztreonam, aztreonam/avibactam, bacampicillin, benzathine benzylpenicillin, benzathine phenoxymethylpenicillin, benzylpenicillin, biapenem, cadazolid, carbenicillin, carindacillin, cefacetrile, cefaclor, cefadroxil, cefaloridine, cefamandole, cefatrizine, cefazedone, cefazolin, cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime, cefepime/clavulanic acid, cefepime/tazobactam, cefetamet, cefetamet pivoxil, cefetecol (Cefcatacol), cefetrizole, cefixime, cefmenoxime, cefmetazole, cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam, ceforanide, cefoselis, cefotaxime, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam, cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening, cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil, cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline, ceftaroline/avibactam, ceftazidime, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftobiprole, ceftobiprole medocaril, ceftolozane/enzyme inhibitor, ceftolozane/tazobactam, ceftriaxone, cefuroxime, cefuroxime axetil, cephalexin, cephalothin, cephapirin, cephradine, ciclacillin, clometocillin, cloxacillin, dicloxacillin, doripenem, epicillin, ertapenem, flucloxacillin, hetacillin, imipenem, imipenem/EDTA, imipenem/relebactam, latamoxef, lenampicillin, loracarbef, mecillinam (Amdinocillin), meropenem, meropenem/nacubactam, meropenem/vaborbactam, metampicillin, methicillin, mezlocillin, mezlocillin/sulbactam, nacubactam, nafcillin, oxacillin, panipenem, penamecillin, penicillin/novobiocin, penicillin/sulbactam, phenethicillin, phenoxymethylpenicillin, piperacillin, piperacillin/sulbactam, piperacillin/tazobactam, piridicillin, pivampicillin, pivmecillinam, procaine benzylpenicillin, propicillin, razupenem, ritipenem, ritipenem acoxil, sarmoxicillin, sulbactam, sulbenicillin, sultamicillin, talampicillin, tazobactam, tebipenem, temocillin, ticarcillin, ticarcillin/clavulanic acid)
|
||||
\item \code{betalactams}\cr(amoxicillin, amoxicillin/clavulanic acid, amoxicillin/sulbactam, ampicillin, ampicillin/sulbactam, apalcillin, aspoxicillin, avibactam, azidocillin, azlocillin, aztreonam, aztreonam/avibactam, bacampicillin, benzathine benzylpenicillin, benzathine phenoxymethylpenicillin, benzylpenicillin, biapenem, carbenicillin, carindacillin, cefacetrile, cefaclor, cefadroxil, cefaloridine, cefamandole, cefatrizine, cefazedone, cefazolin, cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime, cefepime/clavulanic acid, cefepime/tazobactam, cefetamet, cefetamet pivoxil, cefetecol (Cefcatacol), cefetrizole, cefixime, cefmenoxime, cefmetazole, cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam, ceforanide, cefoselis, cefotaxime, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam, cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening, cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil, cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline, ceftaroline/avibactam, ceftazidime, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftobiprole, ceftobiprole medocaril, ceftolozane/enzyme inhibitor, ceftolozane/tazobactam, ceftriaxone, cefuroxime, cefuroxime axetil, cephalexin, cephalothin, cephapirin, cephradine, ciclacillin, clometocillin, cloxacillin, dicloxacillin, doripenem, epicillin, ertapenem, flucloxacillin, hetacillin, imipenem, imipenem/EDTA, imipenem/relebactam, latamoxef, lenampicillin, loracarbef, mecillinam (Amdinocillin), meropenem, meropenem/nacubactam, meropenem/vaborbactam, metampicillin, methicillin, mezlocillin, mezlocillin/sulbactam, nacubactam, nafcillin, oxacillin, panipenem, penamecillin, penicillin/novobiocin, penicillin/sulbactam, phenethicillin, phenoxymethylpenicillin, piperacillin, piperacillin/sulbactam, piperacillin/tazobactam, piridicillin, pivampicillin, pivmecillinam, procaine benzylpenicillin, propicillin, razupenem, ritipenem, ritipenem acoxil, sarmoxicillin, sulbactam, sulbenicillin, sultamicillin, talampicillin, tazobactam, tebipenem, temocillin, ticarcillin, ticarcillin/clavulanic acid)
|
||||
\item \code{carbapenems}\cr(biapenem, doripenem, ertapenem, imipenem, imipenem/EDTA, imipenem/relebactam, meropenem, meropenem/nacubactam, meropenem/vaborbactam, panipenem, razupenem, ritipenem, ritipenem acoxil, tebipenem)
|
||||
\item \code{cephalosporins}\cr(cadazolid, cefacetrile, cefaclor, cefadroxil, cefaloridine, cefamandole, cefatrizine, cefazedone, cefazolin, cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime, cefepime/clavulanic acid, cefepime/tazobactam, cefetamet, cefetamet pivoxil, cefetecol (Cefcatacol), cefetrizole, cefixime, cefmenoxime, cefmetazole, cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam, ceforanide, cefoselis, cefotaxime, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam, cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening, cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil, cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline, ceftaroline/avibactam, ceftazidime, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftobiprole, ceftobiprole medocaril, ceftolozane/enzyme inhibitor, ceftolozane/tazobactam, ceftriaxone, cefuroxime, cefuroxime axetil, cephalexin, cephalothin, cephapirin, cephradine, latamoxef, loracarbef)
|
||||
\item \code{cephalosporins}\cr(cefacetrile, cefaclor, cefadroxil, cefaloridine, cefamandole, cefatrizine, cefazedone, cefazolin, cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime, cefepime/clavulanic acid, cefepime/tazobactam, cefetamet, cefetamet pivoxil, cefetecol (Cefcatacol), cefetrizole, cefixime, cefmenoxime, cefmetazole, cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam, ceforanide, cefoselis, cefotaxime, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam, cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening, cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil, cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline, ceftaroline/avibactam, ceftazidime, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftobiprole, ceftobiprole medocaril, ceftolozane/enzyme inhibitor, ceftolozane/tazobactam, ceftriaxone, cefuroxime, cefuroxime axetil, cephalexin, cephalothin, cephapirin, cephradine, latamoxef, loracarbef)
|
||||
\item \code{cephalosporins_1st}\cr(cefacetrile, cefadroxil, cefaloridine, cefatrizine, cefazedone, cefazolin, cefroxadine, ceftezole, cephalexin, cephalothin, cephapirin, cephradine)
|
||||
\item \code{cephalosporins_2nd}\cr(cefaclor, cefamandole, cefmetazole, cefonicid, ceforanide, cefotetan, cefotiam, cefoxitin, cefoxitin screening, cefprozil, cefuroxime, cefuroxime axetil, loracarbef)
|
||||
\item \code{cephalosporins_3rd}\cr(cadazolid, cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefetamet, cefetamet pivoxil, cefixime, cefmenoxime, cefodizime, cefoperazone, cefoperazone/sulbactam, cefotaxime, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotiam hexetil, cefovecin, cefpimizole, cefpiramide, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefsulodin, ceftazidime, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftriaxone, latamoxef)
|
||||
\item \code{cephalosporins_except_caz}\cr(cadazolid, cefacetrile, cefaclor, cefadroxil, cefaloridine, cefamandole, cefatrizine, cefazedone, cefazolin, cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime, cefepime/clavulanic acid, cefepime/tazobactam, cefetamet, cefetamet pivoxil, cefetecol (Cefcatacol), cefetrizole, cefixime, cefmenoxime, cefmetazole, cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam, ceforanide, cefoselis, cefotaxime, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam, cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening, cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil, cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline, ceftaroline/avibactam, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftobiprole, ceftobiprole medocaril, ceftolozane/enzyme inhibitor, ceftolozane/tazobactam, ceftriaxone, cefuroxime, cefuroxime axetil, cephalexin, cephalothin, cephapirin, cephradine, latamoxef, loracarbef)
|
||||
\item \code{fluoroquinolones}\cr(ciprofloxacin, enoxacin, fleroxacin, gatifloxacin, gemifloxacin, grepafloxacin, levofloxacin, lomefloxacin, moxifloxacin, norfloxacin, ofloxacin, pazufloxacin, pefloxacin, prulifloxacin, rufloxacin, sparfloxacin, temafloxacin, trovafloxacin)
|
||||
\item \code{cephalosporins_3rd}\cr(cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefetamet, cefetamet pivoxil, cefixime, cefmenoxime, cefodizime, cefoperazone, cefoperazone/sulbactam, cefotaxime, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotiam hexetil, cefovecin, cefpimizole, cefpiramide, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefsulodin, ceftazidime, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftriaxone, latamoxef)
|
||||
\item \code{cephalosporins_4th}\cr(cefepime, cefepime/clavulanic acid, cefepime/tazobactam, cefetecol (Cefcatacol), cefoselis, cefozopran, cefpirome, cefquinome)
|
||||
\item \code{cephalosporins_5th}\cr(ceftaroline, ceftaroline/avibactam, ceftobiprole, ceftobiprole medocaril, ceftolozane/enzyme inhibitor, ceftolozane/tazobactam)
|
||||
\item \code{cephalosporins_except_caz}\cr(cefacetrile, cefaclor, cefadroxil, cefaloridine, cefamandole, cefatrizine, cefazedone, cefazolin, cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime, cefepime/clavulanic acid, cefepime/tazobactam, cefetamet, cefetamet pivoxil, cefetecol (Cefcatacol), cefetrizole, cefixime, cefmenoxime, cefmetazole, cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam, ceforanide, cefoselis, cefotaxime, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam, cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening, cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil, cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline, ceftaroline/avibactam, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftobiprole, ceftobiprole medocaril, ceftolozane/enzyme inhibitor, ceftolozane/tazobactam, ceftriaxone, cefuroxime, cefuroxime axetil, cephalexin, cephalothin, cephapirin, cephradine, latamoxef, loracarbef)
|
||||
\item \code{fluoroquinolones}\cr(besifloxacin, ciprofloxacin, clinafloxacin, danofloxacin, delafloxacin, difloxacin, enoxacin, enrofloxacin, finafloxacin, fleroxacin, garenoxacin, gatifloxacin, gemifloxacin, grepafloxacin, levofloxacin, levonadifloxacin, lomefloxacin, marbofloxacin, metioxate, miloxacin, moxifloxacin, nadifloxacin, nifuroquine, norfloxacin, ofloxacin, orbifloxacin, pazufloxacin, pefloxacin, pradofloxacin, premafloxacin, prulifloxacin, rufloxacin, sarafloxacin, sitafloxacin, sparfloxacin, temafloxacin, tilbroquinol, tioxacin, tosufloxacin, trovafloxacin)
|
||||
\item \code{glycopeptides}\cr(avoparcin, dalbavancin, norvancomycin, oritavancin, ramoplanin, teicoplanin, teicoplanin-macromethod, telavancin, vancomycin, vancomycin-macromethod)
|
||||
\item \code{glycopeptides_except_lipo}\cr(avoparcin, norvancomycin, ramoplanin, teicoplanin, teicoplanin-macromethod, vancomycin, vancomycin-macromethod)
|
||||
\item \code{lincosamides}\cr(clindamycin, lincomycin, pirlimycin)
|
||||
\item \code{lincosamides}\cr(acetylmidecamycin, acetylspiramycin, clindamycin, gamithromycin, kitasamycin (Leucomycin), lincomycin, meleumycin, nafithromycin, pirlimycin, primycin, solithromycin, tildipirosin, tilmicosin, tulathromycin, tylosin, tylvalosin)
|
||||
\item \code{lipoglycopeptides}\cr(dalbavancin, oritavancin, telavancin)
|
||||
\item \code{macrolides}\cr(azithromycin, clarithromycin, dirithromycin, erythromycin, flurithromycin, josamycin, midecamycin, miocamycin, oleandomycin, rokitamycin, roxithromycin, spiramycin, telithromycin, troleandomycin)
|
||||
\item \code{oxazolidinones}\cr(cycloserine, linezolid, tedizolid, thiacetazone)
|
||||
\item \code{macrolides}\cr(acetylmidecamycin, acetylspiramycin, azithromycin, clarithromycin, dirithromycin, erythromycin, flurithromycin, gamithromycin, josamycin, kitasamycin (Leucomycin), meleumycin, midecamycin, miocamycin, nafithromycin, oleandomycin, pirlimycin, primycin, rokitamycin, roxithromycin, solithromycin, spiramycin, telithromycin, tildipirosin, tilmicosin, troleandomycin, tulathromycin, tylosin, tylvalosin)
|
||||
\item \code{oxazolidinones}\cr(cadazolid, cycloserine, linezolid, tedizolid, thiacetazone)
|
||||
\item \code{penicillins}\cr(amoxicillin, amoxicillin/clavulanic acid, amoxicillin/sulbactam, ampicillin, ampicillin/sulbactam, apalcillin, aspoxicillin, avibactam, azidocillin, azlocillin, aztreonam, aztreonam/avibactam, bacampicillin, benzathine benzylpenicillin, benzathine phenoxymethylpenicillin, benzylpenicillin, carbenicillin, carindacillin, ciclacillin, clometocillin, cloxacillin, dicloxacillin, epicillin, flucloxacillin, hetacillin, lenampicillin, mecillinam (Amdinocillin), metampicillin, methicillin, mezlocillin, mezlocillin/sulbactam, nacubactam, nafcillin, oxacillin, penamecillin, penicillin/novobiocin, penicillin/sulbactam, phenethicillin, phenoxymethylpenicillin, piperacillin, piperacillin/sulbactam, piperacillin/tazobactam, piridicillin, pivampicillin, pivmecillinam, procaine benzylpenicillin, propicillin, sarmoxicillin, sulbactam, sulbenicillin, sultamicillin, talampicillin, tazobactam, temocillin, ticarcillin, ticarcillin/clavulanic acid)
|
||||
\item \code{polymyxins}\cr(colistin, polymyxin B, polymyxin B/polysorbate 80)
|
||||
\item \code{quinolones}\cr(besifloxacin, cinoxacin, ciprofloxacin, clinafloxacin, danofloxacin, delafloxacin, difloxacin, enoxacin, enrofloxacin, finafloxacin, fleroxacin, flumequine, garenoxacin, gatifloxacin, gemifloxacin, grepafloxacin, levofloxacin, levonadifloxacin, lomefloxacin, marbofloxacin, metioxate, miloxacin, moxifloxacin, nadifloxacin, nalidixic acid, nifuroquine, nitroxoline, norfloxacin, ofloxacin, orbifloxacin, oxolinic acid, pazufloxacin, pefloxacin, pipemidic acid, piromidic acid, pradofloxacin, premafloxacin, prulifloxacin, rosoxacin, rufloxacin, sarafloxacin, sitafloxacin, sparfloxacin, temafloxacin, tilbroquinol, tioxacin, tosufloxacin, trovafloxacin)
|
||||
\item \code{streptogramins}\cr(pristinamycin, quinupristin/dalfopristin)
|
||||
\item \code{tetracyclines}\cr(chlortetracycline, clomocycline, demeclocycline, doxycycline, eravacycline, lymecycline, metacycline, minocycline, oxytetracycline, penimepicycline, rolitetracycline, tetracycline, tigecycline)
|
||||
\item \code{tetracyclines_except_tgc}\cr(chlortetracycline, clomocycline, demeclocycline, doxycycline, eravacycline, lymecycline, metacycline, minocycline, oxytetracycline, penimepicycline, rolitetracycline, tetracycline)
|
||||
\item \code{tetracyclines}\cr(cetocycline, chlortetracycline, clomocycline, demeclocycline, doxycycline, eravacycline, lymecycline, metacycline, minocycline, omadacycline, oxytetracycline, penimepicycline, rolitetracycline, tetracycline, tigecycline)
|
||||
\item \code{tetracyclines_except_tgc}\cr(cetocycline, chlortetracycline, clomocycline, demeclocycline, doxycycline, eravacycline, lymecycline, metacycline, minocycline, omadacycline, oxytetracycline, penimepicycline, rolitetracycline, tetracycline)
|
||||
\item \code{ureidopenicillins}\cr(azlocillin, mezlocillin, piperacillin, piperacillin/tazobactam)
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@ -181,11 +181,8 @@ On our website \url{https://msberends.github.io/AMR/} you can find \href{https:/
|
||||
# `example_isolates` is a data set available in the AMR package.
|
||||
# See ?example_isolates.
|
||||
|
||||
example_isolates[first_isolate(example_isolates), ]
|
||||
\donttest{
|
||||
# faster way, only works in R 3.2 and later:
|
||||
example_isolates[first_isolate(), ]
|
||||
|
||||
\donttest{
|
||||
# get all first Gram-negatives
|
||||
example_isolates[which(first_isolate() & mo_is_gram_negative()), ]
|
||||
|
||||
|
@ -41,7 +41,7 @@ Join the data set \link{microorganisms} easily to an existing data set or to a \
|
||||
\details{
|
||||
\strong{Note:} As opposed to the \code{join()} functions of \code{dplyr}, \link{character} vectors are supported and at default existing columns will get a suffix \code{"2"} and the newly joined columns will not get a suffix.
|
||||
|
||||
If the \code{dplyr} package is installed, their join functions will be used. Otherwise, the much slower \code{\link[=merge]{merge()}} and \code{\link[=interaction]{interaction()}} functions from base R will be used.
|
||||
If the \code{dplyr} package is installed, their join functions will be used. Otherwise, the much slower \code{\link[=merge]{merge()}} and \code{\link[=interaction]{interaction()}} functions from base \R will be used.
|
||||
}
|
||||
\section{Stable Lifecycle}{
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
46
man/plot.Rd
46
man/plot.Rd
@ -4,10 +4,13 @@
|
||||
\alias{plot}
|
||||
\alias{plot.mic}
|
||||
\alias{ggplot.mic}
|
||||
\alias{autoplot.mic}
|
||||
\alias{plot.disk}
|
||||
\alias{ggplot.disk}
|
||||
\alias{autoplot.disk}
|
||||
\alias{plot.rsi}
|
||||
\alias{ggplot.rsi}
|
||||
\alias{autoplot.rsi}
|
||||
\title{Plotting for Classes \code{rsi}, \code{mic} and \code{disk}}
|
||||
\usage{
|
||||
\method{plot}{mic}(
|
||||
@ -39,6 +42,21 @@
|
||||
...
|
||||
)
|
||||
|
||||
\method{autoplot}{mic}(
|
||||
data,
|
||||
mapping = NULL,
|
||||
title = paste("MIC values of", deparse(substitute(data))),
|
||||
ylab = "Frequency",
|
||||
xlab = "Minimum Inhibitory Concentration (mg/L)",
|
||||
mo = NULL,
|
||||
ab = NULL,
|
||||
guideline = "EUCAST",
|
||||
colours_RSI = c("#ED553B", "#3CAEA3", "#F6D55C"),
|
||||
language = get_locale(),
|
||||
expand = TRUE,
|
||||
...
|
||||
)
|
||||
|
||||
\method{plot}{disk}(
|
||||
x,
|
||||
main = paste("Disk zones of", deparse(substitute(x))),
|
||||
@ -68,6 +86,21 @@
|
||||
...
|
||||
)
|
||||
|
||||
\method{autoplot}{disk}(
|
||||
data,
|
||||
mapping = NULL,
|
||||
title = paste("Disk zones of", deparse(substitute(data))),
|
||||
ylab = "Frequency",
|
||||
xlab = "Disk diffusion diameter (mm)",
|
||||
mo = NULL,
|
||||
ab = NULL,
|
||||
guideline = "EUCAST",
|
||||
colours_RSI = c("#ED553B", "#3CAEA3", "#F6D55C"),
|
||||
language = get_locale(),
|
||||
expand = TRUE,
|
||||
...
|
||||
)
|
||||
|
||||
\method{plot}{rsi}(
|
||||
x,
|
||||
ylab = "Percentage",
|
||||
@ -86,6 +119,17 @@
|
||||
language = get_locale(),
|
||||
...
|
||||
)
|
||||
|
||||
\method{autoplot}{rsi}(
|
||||
data,
|
||||
mapping = NULL,
|
||||
title = paste("Resistance Overview of", deparse(substitute(data))),
|
||||
xlab = "Antimicrobial Interpretation",
|
||||
ylab = "Frequency",
|
||||
colours_RSI = c("#ED553B", "#3CAEA3", "#F6D55C"),
|
||||
language = get_locale(),
|
||||
...
|
||||
)
|
||||
}
|
||||
\arguments{
|
||||
\item{x, data}{MIC values created with \code{\link[=as.mic]{as.mic()}} or disk diffusion values created with \code{\link[=as.disk]{as.disk()}}}
|
||||
@ -114,7 +158,7 @@
|
||||
The \code{ggplot} functions return a \code{\link[ggplot2:ggplot]{ggplot}} model that is extendible with any \code{ggplot2} function.
|
||||
}
|
||||
\description{
|
||||
Functions to plot classes \code{rsi}, \code{mic} and \code{disk}, with support for base R and \code{ggplot2}.
|
||||
Functions to plot classes \code{rsi}, \code{mic} and \code{disk}, with support for base \R and \code{ggplot2}.
|
||||
}
|
||||
\details{
|
||||
The interpretation of "I" will be named "Increased exposure" for all EUCAST guidelines since 2019, and will be named "Intermediate" in all other cases.
|
||||
|
@ -31,7 +31,7 @@ class \verb{<mic>} for \code{\link[=random_mic]{random_mic()}} (see \code{\link[
|
||||
These functions can be used for generating random MIC values and disk diffusion diameters, for AMR data analysis practice. By providing a microorganism and antimicrobial agent, the generated results will reflect reality as much as possible.
|
||||
}
|
||||
\details{
|
||||
The base R function \code{\link[=sample]{sample()}} is used for generating values.
|
||||
The base \R function \code{\link[=sample]{sample()}} is used for generating values.
|
||||
|
||||
Generated values are based on the latest EUCAST guideline implemented in the \link{rsi_translation} data set. To create specific generated values per bug or drug, set the \code{mo} and/or \code{ab} argument.
|
||||
}
|
||||
|
@ -4,8 +4,9 @@
|
||||
\alias{resistance_predict}
|
||||
\alias{rsi_predict}
|
||||
\alias{plot.resistance_predict}
|
||||
\alias{ggplot.resistance_predict}
|
||||
\alias{ggplot_rsi_predict}
|
||||
\alias{ggplot.resistance_predict}
|
||||
\alias{autoplot.resistance_predict}
|
||||
\title{Predict antimicrobial resistance}
|
||||
\usage{
|
||||
resistance_predict(
|
||||
@ -40,9 +41,16 @@ rsi_predict(
|
||||
|
||||
\method{plot}{resistance_predict}(x, main = paste("Resistance Prediction of", x_name), ...)
|
||||
|
||||
ggplot_rsi_predict(
|
||||
x,
|
||||
main = paste("Resistance Prediction of", x_name),
|
||||
ribbon = TRUE,
|
||||
...
|
||||
)
|
||||
|
||||
\method{ggplot}{resistance_predict}(x, main = paste("Resistance Prediction of", x_name), ribbon = TRUE, ...)
|
||||
|
||||
ggplot_rsi_predict(
|
||||
\method{autoplot}{resistance_predict}(
|
||||
x,
|
||||
main = paste("Resistance Prediction of", x_name),
|
||||
ribbon = TRUE,
|
||||
|
Reference in New Issue
Block a user