mirror of
https://github.com/msberends/AMR.git
synced 2024-12-26 08:06:12 +01:00
eucast rules fix, 1st isolate fix, website update
This commit is contained in:
parent
469b145d8c
commit
2e4d703338
@ -1,6 +1,6 @@
|
|||||||
Package: AMR
|
Package: AMR
|
||||||
Version: 0.5.0.9008
|
Version: 0.5.0.9008
|
||||||
Date: 2018-12-30
|
Date: 2018-12-31
|
||||||
Title: Antimicrobial Resistance Analysis
|
Title: Antimicrobial Resistance Analysis
|
||||||
Authors@R: c(
|
Authors@R: c(
|
||||||
person(
|
person(
|
||||||
|
35
NEWS.md
35
NEWS.md
@ -2,15 +2,15 @@
|
|||||||
**Note: this is the development version, which will eventually be released as AMR 0.6.0.**
|
**Note: this is the development version, which will eventually be released as AMR 0.6.0.**
|
||||||
|
|
||||||
#### New
|
#### New
|
||||||
* **BREAKING**: removed deprecated functions, parameters and references to 'bactid'. Use `as.mo` to identify an MO code.
|
* **BREAKING**: removed deprecated functions, parameters and references to 'bactid'. Use `as.mo()` to identify an MO code.
|
||||||
* New website: https://msberends.gitlab.io/AMR (built with the great [`pkgdown`](https://pkgdown.r-lib.org/))
|
* New website: https://msberends.gitlab.io/AMR (built with the great [`pkgdown`](https://pkgdown.r-lib.org/))
|
||||||
* Contains the complete manual of this package and all of its functions with an explanation of their parameters
|
* Contains the complete manual of this package and all of its functions with an explanation of their parameters
|
||||||
* Support for [`dplyr`](https://dplyr.tidyverse.org) version 0.8.0
|
* Support for [`dplyr`](https://dplyr.tidyverse.org) version 0.8.0
|
||||||
* Function `mo_failures` to review values that could not be coerced to a valid MO code, using `as.mo`. This latter function will now only show a maximum of 25 uncoerced values.
|
* Function `mo_failures()` to review values that could not be coerced to a valid MO code, using `as.mo()`. This latter function will now only show a maximum of 25 uncoerced values.
|
||||||
* Function `mo_renamed` to get a list of all returned values from `as.mo` that have had taxonomic renaming
|
* Function `mo_renamed()` to get a list of all returned values from `as.mo()` that have had taxonomic renaming
|
||||||
* Function `age` to calculate the (patients) age in years
|
* Function `age()` to calculate the (patients) age in years
|
||||||
* Function `age_groups` to split ages into custom or predefined groups (like children or elderly). This allows for easier demographic antimicrobial resistance analysis per age group.
|
* Function `age_groups()` to split ages into custom or predefined groups (like children or elderly). This allows for easier demographic antimicrobial resistance analysis per age group.
|
||||||
* Functions `filter_first_isolate` and `filter_first_weighted_isolate()` to shorten and fasten filtering on data sets with antimicrobial results, e.g.:
|
* Functions `filter_first_isolate()` and `filter_first_weighted_isolate()` to shorten and fasten filtering on data sets with antimicrobial results, e.g.:
|
||||||
```r
|
```r
|
||||||
septic_patients %>% filter_first_isolate()
|
septic_patients %>% filter_first_isolate()
|
||||||
# or
|
# or
|
||||||
@ -25,7 +25,8 @@
|
|||||||
```
|
```
|
||||||
|
|
||||||
#### Changed
|
#### Changed
|
||||||
* Improvements for `as.mo`:
|
* Fixed a critical bug in `eucast_rules()` where some rules that depend on previous applied rules would not be applied adequately
|
||||||
|
* Improvements for `as.mo()`:
|
||||||
* Finds better results when input is in other languages
|
* Finds better results when input is in other languages
|
||||||
* Better handling for subspecies
|
* Better handling for subspecies
|
||||||
* Better handling for *Salmonellae*
|
* Better handling for *Salmonellae*
|
||||||
@ -33,18 +34,18 @@
|
|||||||
* Manual now contains more info about the algorithms
|
* Manual now contains more info about the algorithms
|
||||||
* Progress bar will be shown when it takes more than 3 seconds to get results
|
* Progress bar will be shown when it takes more than 3 seconds to get results
|
||||||
* Support for formatted console text
|
* Support for formatted console text
|
||||||
* Function `first_isolate`:
|
* Function `first_isolate()`:
|
||||||
|
* Fixed a bug where distances between dates would not be calculated right - in the `septic_patients` data set this yielded a difference of 0.15% more isolates
|
||||||
* Will now use a column named like "patid" for the patient ID (parameter `col_patientid`), when this parameter was left blank
|
* Will now use a column named like "patid" for the patient ID (parameter `col_patientid`), when this parameter was left blank
|
||||||
* Will now use a column named like "key(...)ab" or "key(...)antibiotics" for the key antibiotics (parameter `col_keyantibiotics`), when this parameter was left blank
|
* Will now use a column named like "key(...)ab" or "key(...)antibiotics" for the key antibiotics (parameter `col_keyantibiotics()`), when this parameter was left blank
|
||||||
* Removed parameter `output_logical`, the function will now always return a logical value
|
* Removed parameter `output_logical`, the function will now always return a logical value
|
||||||
* Renamed parameter `filter_specimen` to `specimen_group`, although using `filter_specimen` will still work
|
* Renamed parameter `filter_specimen` to `specimen_group`, although using `filter_specimen` will still work
|
||||||
* A note to the manual pages of the `portion` functions, that low counts can influence the outcome and that the `portion` functions may camouflage this, since they only return the portion (albeit being dependent on the `minimum` parameter)
|
* A note to the manual pages of the `portion` functions, that low counts can influence the outcome and that the `portion` functions may camouflage this, since they only return the portion (albeit being dependent on the `minimum` parameter)
|
||||||
* Function `mo_taxonomy` now contains the kingdom too
|
* Function `mo_taxonomy()` now contains the kingdom too
|
||||||
* Function `first_isolate` will now use a column named like "patid" for the patient ID, when this parameter was left blank
|
* Reduce false positives for `is.rsi.eligible()`
|
||||||
* Reduce false positives for `is.rsi.eligible`
|
|
||||||
* Summaries of class `mo` will now return the top 3 and the unique count, e.g. using `summary(mo)`
|
* Summaries of class `mo` will now return the top 3 and the unique count, e.g. using `summary(mo)`
|
||||||
* Small text updates to summaries of class `rsi` and `mic`
|
* Small text updates to summaries of class `rsi` and `mic`
|
||||||
* Frequency tables (`freq` function):
|
* Frequency tables (`freq()` function):
|
||||||
* Header info is now available as a list, with the `header` function
|
* Header info is now available as a list, with the `header` function
|
||||||
* Added header info for class `mo` to show unique count of families, genera and species
|
* Added header info for class `mo` to show unique count of families, genera and species
|
||||||
* Now honours the `decimal.mark` setting, which just like `format` defaults to `getOption("OutDec")`
|
* Now honours the `decimal.mark` setting, which just like `format` defaults to `getOption("OutDec")`
|
||||||
@ -52,10 +53,10 @@
|
|||||||
* Fix for header text where all observations are `NA`
|
* Fix for header text where all observations are `NA`
|
||||||
* New parameter `droplevels` to exclude empty factor levels when input is a factor
|
* New parameter `droplevels` to exclude empty factor levels when input is a factor
|
||||||
* Factor levels will be in header when present in input data
|
* Factor levels will be in header when present in input data
|
||||||
* Function `scale_y_percent` now contains the `limits` parameter
|
* Function `scale_y_percent()` now contains the `limits` parameter
|
||||||
* Automatic parameter filling for `mdro`, `key_antibiotics` and `eucast_rules`
|
* Automatic parameter filling for `mdro()`, `key_antibiotics()` and `eucast_rules()`
|
||||||
* Updated examples for resistance prediction (`resistance_predict` function)
|
* Updated examples for resistance prediction (`resistance_predict()` function)
|
||||||
* Fix for `as.mic` to support more values ending in (several) zeroes
|
* Fix for `as.mic()` to support more values ending in (several) zeroes
|
||||||
|
|
||||||
#### Other
|
#### Other
|
||||||
* Updated licence text to emphasise GPL 2.0 and that this is an R package.
|
* Updated licence text to emphasise GPL 2.0 and that this is an R package.
|
||||||
|
@ -348,7 +348,7 @@ eucast_rules <- function(tbl,
|
|||||||
|
|
||||||
# helper function for editing the table
|
# helper function for editing the table
|
||||||
edit_rsi <- function(to, rule, rows, cols) {
|
edit_rsi <- function(to, rule, rows, cols) {
|
||||||
cols <- cols[!is.na(cols)]
|
cols <- unique(cols[!is.na(cols)])
|
||||||
if (length(rows) > 0 & length(cols) > 0) {
|
if (length(rows) > 0 & length(cols) > 0) {
|
||||||
before <- as.character(unlist(as.list(tbl_original[rows, cols])))
|
before <- as.character(unlist(as.list(tbl_original[rows, cols])))
|
||||||
tryCatch(
|
tryCatch(
|
||||||
@ -367,6 +367,10 @@ eucast_rules <- function(tbl,
|
|||||||
stop(e, call. = FALSE)
|
stop(e, call. = FALSE)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
suppressMessages(
|
||||||
|
suppressWarnings(
|
||||||
|
tbl[rows, cols] <<- to
|
||||||
|
))
|
||||||
after <- as.character(unlist(as.list(tbl_original[rows, cols])))
|
after <- as.character(unlist(as.list(tbl_original[rows, cols])))
|
||||||
amount_changed <<- amount_changed + sum(before != after, na.rm = TRUE)
|
amount_changed <<- amount_changed + sum(before != after, na.rm = TRUE)
|
||||||
amount_affected_rows <<- unique(c(amount_affected_rows, rows))
|
amount_affected_rows <<- unique(c(amount_affected_rows, rows))
|
||||||
@ -404,27 +408,14 @@ eucast_rules <- function(tbl,
|
|||||||
# join to microorganisms data set
|
# join to microorganisms data set
|
||||||
tbl <- tbl %>%
|
tbl <- tbl %>%
|
||||||
mutate_at(vars(col_mo), as.mo) %>%
|
mutate_at(vars(col_mo), as.mo) %>%
|
||||||
left_join_microorganisms(by = col_mo, suffix = c("_oldcols", ""))
|
left_join_microorganisms(by = col_mo, suffix = c("_oldcols", "")) %>%
|
||||||
|
as.data.frame(stringsAsFactors = FALSE)
|
||||||
# antibiotic classes
|
|
||||||
aminoglycosides <- c(tobr, gent, kana, neom, neti, siso)
|
|
||||||
tetracyclines <- c(doxy, mino, tetr) # since EUCAST v3.1 tige(cycline) is set apart
|
|
||||||
polymyxins <- c(poly, coli)
|
|
||||||
macrolides <- c(eryt, azit, roxi, clar) # since EUCAST v3.1 clinda is set apart
|
|
||||||
glycopeptides <- c(vanc, teic)
|
|
||||||
streptogramins <- c(qida, pris) # should officially also be quinupristin/dalfopristin
|
|
||||||
cephalosporins <- c(cfep, cfot, cfox, cfra, cfta, cftr, cfur, czol)
|
|
||||||
carbapenems <- c(erta, imip, mero)
|
|
||||||
aminopenicillins <- c(ampi, amox)
|
|
||||||
ureidopenicillins <- c(pipe, pita, azlo, mezl)
|
|
||||||
fluoroquinolones <- c(oflo, cipr, norf, levo, moxi)
|
|
||||||
all_betalactam <- c(aminopenicillins, ureidopenicillins, cephalosporins, carbapenems, amcl, oxac, clox, peni)
|
|
||||||
|
|
||||||
if (info == TRUE) {
|
if (info == TRUE) {
|
||||||
cat("Rules by the European Committee on Antimicrobial Susceptibility Testing (EUCAST)\n")
|
cat("\nRules by the European Committee on Antimicrobial Susceptibility Testing (EUCAST)\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
# since ampicillin ^= amoxicillin, get the first from the latter (not in original table)
|
# since ampicillin ^= amoxicillin, get the first from the latter (not in original EUCAST table)
|
||||||
if (!is.na(ampi) & !is.na(amox)) {
|
if (!is.na(ampi) & !is.na(amox)) {
|
||||||
if (verbose == TRUE) {
|
if (verbose == TRUE) {
|
||||||
cat(bgGreen("\n VERBOSE: transforming",
|
cat(bgGreen("\n VERBOSE: transforming",
|
||||||
@ -440,8 +431,26 @@ eucast_rules <- function(tbl,
|
|||||||
tbl[which(tbl[, amox] == "S" & !tbl[, ampi] %in% c("S", "I", "R")), ampi] <- "S"
|
tbl[which(tbl[, amox] == "S" & !tbl[, ampi] %in% c("S", "I", "R")), ampi] <- "S"
|
||||||
tbl[which(tbl[, amox] == "I" & !tbl[, ampi] %in% c("S", "I", "R")), ampi] <- "I"
|
tbl[which(tbl[, amox] == "I" & !tbl[, ampi] %in% c("S", "I", "R")), ampi] <- "I"
|
||||||
tbl[which(tbl[, amox] == "R" & !tbl[, ampi] %in% c("S", "I", "R")), ampi] <- "R"
|
tbl[which(tbl[, amox] == "R" & !tbl[, ampi] %in% c("S", "I", "R")), ampi] <- "R"
|
||||||
|
} else if (is.na(ampi) & !is.na(amox)) {
|
||||||
|
# ampicillin column is missing, but amoxicillin is available
|
||||||
|
message(blue(paste0("NOTE: Using column `", bold(amox), "` as input for ampicillin (J01CA01) since many EUCAST rules depend on it.")))
|
||||||
|
ampi <- amox
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# antibiotic classes
|
||||||
|
aminoglycosides <- c(tobr, gent, kana, neom, neti, siso)
|
||||||
|
tetracyclines <- c(doxy, mino, tetr) # since EUCAST v3.1 tige(cycline) is set apart
|
||||||
|
polymyxins <- c(poly, coli)
|
||||||
|
macrolides <- c(eryt, azit, roxi, clar) # since EUCAST v3.1 clinda is set apart
|
||||||
|
glycopeptides <- c(vanc, teic)
|
||||||
|
streptogramins <- c(qida, pris) # should officially also be quinupristin/dalfopristin
|
||||||
|
cephalosporins <- c(cfep, cfot, cfox, cfra, cfta, cftr, cfur, czol)
|
||||||
|
carbapenems <- c(erta, imip, mero)
|
||||||
|
aminopenicillins <- c(ampi, amox)
|
||||||
|
ureidopenicillins <- c(pipe, pita, azlo, mezl)
|
||||||
|
fluoroquinolones <- c(oflo, cipr, norf, levo, moxi)
|
||||||
|
all_betalactam <- c(aminopenicillins, ureidopenicillins, cephalosporins, carbapenems, amcl, oxac, clox, peni)
|
||||||
|
|
||||||
if (any(c("all", "breakpoints") %in% rules)) {
|
if (any(c("all", "breakpoints") %in% rules)) {
|
||||||
# BREAKPOINTS -------------------------------------------------------------
|
# BREAKPOINTS -------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -380,7 +380,7 @@ first_isolate <- function(tbl,
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
# suppress warnings because dplyr want us to use library(dplyr) when using filter(row_number())
|
# suppress warnings because dplyr wants us to use library(dplyr) when using filter(row_number())
|
||||||
suppressWarnings(
|
suppressWarnings(
|
||||||
scope.size <- tbl %>%
|
scope.size <- tbl %>%
|
||||||
filter(
|
filter(
|
||||||
@ -391,17 +391,46 @@ first_isolate <- function(tbl,
|
|||||||
nrow()
|
nrow()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
identify_new_year = function(x, episode_days) {
|
||||||
|
# I asked on StackOverflow:
|
||||||
|
# https://stackoverflow.com/questions/42122245/filter-one-row-every-year
|
||||||
|
if (length(x) == 1) {
|
||||||
|
return(TRUE)
|
||||||
|
}
|
||||||
|
indices = integer(0)
|
||||||
|
start = x[1]
|
||||||
|
ind = 1
|
||||||
|
indices[ind] = ind
|
||||||
|
for (i in 2:length(x)) {
|
||||||
|
if (as.numeric(x[i] - start >= episode_days)) {
|
||||||
|
ind = ind + 1
|
||||||
|
indices[ind] = i
|
||||||
|
start = x[i]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result <- rep(FALSE, length(x))
|
||||||
|
result[indices] <- TRUE
|
||||||
|
return(result)
|
||||||
|
}
|
||||||
|
|
||||||
# Analysis of first isolate ----
|
# Analysis of first isolate ----
|
||||||
all_first <- tbl %>%
|
all_first <- tbl %>%
|
||||||
mutate(other_pat_or_mo = if_else(patient_id == lag(patient_id)
|
mutate(other_pat_or_mo = if_else(patient_id == lag(patient_id)
|
||||||
& genus == lag(genus)
|
& genus == lag(genus)
|
||||||
& species == lag(species),
|
& species == lag(species),
|
||||||
FALSE,
|
FALSE,
|
||||||
TRUE),
|
TRUE)) %>% #,
|
||||||
days_diff = 0) %>%
|
# days_diff = 0) %>%
|
||||||
mutate(days_diff = if_else(other_pat_or_mo == FALSE,
|
# mutate(days_diff = if_else(other_pat_or_mo == FALSE,
|
||||||
(date_lab - lag(date_lab)) + lag(days_diff),
|
# as.integer((date_lab - lag(date_lab)) + lag(days_diff)),
|
||||||
0))
|
# as.integer(0))) %>%
|
||||||
|
# mutate(r = days_diff) %>%
|
||||||
|
group_by_at(vars(patient_id,
|
||||||
|
genus,
|
||||||
|
species)) %>%
|
||||||
|
mutate(more_than_episode_ago = identify_new_year(x = date_lab,
|
||||||
|
episode_days = episode_days)) %>%
|
||||||
|
ungroup()
|
||||||
|
|
||||||
weighted.notice <- ''
|
weighted.notice <- ''
|
||||||
if (!is.null(col_keyantibiotics)) {
|
if (!is.null(col_keyantibiotics)) {
|
||||||
@ -436,13 +465,12 @@ first_isolate <- function(tbl,
|
|||||||
between(row_number(), row.start, row.end)
|
between(row_number(), row.start, row.end)
|
||||||
& genus != ""
|
& genus != ""
|
||||||
& species != ""
|
& species != ""
|
||||||
& (other_pat_or_mo
|
& (other_pat_or_mo | more_than_episode_ago | key_ab_other),
|
||||||
| days_diff >= episode_days
|
|
||||||
| key_ab_other),
|
|
||||||
TRUE,
|
TRUE,
|
||||||
FALSE))
|
FALSE))
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
# no key antibiotics
|
||||||
# suppress warnings because dplyr want us to use library(dplyr) when using filter(row_number())
|
# suppress warnings because dplyr want us to use library(dplyr) when using filter(row_number())
|
||||||
suppressWarnings(
|
suppressWarnings(
|
||||||
all_first <- all_first %>%
|
all_first <- all_first %>%
|
||||||
@ -452,8 +480,7 @@ first_isolate <- function(tbl,
|
|||||||
between(row_number(), row.start, row.end)
|
between(row_number(), row.start, row.end)
|
||||||
& genus != ""
|
& genus != ""
|
||||||
& species != ""
|
& species != ""
|
||||||
& (other_pat_or_mo
|
& (other_pat_or_mo | more_than_episode_ago),
|
||||||
| days_diff >= episode_days),
|
|
||||||
TRUE,
|
TRUE,
|
||||||
FALSE))
|
FALSE))
|
||||||
)
|
)
|
||||||
|
6
R/freq.R
6
R/freq.R
@ -573,9 +573,9 @@ format_header <- function(x, markdown = FALSE, decimal.mark = ".", big.mark = ",
|
|||||||
n_levels_list <- c(n_levels_list[1:5], "...")
|
n_levels_list <- c(n_levels_list[1:5], "...")
|
||||||
}
|
}
|
||||||
if (header$ordered == TRUE) {
|
if (header$ordered == TRUE) {
|
||||||
n_levels_list <- paste0(header$levels, collapse = " < ")
|
n_levels_list <- paste0(n_levels_list, collapse = " < ")
|
||||||
} else {
|
} else {
|
||||||
n_levels_list <- paste0(header$levels, collapse = ", ")
|
n_levels_list <- paste0(n_levels_list, collapse = ", ")
|
||||||
}
|
}
|
||||||
header$levels <- n_levels_list
|
header$levels <- n_levels_list
|
||||||
header <- header[names(header) != "ordered"]
|
header <- header[names(header) != "ordered"]
|
||||||
@ -824,7 +824,7 @@ print.frequency_tbl <- function(x,
|
|||||||
}
|
}
|
||||||
} else if (opt$tbl_format == "markdown") {
|
} else if (opt$tbl_format == "markdown") {
|
||||||
# do print title as caption in markdown
|
# do print title as caption in markdown
|
||||||
cat("\n", title, sep = "")
|
cat("\n", title, " ", sep = "") # two trailing spaces for markdown
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NROW(x) == 0) {
|
if (NROW(x) == 0) {
|
||||||
|
@ -56,10 +56,10 @@ The `AMR` package basically does four important things:
|
|||||||
|
|
||||||
2. It **enhances existing data** and **adds new data** from data sets included in this package.
|
2. It **enhances existing data** and **adds new data** from data sets included in this package.
|
||||||
|
|
||||||
* Use `EUCAST_rules` to apply [EUCAST expert rules to isolates](http://www.eucast.org/expert_rules_and_intrinsic_resistance/).
|
* Use `eucast_rules` to apply [EUCAST expert rules to isolates](http://www.eucast.org/expert_rules_and_intrinsic_resistance/).
|
||||||
* Use `first_isolate` to identify the first isolates of every patient [using guidelines from the CLSI](https://clsi.org/standards/products/microbiology/documents/m39/) (Clinical and Laboratory Standards Institute).
|
* Use `first_isolate` to identify the first isolates of every patient [using guidelines from the CLSI](https://clsi.org/standards/products/microbiology/documents/m39/) (Clinical and Laboratory Standards Institute).
|
||||||
* You can also identify first *weighted* isolates of every patient, an adjusted version of the CLSI guideline. This takes into account key antibiotics of every strain and compares them.
|
* You can also identify first *weighted* isolates of every patient, an adjusted version of the CLSI guideline. This takes into account key antibiotics of every strain and compares them.
|
||||||
* Use `MDRO` (abbreviation of Multi Drug Resistant Organisms) to check your isolates for exceptional resistance with country-specific guidelines or EUCAST rules. Currently, national guidelines for Germany and the Netherlands are supported.
|
* Use `mdro` (abbreviation of Multi Drug Resistant Organisms) to check your isolates for exceptional resistance with country-specific guidelines or EUCAST rules. Currently, national guidelines for Germany and the Netherlands are supported.
|
||||||
* The data set `microorganisms` contains the complete taxonomic tree of more than 18,000 microorganisms (bacteria, fungi/yeasts and protozoa). Furthermore, the colloquial name and Gram stain are available, which enables resistance analysis of e.g. different antibiotics per Gram stain. The package also contains functions to look up values in this data set like `mo_genus`, `mo_family`, `mo_gramstain` or even `mo_phylum`. As they use `as.mo` internally, they also use artificial intelligence. For example, `mo_genus("MRSA")` and `mo_genus("S. aureus")` will both return `"Staphylococcus"`. They also come with support for German, Dutch, Spanish, Italian, French and Portuguese. These functions can be used to add new variables to your data.
|
* The data set `microorganisms` contains the complete taxonomic tree of more than 18,000 microorganisms (bacteria, fungi/yeasts and protozoa). Furthermore, the colloquial name and Gram stain are available, which enables resistance analysis of e.g. different antibiotics per Gram stain. The package also contains functions to look up values in this data set like `mo_genus`, `mo_family`, `mo_gramstain` or even `mo_phylum`. As they use `as.mo` internally, they also use artificial intelligence. For example, `mo_genus("MRSA")` and `mo_genus("S. aureus")` will both return `"Staphylococcus"`. They also come with support for German, Dutch, Spanish, Italian, French and Portuguese. These functions can be used to add new variables to your data.
|
||||||
* The data set `antibiotics` contains the ATC code, LIS codes, official name, trivial name and DDD of both oral and parenteral administration. It also contains a total of 298 trade names. Use functions like `ab_name` and `ab_tradenames` to look up values. The `ab_*` functions use `as.atc` internally so they support AI to guess your expected result. For example, `ab_name("Fluclox")`, `ab_name("Floxapen")` and `ab_name("J01CF05")` will all return `"Flucloxacillin"`. These functions can again be used to add new variables to your data.
|
* The data set `antibiotics` contains the ATC code, LIS codes, official name, trivial name and DDD of both oral and parenteral administration. It also contains a total of 298 trade names. Use functions like `ab_name` and `ab_tradenames` to look up values. The `ab_*` functions use `as.atc` internally so they support AI to guess your expected result. For example, `ab_name("Fluclox")`, `ab_name("Floxapen")` and `ab_name("J01CF05")` will all return `"Flucloxacillin"`. These functions can again be used to add new variables to your data.
|
||||||
|
|
||||||
|
@ -126,10 +126,715 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<p>This page will soon be updated.</p>
|
<p><strong>Note:</strong> values on this page will be regenerated with every website update since it is written in <a href="https://rmarkdown.rstudio.com/">RMarkdown</a>, so actual results will change over time. However, the methodology remains unchanged. This page was generated on 31 December 2018.</p>
|
||||||
|
<div id="introduction" class="section level1">
|
||||||
|
<h1 class="hasAnchor">
|
||||||
|
<a href="#introduction" class="anchor"></a>Introduction</h1>
|
||||||
|
<p>(work in progress)</p>
|
||||||
|
</div>
|
||||||
|
<div id="tutorial" class="section level1">
|
||||||
|
<h1 class="hasAnchor">
|
||||||
|
<a href="#tutorial" class="anchor"></a>Tutorial</h1>
|
||||||
|
<p>For this tutorial, we will create fake demonstration data to work with.</p>
|
||||||
|
<p>You can skip to <a href="#cleaning-the-data">Cleaning the data</a> if you already have your own data ready. If you start your analysis, try to make the structure of your data generally look like this:</p>
|
||||||
|
<table class="table">
|
||||||
|
<thead><tr class="header">
|
||||||
|
<th align="center">date</th>
|
||||||
|
<th align="center">patient_id</th>
|
||||||
|
<th align="center">mo</th>
|
||||||
|
<th align="center">amox</th>
|
||||||
|
<th align="center">cipr</th>
|
||||||
|
</tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr class="odd">
|
||||||
|
<td align="center">2018-12-31</td>
|
||||||
|
<td align="center">abcd</td>
|
||||||
|
<td align="center">Escherichia coli</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="even">
|
||||||
|
<td align="center">2018-12-31</td>
|
||||||
|
<td align="center">abcd</td>
|
||||||
|
<td align="center">Escherichia coli</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">R</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="odd">
|
||||||
|
<td align="center">2018-12-31</td>
|
||||||
|
<td align="center">efgh</td>
|
||||||
|
<td align="center">Escherichia coli</td>
|
||||||
|
<td align="center">R</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div id="needed-r-packages" class="section level2">
|
||||||
|
<h2 class="hasAnchor">
|
||||||
|
<a href="#needed-r-packages" class="anchor"></a>Needed R packages</h2>
|
||||||
|
<p>As with many uses in R, we need some additional packages for AMR analysis. The most important one is <a href="https://dplyr.tidyverse.org/"><code>dplyr</code></a>, which tremendously improves the way we work with data - it allows for a very natural way of writing syntaxes in R. Another important dependency is <a href="https://ggplot2.tidyverse.org/"><code>ggplot2</code></a>. This package can be used to create beautiful plots in R.</p>
|
||||||
|
<p>Our <code>AMR</code> package depends on these packages and even extends their use and functions.</p>
|
||||||
|
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" data-line-number="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/library">library</a></span>(dplyr) <span class="co"># the data science package</span></a>
|
||||||
|
<a class="sourceLine" id="cb1-2" data-line-number="2"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/library">library</a></span>(AMR) <span class="co"># this package, to simplify and automate AMR analysis</span></a>
|
||||||
|
<a class="sourceLine" id="cb1-3" data-line-number="3"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/library">library</a></span>(ggplot2) <span class="co"># for appealing plots</span></a></code></pre></div>
|
||||||
|
</div>
|
||||||
|
<div id="creation-of-data" class="section level2">
|
||||||
|
<h2 class="hasAnchor">
|
||||||
|
<a href="#creation-of-data" class="anchor"></a>Creation of data</h2>
|
||||||
|
<p>We will create some fake example data to use for analysis. For antimicrobial resistance analysis, we need at least: a patients ID, name or code of a microorganism, a date and antimicrobial results (an antibiogram). It could also include a specimen type (e.g. to filter on blood or urine), the ward type (e.g. to filter on ICUs).</p>
|
||||||
|
<p>With additional columns (like a hospital name, the patients gender of even [well-defined] clinical properties) you can do a comparative analysis, as this tutorial will demonstrate too.</p>
|
||||||
|
<div id="patients" class="section level4">
|
||||||
|
<h4 class="hasAnchor">
|
||||||
|
<a href="#patients" class="anchor"></a>Patients</h4>
|
||||||
|
<p>To start with patients, we need a unique list of patients.</p>
|
||||||
|
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb2-1" data-line-number="1">patients <-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/unlist">unlist</a></span>(<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/lapply">lapply</a></span>(LETTERS, paste0, <span class="dv">1</span><span class="op">:</span><span class="dv">10</span>))</a></code></pre></div>
|
||||||
|
<p>The <code>LETTERS</code> object is available in R - it’s a vector with 26 characters: <code>A</code> to <code>Z</code>. The <code>patients</code> object we just created is now a vector of length 260, with values (patient IDs) varying from <code>A1</code> to <code>Z10</code>.</p>
|
||||||
|
</div>
|
||||||
|
<div id="dates" class="section level4">
|
||||||
|
<h4 class="hasAnchor">
|
||||||
|
<a href="#dates" class="anchor"></a>Dates</h4>
|
||||||
|
<p>Let’s pretend that our data consists of blood cultures isolates from 1 January 2010 until 1 January 2018.</p>
|
||||||
|
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" data-line-number="1">dates <-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/seq">seq</a></span>(<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/as.Date">as.Date</a></span>(<span class="st">"2010-01-01"</span>), <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/as.Date">as.Date</a></span>(<span class="st">"2018-01-01"</span>), <span class="dt">by =</span> <span class="st">"day"</span>)</a></code></pre></div>
|
||||||
|
<p>This <code>dates</code> object now contains all days in our date range.</p>
|
||||||
|
</div>
|
||||||
|
<div id="microorganisms" class="section level4">
|
||||||
|
<h4 class="hasAnchor">
|
||||||
|
<a href="#microorganisms" class="anchor"></a>Microorganisms</h4>
|
||||||
|
<p>For this tutorial, we will uses four different microorganisms: <em>Escherichia coli</em>, <em>Staphylococcus aureus</em>, <em>Streptococcus pneumoniae</em>, and <em>Klebsiella pneumoniae</em>:</p>
|
||||||
|
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" data-line-number="1">bacteria <-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="st">"Escherichia coli"</span>, <span class="st">"Staphylococcus aureus"</span>,</a>
|
||||||
|
<a class="sourceLine" id="cb4-2" data-line-number="2"> <span class="st">"Streptococcus pneumoniae"</span>, <span class="st">"Klebsiella pneumoniae"</span>)</a></code></pre></div>
|
||||||
|
</div>
|
||||||
|
<div id="other-variables" class="section level4">
|
||||||
|
<h4 class="hasAnchor">
|
||||||
|
<a href="#other-variables" class="anchor"></a>Other variables</h4>
|
||||||
|
<p>For completeness, we can also add the patients gender, the hospital where the patients was admitted and all valid antibmicrobial results:</p>
|
||||||
|
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb5-1" data-line-number="1">genders <-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="st">"M"</span>, <span class="st">"F"</span>)</a>
|
||||||
|
<a class="sourceLine" id="cb5-2" data-line-number="2">hospitals <-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="st">"Hospital A"</span>, <span class="st">"Hospital B"</span>, <span class="st">"Hospital C"</span>, <span class="st">"Hospital D"</span>)</a>
|
||||||
|
<a class="sourceLine" id="cb5-3" data-line-number="3">ab_interpretations <-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="st">"S"</span>, <span class="st">"I"</span>, <span class="st">"R"</span>)</a></code></pre></div>
|
||||||
|
</div>
|
||||||
|
<div id="put-everything-together" class="section level4">
|
||||||
|
<h4 class="hasAnchor">
|
||||||
|
<a href="#put-everything-together" class="anchor"></a>Put everything together</h4>
|
||||||
|
<p>Using the <code><a href="http://dplyr.tidyverse.org/reference/sample.html">sample()</a></code> function, we can randomly select items from all objects we defined earlier. To let our fake data reflect reality a bit, we will also approximately define the probabilities of bacteria and the antibiotic results with the <code>prob</code> parameter.</p>
|
||||||
|
<div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb6-1" data-line-number="1">data <-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/data.frame">data.frame</a></span>(<span class="dt">date =</span> <span class="kw"><a href="http://dplyr.tidyverse.org/reference/sample.html">sample</a></span>(dates, <span class="dv">5000</span>, <span class="dt">replace =</span> <span class="ot">TRUE</span>),</a>
|
||||||
|
<a class="sourceLine" id="cb6-2" data-line-number="2"> <span class="dt">patient_id =</span> <span class="kw"><a href="http://dplyr.tidyverse.org/reference/sample.html">sample</a></span>(patients, <span class="dv">5000</span>, <span class="dt">replace =</span> <span class="ot">TRUE</span>),</a>
|
||||||
|
<a class="sourceLine" id="cb6-3" data-line-number="3"> <span class="co"># gender - add slightly more men:</span></a>
|
||||||
|
<a class="sourceLine" id="cb6-4" data-line-number="4"> <span class="dt">gender =</span> <span class="kw"><a href="http://dplyr.tidyverse.org/reference/sample.html">sample</a></span>(genders, <span class="dv">5000</span>, <span class="dt">replace =</span> <span class="ot">TRUE</span>, <span class="dt">prob =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="fl">0.55</span>, <span class="fl">0.45</span>)),</a>
|
||||||
|
<a class="sourceLine" id="cb6-5" data-line-number="5"> <span class="dt">hospital =</span> <span class="kw"><a href="http://dplyr.tidyverse.org/reference/sample.html">sample</a></span>(hospitals, <span class="dv">5000</span>, <span class="dt">replace =</span> <span class="ot">TRUE</span>),</a>
|
||||||
|
<a class="sourceLine" id="cb6-6" data-line-number="6"> <span class="dt">bacteria =</span> <span class="kw"><a href="http://dplyr.tidyverse.org/reference/sample.html">sample</a></span>(bacteria, <span class="dv">5000</span>, <span class="dt">replace =</span> <span class="ot">TRUE</span>, <span class="dt">prob =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="fl">0.50</span>, <span class="fl">0.25</span>, <span class="fl">0.15</span>, <span class="fl">0.10</span>)),</a>
|
||||||
|
<a class="sourceLine" id="cb6-7" data-line-number="7"> <span class="dt">amox =</span> <span class="kw"><a href="http://dplyr.tidyverse.org/reference/sample.html">sample</a></span>(ab_interpretations, <span class="dv">5000</span>, <span class="dt">replace =</span> <span class="ot">TRUE</span>, <span class="dt">prob =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="fl">0.6</span>, <span class="fl">0.05</span>, <span class="fl">0.35</span>)),</a>
|
||||||
|
<a class="sourceLine" id="cb6-8" data-line-number="8"> <span class="dt">amcl =</span> <span class="kw"><a href="http://dplyr.tidyverse.org/reference/sample.html">sample</a></span>(ab_interpretations, <span class="dv">5000</span>, <span class="dt">replace =</span> <span class="ot">TRUE</span>, <span class="dt">prob =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="fl">0.75</span>, <span class="fl">0.1</span>, <span class="fl">0.15</span>)),</a>
|
||||||
|
<a class="sourceLine" id="cb6-9" data-line-number="9"> <span class="dt">cipr =</span> <span class="kw"><a href="http://dplyr.tidyverse.org/reference/sample.html">sample</a></span>(ab_interpretations, <span class="dv">5000</span>, <span class="dt">replace =</span> <span class="ot">TRUE</span>, <span class="dt">prob =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="fl">0.8</span>, <span class="dv">0</span>, <span class="fl">0.2</span>)),</a>
|
||||||
|
<a class="sourceLine" id="cb6-10" data-line-number="10"> <span class="dt">gent =</span> <span class="kw"><a href="http://dplyr.tidyverse.org/reference/sample.html">sample</a></span>(ab_interpretations, <span class="dv">5000</span>, <span class="dt">replace =</span> <span class="ot">TRUE</span>, <span class="dt">prob =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="fl">0.92</span>, <span class="dv">0</span>, <span class="fl">0.07</span>))</a>
|
||||||
|
<a class="sourceLine" id="cb6-11" data-line-number="11"> )</a></code></pre></div>
|
||||||
|
<p>The resulting data set contains 5,000 blood culture isolates. With the <code><a href="https://www.rdocumentation.org/packages/utils/topics/head">head()</a></code> function we can preview the first 6 values of this data set:</p>
|
||||||
|
<div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb7-1" data-line-number="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/utils/topics/head">head</a></span>(data)</a></code></pre></div>
|
||||||
|
<table class="table">
|
||||||
|
<thead><tr class="header">
|
||||||
|
<th align="center">date</th>
|
||||||
|
<th align="center">patient_id</th>
|
||||||
|
<th align="center">gender</th>
|
||||||
|
<th align="center">hospital</th>
|
||||||
|
<th align="center">bacteria</th>
|
||||||
|
<th align="center">amox</th>
|
||||||
|
<th align="center">amcl</th>
|
||||||
|
<th align="center">cipr</th>
|
||||||
|
<th align="center">gent</th>
|
||||||
|
</tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr class="odd">
|
||||||
|
<td align="center">2017-01-24</td>
|
||||||
|
<td align="center">M8</td>
|
||||||
|
<td align="center">F</td>
|
||||||
|
<td align="center">Hospital D</td>
|
||||||
|
<td align="center">Streptococcus pneumoniae</td>
|
||||||
|
<td align="center">I</td>
|
||||||
|
<td align="center">R</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="even">
|
||||||
|
<td align="center">2016-12-18</td>
|
||||||
|
<td align="center">J6</td>
|
||||||
|
<td align="center">M</td>
|
||||||
|
<td align="center">Hospital A</td>
|
||||||
|
<td align="center">Escherichia coli</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="odd">
|
||||||
|
<td align="center">2015-06-29</td>
|
||||||
|
<td align="center">E1</td>
|
||||||
|
<td align="center">M</td>
|
||||||
|
<td align="center">Hospital C</td>
|
||||||
|
<td align="center">Escherichia coli</td>
|
||||||
|
<td align="center">R</td>
|
||||||
|
<td align="center">R</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="even">
|
||||||
|
<td align="center">2013-02-28</td>
|
||||||
|
<td align="center">B1</td>
|
||||||
|
<td align="center">M</td>
|
||||||
|
<td align="center">Hospital C</td>
|
||||||
|
<td align="center">Escherichia coli</td>
|
||||||
|
<td align="center">R</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="odd">
|
||||||
|
<td align="center">2013-05-19</td>
|
||||||
|
<td align="center">N8</td>
|
||||||
|
<td align="center">M</td>
|
||||||
|
<td align="center">Hospital A</td>
|
||||||
|
<td align="center">Streptococcus pneumoniae</td>
|
||||||
|
<td align="center">R</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">R</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="even">
|
||||||
|
<td align="center">2014-04-02</td>
|
||||||
|
<td align="center">M2</td>
|
||||||
|
<td align="center">M</td>
|
||||||
|
<td align="center">Hospital D</td>
|
||||||
|
<td align="center">Staphylococcus aureus</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">R</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p>Now, let’s start the cleaning and the analysis!</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="cleaning-the-data" class="section level2">
|
||||||
|
<h2 class="hasAnchor">
|
||||||
|
<a href="#cleaning-the-data" class="anchor"></a>Cleaning the data</h2>
|
||||||
|
<p>Use the frequency table function <code><a href="../reference/freq.html">freq()</a></code> to look specifically for unique values in every variables. For example, for the <code>gender</code> variable:</p>
|
||||||
|
<div class="sourceCode" id="cb8"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb8-1" data-line-number="1">data <span class="op">%>%</span><span class="st"> </span><span class="kw"><a href="../reference/freq.html">freq</a></span>(gender) <span class="co"># this would be the same: freq(data$gender)</span></a></code></pre></div>
|
||||||
|
<pre><code># Frequency table of `gender`
|
||||||
|
# Class: factor (numeric)
|
||||||
|
# Levels: F, M
|
||||||
|
# Length: 5,000 (of which NA: 0 = 0.00%)
|
||||||
|
# Unique: 2
|
||||||
|
#
|
||||||
|
# Item Count Percent Cum. Count Cum. Percent
|
||||||
|
# --- ----- ------ -------- ----------- -------------
|
||||||
|
# 1 M 2,773 55.5% 2,773 55.5%
|
||||||
|
# 2 F 2,227 44.5% 5,000 100.0%</code></pre>
|
||||||
|
<p>So, we can draw at least two conclusions immediately. From a data scientist perspective, the data looks clean: only values <code>M</code> and <code>F</code>. From a researcher perspective: there are slightly more men. Nothing we didn’t already know.</p>
|
||||||
|
<p>The data is already quite clean, but we still need to transform some variables. The <code>bacteria</code> column now consists of text, and we want to add more variables based on microbial IDs later on. So, we will transform this column to valid IDs. The <code>mutate</code> function of the dplyr package makes this really easy:</p>
|
||||||
|
<div class="sourceCode" id="cb10"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb10-1" data-line-number="1">data <-<span class="st"> </span>data <span class="op">%>%</span></a>
|
||||||
|
<a class="sourceLine" id="cb10-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="http://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span>(<span class="dt">bacteria =</span> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(bacteria))</a></code></pre></div>
|
||||||
|
<p>We also want to transform the antibiotics, because in real life data we don’t know if they are really clean. The <code><a href="../reference/as.rsi.html">as.rsi()</a></code> function ensures reliability and reproducibility in these kind of variables. The <code><a href="http://dplyr.tidyverse.org/reference/summarise_all.html">mutate_at()</a></code> will run the <code><a href="../reference/as.rsi.html">as.rsi()</a></code> function on defined variables:</p>
|
||||||
|
<div class="sourceCode" id="cb11"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb11-1" data-line-number="1">data <-<span class="st"> </span>data <span class="op">%>%</span></a>
|
||||||
|
<a class="sourceLine" id="cb11-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="http://dplyr.tidyverse.org/reference/summarise_all.html">mutate_at</a></span>(<span class="kw"><a href="http://dplyr.tidyverse.org/reference/vars.html">vars</a></span>(amox<span class="op">:</span>cipr), as.rsi)</a></code></pre></div>
|
||||||
|
<p>Finally, we will apply <a href="http://www.eucast.org/expert_rules_and_intrinsic_resistance/">EUCAST rules</a> on our antimicrobial results. In Europe, most medical microbiological laboratories already apply these rules. Our package features their latest insights on intrinsic resistance and exceptional phenotypes. Moreover, the <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code> function can also apply additional rules, like forcing <help title="ATC: J01CA01">ampicillin</help> = R when <help title="ATC: J01CR02">amoxicillin/clavulanic acid</help> = R.</p>
|
||||||
|
<p>Because the amoxicillin (column <code>amox</code>) and amoxicillin/clavulanic acid (column <code>amcl</code>) in our data were generated randomly, some rows will undoubtedly contain amox = S and amcl = R, which is technically impossible. The <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code> fixes this:</p>
|
||||||
|
<div class="sourceCode" id="cb12"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb12-1" data-line-number="1">data <-<span class="st"> </span><span class="kw"><a href="../reference/eucast_rules.html">eucast_rules</a></span>(data, <span class="dt">col_mo =</span> <span class="st">"bacteria"</span>)</a>
|
||||||
|
<a class="sourceLine" id="cb12-2" data-line-number="2"><span class="co"># </span></a>
|
||||||
|
<a class="sourceLine" id="cb12-3" data-line-number="3"><span class="co"># Rules by the European Committee on Antimicrobial Susceptibility Testing (EUCAST)</span></a>
|
||||||
|
<a class="sourceLine" id="cb12-4" data-line-number="4"><span class="co"># </span></a>
|
||||||
|
<a class="sourceLine" id="cb12-5" data-line-number="5"><span class="co"># EUCAST Clinical Breakpoints (v8.1, 2018)</span></a>
|
||||||
|
<a class="sourceLine" id="cb12-6" data-line-number="6"><span class="co"># Enterobacteriales (Order) (no changes)</span></a>
|
||||||
|
<a class="sourceLine" id="cb12-7" data-line-number="7"><span class="co"># Staphylococcus (no changes)</span></a>
|
||||||
|
<a class="sourceLine" id="cb12-8" data-line-number="8"><span class="co"># Enterococcus (no changes)</span></a>
|
||||||
|
<a class="sourceLine" id="cb12-9" data-line-number="9"><span class="co"># Streptococcus groups A, B, C, G (no changes)</span></a>
|
||||||
|
<a class="sourceLine" id="cb12-10" data-line-number="10"><span class="co"># Streptococcus pneumoniae (386 changes)</span></a>
|
||||||
|
<a class="sourceLine" id="cb12-11" data-line-number="11"><span class="co"># Viridans group streptococci (no changes)</span></a>
|
||||||
|
<a class="sourceLine" id="cb12-12" data-line-number="12"><span class="co"># Haemophilus influenzae (no changes)</span></a>
|
||||||
|
<a class="sourceLine" id="cb12-13" data-line-number="13"><span class="co"># Moraxella catarrhalis (no changes)</span></a>
|
||||||
|
<a class="sourceLine" id="cb12-14" data-line-number="14"><span class="co"># Anaerobic Gram positives (no changes)</span></a>
|
||||||
|
<a class="sourceLine" id="cb12-15" data-line-number="15"><span class="co"># Anaerobic Gram negatives (no changes)</span></a>
|
||||||
|
<a class="sourceLine" id="cb12-16" data-line-number="16"><span class="co"># Pasteurella multocida (no changes)</span></a>
|
||||||
|
<a class="sourceLine" id="cb12-17" data-line-number="17"><span class="co"># Campylobacter jejuni and C. coli (no changes)</span></a>
|
||||||
|
<a class="sourceLine" id="cb12-18" data-line-number="18"><span class="co"># Aerococcus sanguinicola and A. urinae (no changes)</span></a>
|
||||||
|
<a class="sourceLine" id="cb12-19" data-line-number="19"><span class="co"># Kingella kingae (no changes)</span></a>
|
||||||
|
<a class="sourceLine" id="cb12-20" data-line-number="20"><span class="co"># </span></a>
|
||||||
|
<a class="sourceLine" id="cb12-21" data-line-number="21"><span class="co"># EUCAST Expert Rules, Intrinsic Resistance and Exceptional Phenotypes (v3.1, 2016)</span></a>
|
||||||
|
<a class="sourceLine" id="cb12-22" data-line-number="22"><span class="co"># Table 1: Intrinsic resistance in Enterobacteriaceae (342 changes)</span></a>
|
||||||
|
<a class="sourceLine" id="cb12-23" data-line-number="23"><span class="co"># Table 2: Intrinsic resistance in non-fermentative Gram-negative bacteria (no changes)</span></a>
|
||||||
|
<a class="sourceLine" id="cb12-24" data-line-number="24"><span class="co"># Table 3: Intrinsic resistance in other Gram-negative bacteria (no changes)</span></a>
|
||||||
|
<a class="sourceLine" id="cb12-25" data-line-number="25"><span class="co"># Table 4: Intrinsic resistance in Gram-positive bacteria (705 changes)</span></a>
|
||||||
|
<a class="sourceLine" id="cb12-26" data-line-number="26"><span class="co"># Table 8: Interpretive rules for B-lactam agents and Gram-positive cocci (no changes)</span></a>
|
||||||
|
<a class="sourceLine" id="cb12-27" data-line-number="27"><span class="co"># Table 9: Interpretive rules for B-lactam agents and Gram-negative rods (no changes)</span></a>
|
||||||
|
<a class="sourceLine" id="cb12-28" data-line-number="28"><span class="co"># Table 10: Interpretive rules for B-lactam agents and other Gram-negative bacteria (no changes)</span></a>
|
||||||
|
<a class="sourceLine" id="cb12-29" data-line-number="29"><span class="co"># Table 11: Interpretive rules for macrolides, lincosamides, and streptogramins (no changes)</span></a>
|
||||||
|
<a class="sourceLine" id="cb12-30" data-line-number="30"><span class="co"># Table 12: Interpretive rules for aminoglycosides (no changes)</span></a>
|
||||||
|
<a class="sourceLine" id="cb12-31" data-line-number="31"><span class="co"># Table 13: Interpretive rules for quinolones (no changes)</span></a>
|
||||||
|
<a class="sourceLine" id="cb12-32" data-line-number="32"><span class="co"># </span></a>
|
||||||
|
<a class="sourceLine" id="cb12-33" data-line-number="33"><span class="co"># Other rules</span></a>
|
||||||
|
<a class="sourceLine" id="cb12-34" data-line-number="34"><span class="co"># Non-EUCAST: ampicillin = R where amoxicillin/clav acid = R (364 changes)</span></a>
|
||||||
|
<a class="sourceLine" id="cb12-35" data-line-number="35"><span class="co"># Non-EUCAST: piperacillin = R where piperacillin/tazobactam = R (no changes)</span></a>
|
||||||
|
<a class="sourceLine" id="cb12-36" data-line-number="36"><span class="co"># Non-EUCAST: trimethoprim = R where trimethoprim/sulfa = R (no changes)</span></a>
|
||||||
|
<a class="sourceLine" id="cb12-37" data-line-number="37"><span class="co"># Non-EUCAST: amoxicillin/clav acid = S where ampicillin = S (211 changes)</span></a>
|
||||||
|
<a class="sourceLine" id="cb12-38" data-line-number="38"><span class="co"># Non-EUCAST: piperacillin/tazobactam = S where piperacillin = S (no changes)</span></a>
|
||||||
|
<a class="sourceLine" id="cb12-39" data-line-number="39"><span class="co"># Non-EUCAST: trimethoprim/sulfa = S where trimethoprim = S (no changes)</span></a>
|
||||||
|
<a class="sourceLine" id="cb12-40" data-line-number="40"><span class="co"># </span></a>
|
||||||
|
<a class="sourceLine" id="cb12-41" data-line-number="41"><span class="co"># => EUCAST rules affected 4,626 out of 5,000 rows -> changed 2,008 test results.</span></a></code></pre></div>
|
||||||
|
</div>
|
||||||
|
<div id="adding-new-variables" class="section level2">
|
||||||
|
<h2 class="hasAnchor">
|
||||||
|
<a href="#adding-new-variables" class="anchor"></a>Adding new variables</h2>
|
||||||
|
<p>Now we have the microbial ID, we can add some taxonomic properties:</p>
|
||||||
|
<div class="sourceCode" id="cb13"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb13-1" data-line-number="1">data <-<span class="st"> </span>data <span class="op">%>%</span><span class="st"> </span></a>
|
||||||
|
<a class="sourceLine" id="cb13-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="http://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span>(<span class="dt">gramstain =</span> <span class="kw"><a href="../reference/mo_property.html">mo_gramstain</a></span>(bacteria),</a>
|
||||||
|
<a class="sourceLine" id="cb13-3" data-line-number="3"> <span class="dt">family =</span> <span class="kw"><a href="../reference/mo_property.html">mo_family</a></span>(bacteria))</a></code></pre></div>
|
||||||
|
<div id="first-isolates" class="section level3">
|
||||||
|
<h3 class="hasAnchor">
|
||||||
|
<a href="#first-isolates" class="anchor"></a>First isolates</h3>
|
||||||
|
<p>We also need to know which isolates we can <em>actually</em> use for analysis.</p>
|
||||||
|
<p>To conduct an analysis of antimicrobial resistance, you <a href="https://www.ncbi.nlm.nih.gov/pubmed/17304462">must only include the first isolate of every patient per episode</a>. If you would not do this, you could easily get an overestimate or underestimate of the resistance of an antibiotic. Imagine that a patient was admitted with an MRSA and that it was found in 5 different blood cultures the following weeks (yes, some countries like the Netherlands have these blood drawing policies). The resistance percentage of oxacillin of all isolates would be overestimated, because you included this MRSA more than once. It would clearly be .</p>
|
||||||
|
<p>The Clinical and Laboratory Standards Institute (CLSI) appoints this as follows:</p>
|
||||||
|
<blockquote>
|
||||||
|
<p><em>(…) When preparing a cumulative antibiogram to guide clinical decisions about empirical antimicrobial therapy of initial infections, <strong>only the first isolate of a given species per patient, per analysis period (eg, one year) should be included, irrespective of body site, antimicrobial susceptibility profile, or other phenotypical characteristics (eg, biotype)</strong>. The first isolate is easily identified, and cumulative antimicrobial susceptibility test data prepared using the first isolate are generally comparable to cumulative antimicrobial susceptibility test data calculated by other methods, providing duplicate isolates are excluded.</em> Chapter 6.4, M39-A4 Analysis and Presentation of Cumulative Antimicrobial Susceptibility Test Data, 4th Edition. CLSI, 2014. <a href="https://clsi.org/standards/products/microbiology/documents/m39/" class="uri">https://clsi.org/standards/products/microbiology/documents/m39/</a></p>
|
||||||
|
</blockquote>
|
||||||
|
<p>This <code>AMR</code> package includes this methodology with the <code><a href="../reference/first_isolate.html">first_isolate()</a></code> function. It adopts the episode of a year (can be changed by user) and it starts counting days after every selected isolate. This new variable can easily be added to our data:</p>
|
||||||
|
<div class="sourceCode" id="cb14"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb14-1" data-line-number="1">data <-<span class="st"> </span>data <span class="op">%>%</span><span class="st"> </span></a>
|
||||||
|
<a class="sourceLine" id="cb14-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="http://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span>(<span class="dt">first =</span> <span class="kw"><a href="../reference/first_isolate.html">first_isolate</a></span>(.))</a>
|
||||||
|
<a class="sourceLine" id="cb14-3" data-line-number="3"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `bacteria` as input for `col_mo`.</span></a>
|
||||||
|
<a class="sourceLine" id="cb14-4" data-line-number="4"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `date` as input for `col_date`.</span></a>
|
||||||
|
<a class="sourceLine" id="cb14-5" data-line-number="5"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `patient_id` as input for `col_patient_id`.</span></a>
|
||||||
|
<a class="sourceLine" id="cb14-6" data-line-number="6"><span class="co"># => Found 2,913 first isolates (58.3% of total)</span></a></code></pre></div>
|
||||||
|
<p>So only 58.3% is suitable for resistance analysis! We can now filter on is with the <code><a href="http://dplyr.tidyverse.org/reference/filter.html">filter()</a></code> function, also from the <code>dplyr</code> package:</p>
|
||||||
|
<div class="sourceCode" id="cb15"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb15-1" data-line-number="1">data_1st <-<span class="st"> </span>data <span class="op">%>%</span><span class="st"> </span></a>
|
||||||
|
<a class="sourceLine" id="cb15-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="http://dplyr.tidyverse.org/reference/filter.html">filter</a></span>(first <span class="op">==</span><span class="st"> </span><span class="ot">TRUE</span>)</a></code></pre></div>
|
||||||
|
<p>For future use, the above two syntaxes can be shortened with the <code><a href="../reference/first_isolate.html">filter_first_isolate()</a></code> function:</p>
|
||||||
|
<div class="sourceCode" id="cb16"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb16-1" data-line-number="1">data_1st <-<span class="st"> </span>data <span class="op">%>%</span><span class="st"> </span></a>
|
||||||
|
<a class="sourceLine" id="cb16-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="../reference/first_isolate.html">filter_first_isolate</a></span>()</a></code></pre></div>
|
||||||
|
</div>
|
||||||
|
<div id="first-weighted-isolates" class="section level3">
|
||||||
|
<h3 class="hasAnchor">
|
||||||
|
<a href="#first-weighted-isolates" class="anchor"></a>First <em>weighted</em> isolates</h3>
|
||||||
|
<p>We made a slight twist to the CLSI algorithm, to take into account antimicrobial results. Imagine this data, sorted on date:</p>
|
||||||
|
<table class="table">
|
||||||
|
<thead><tr class="header">
|
||||||
|
<th align="center">isolate</th>
|
||||||
|
<th align="center">date</th>
|
||||||
|
<th align="center">patient_id</th>
|
||||||
|
<th align="center">bacteria</th>
|
||||||
|
<th align="center">amox</th>
|
||||||
|
<th align="center">amcl</th>
|
||||||
|
<th align="center">cipr</th>
|
||||||
|
<th align="center">gent</th>
|
||||||
|
<th align="center">first</th>
|
||||||
|
</tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr class="odd">
|
||||||
|
<td align="center">1</td>
|
||||||
|
<td align="center">2010-07-19</td>
|
||||||
|
<td align="center">S6</td>
|
||||||
|
<td align="center">B_ESCHR_COL</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">TRUE</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="even">
|
||||||
|
<td align="center">2</td>
|
||||||
|
<td align="center">2010-10-13</td>
|
||||||
|
<td align="center">S6</td>
|
||||||
|
<td align="center">B_ESCHR_COL</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">FALSE</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="odd">
|
||||||
|
<td align="center">3</td>
|
||||||
|
<td align="center">2010-12-24</td>
|
||||||
|
<td align="center">S6</td>
|
||||||
|
<td align="center">B_ESCHR_COL</td>
|
||||||
|
<td align="center">R</td>
|
||||||
|
<td align="center">I</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">FALSE</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="even">
|
||||||
|
<td align="center">4</td>
|
||||||
|
<td align="center">2011-01-02</td>
|
||||||
|
<td align="center">S6</td>
|
||||||
|
<td align="center">B_ESCHR_COL</td>
|
||||||
|
<td align="center">R</td>
|
||||||
|
<td align="center">I</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">R</td>
|
||||||
|
<td align="center">FALSE</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="odd">
|
||||||
|
<td align="center">5</td>
|
||||||
|
<td align="center">2011-01-23</td>
|
||||||
|
<td align="center">S6</td>
|
||||||
|
<td align="center">B_ESCHR_COL</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">FALSE</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="even">
|
||||||
|
<td align="center">6</td>
|
||||||
|
<td align="center">2011-05-16</td>
|
||||||
|
<td align="center">S6</td>
|
||||||
|
<td align="center">B_ESCHR_COL</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">FALSE</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="odd">
|
||||||
|
<td align="center">7</td>
|
||||||
|
<td align="center">2011-10-13</td>
|
||||||
|
<td align="center">S6</td>
|
||||||
|
<td align="center">B_ESCHR_COL</td>
|
||||||
|
<td align="center">R</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">TRUE</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="even">
|
||||||
|
<td align="center">8</td>
|
||||||
|
<td align="center">2012-03-25</td>
|
||||||
|
<td align="center">S6</td>
|
||||||
|
<td align="center">B_ESCHR_COL</td>
|
||||||
|
<td align="center">R</td>
|
||||||
|
<td align="center">I</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">FALSE</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="odd">
|
||||||
|
<td align="center">9</td>
|
||||||
|
<td align="center">2012-09-01</td>
|
||||||
|
<td align="center">S6</td>
|
||||||
|
<td align="center">B_ESCHR_COL</td>
|
||||||
|
<td align="center">R</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">FALSE</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="even">
|
||||||
|
<td align="center">10</td>
|
||||||
|
<td align="center">2012-10-04</td>
|
||||||
|
<td align="center">S6</td>
|
||||||
|
<td align="center">B_ESCHR_COL</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">FALSE</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p>Only 2 isolates are marked as ‘first’ according to CLSI guideline. But when reviewing the antibiogram, it is obvious that some isolates are absolutely different strains and show be included too. This is why we weigh isolates, based on their antibiogram. The <code><a href="../reference/key_antibiotics.html">key_antibiotics()</a></code> function adds a vector with 18 key antibiotics: 6 broad spectrum ones, 6 small spectrum for Gram negatives and 6 small spectrum for Gram positives. These can be defined by the user.</p>
|
||||||
|
<p>If a column exists with a name like ‘key(…)ab’ the <code><a href="../reference/first_isolate.html">first_isolate()</a></code> function will automatically use it and determine the first weighted isolates. Mind the NOTEs in below output:</p>
|
||||||
|
<div class="sourceCode" id="cb17"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb17-1" data-line-number="1">data <-<span class="st"> </span>data <span class="op">%>%</span><span class="st"> </span></a>
|
||||||
|
<a class="sourceLine" id="cb17-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="http://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span>(<span class="dt">keyab =</span> <span class="kw"><a href="../reference/key_antibiotics.html">key_antibiotics</a></span>(.)) <span class="op">%>%</span><span class="st"> </span></a>
|
||||||
|
<a class="sourceLine" id="cb17-3" data-line-number="3"><span class="st"> </span><span class="kw"><a href="http://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span>(<span class="dt">first_weighted =</span> <span class="kw"><a href="../reference/first_isolate.html">first_isolate</a></span>(.))</a>
|
||||||
|
<a class="sourceLine" id="cb17-4" data-line-number="4"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `bacteria` as input for `col_mo`.</span></a>
|
||||||
|
<a class="sourceLine" id="cb17-5" data-line-number="5"><span class="co"># Warning: These columns do not exist and will be ignored: cfur, pita, trsu, vanc, teic, tetr, eryt, oxac, rifa, tobr, coli, cfot, cfta, mero.</span></a>
|
||||||
|
<a class="sourceLine" id="cb17-6" data-line-number="6"><span class="co"># THIS MAY STRONGLY INFLUENCE THE OUTCOME.</span></a>
|
||||||
|
<a class="sourceLine" id="cb17-7" data-line-number="7"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `bacteria` as input for `col_mo`.</span></a>
|
||||||
|
<a class="sourceLine" id="cb17-8" data-line-number="8"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `date` as input for `col_date`.</span></a>
|
||||||
|
<a class="sourceLine" id="cb17-9" data-line-number="9"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `patient_id` as input for `col_patient_id`.</span></a>
|
||||||
|
<a class="sourceLine" id="cb17-10" data-line-number="10"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `keyab` as input for `col_keyantibiotics`. Use col_keyantibiotics = FALSE to prevent this.</span></a>
|
||||||
|
<a class="sourceLine" id="cb17-11" data-line-number="11"><span class="co"># [Criterion] Inclusion based on key antibiotics, ignoring I.</span></a>
|
||||||
|
<a class="sourceLine" id="cb17-12" data-line-number="12"><span class="co"># => Found 4,318 first weighted isolates (86.4% of total)</span></a></code></pre></div>
|
||||||
|
<table class="table">
|
||||||
|
<thead><tr class="header">
|
||||||
|
<th align="center">isolate</th>
|
||||||
|
<th align="center">date</th>
|
||||||
|
<th align="center">patient_id</th>
|
||||||
|
<th align="center">bacteria</th>
|
||||||
|
<th align="center">amox</th>
|
||||||
|
<th align="center">amcl</th>
|
||||||
|
<th align="center">cipr</th>
|
||||||
|
<th align="center">gent</th>
|
||||||
|
<th align="center">first</th>
|
||||||
|
<th align="center">first_weighted</th>
|
||||||
|
</tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr class="odd">
|
||||||
|
<td align="center">1</td>
|
||||||
|
<td align="center">2010-07-19</td>
|
||||||
|
<td align="center">S6</td>
|
||||||
|
<td align="center">B_ESCHR_COL</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">TRUE</td>
|
||||||
|
<td align="center">TRUE</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="even">
|
||||||
|
<td align="center">2</td>
|
||||||
|
<td align="center">2010-10-13</td>
|
||||||
|
<td align="center">S6</td>
|
||||||
|
<td align="center">B_ESCHR_COL</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">FALSE</td>
|
||||||
|
<td align="center">FALSE</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="odd">
|
||||||
|
<td align="center">3</td>
|
||||||
|
<td align="center">2010-12-24</td>
|
||||||
|
<td align="center">S6</td>
|
||||||
|
<td align="center">B_ESCHR_COL</td>
|
||||||
|
<td align="center">R</td>
|
||||||
|
<td align="center">I</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">FALSE</td>
|
||||||
|
<td align="center">TRUE</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="even">
|
||||||
|
<td align="center">4</td>
|
||||||
|
<td align="center">2011-01-02</td>
|
||||||
|
<td align="center">S6</td>
|
||||||
|
<td align="center">B_ESCHR_COL</td>
|
||||||
|
<td align="center">R</td>
|
||||||
|
<td align="center">I</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">R</td>
|
||||||
|
<td align="center">FALSE</td>
|
||||||
|
<td align="center">TRUE</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="odd">
|
||||||
|
<td align="center">5</td>
|
||||||
|
<td align="center">2011-01-23</td>
|
||||||
|
<td align="center">S6</td>
|
||||||
|
<td align="center">B_ESCHR_COL</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">FALSE</td>
|
||||||
|
<td align="center">TRUE</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="even">
|
||||||
|
<td align="center">6</td>
|
||||||
|
<td align="center">2011-05-16</td>
|
||||||
|
<td align="center">S6</td>
|
||||||
|
<td align="center">B_ESCHR_COL</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">FALSE</td>
|
||||||
|
<td align="center">FALSE</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="odd">
|
||||||
|
<td align="center">7</td>
|
||||||
|
<td align="center">2011-10-13</td>
|
||||||
|
<td align="center">S6</td>
|
||||||
|
<td align="center">B_ESCHR_COL</td>
|
||||||
|
<td align="center">R</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">TRUE</td>
|
||||||
|
<td align="center">TRUE</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="even">
|
||||||
|
<td align="center">8</td>
|
||||||
|
<td align="center">2012-03-25</td>
|
||||||
|
<td align="center">S6</td>
|
||||||
|
<td align="center">B_ESCHR_COL</td>
|
||||||
|
<td align="center">R</td>
|
||||||
|
<td align="center">I</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">FALSE</td>
|
||||||
|
<td align="center">FALSE</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="odd">
|
||||||
|
<td align="center">9</td>
|
||||||
|
<td align="center">2012-09-01</td>
|
||||||
|
<td align="center">S6</td>
|
||||||
|
<td align="center">B_ESCHR_COL</td>
|
||||||
|
<td align="center">R</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">FALSE</td>
|
||||||
|
<td align="center">FALSE</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="even">
|
||||||
|
<td align="center">10</td>
|
||||||
|
<td align="center">2012-10-04</td>
|
||||||
|
<td align="center">S6</td>
|
||||||
|
<td align="center">B_ESCHR_COL</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">FALSE</td>
|
||||||
|
<td align="center">TRUE</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p>Instead of 2, now 6 isolates are flagged. In total, 86.4% of all isolates are marked ‘first weighted’ - 28.1% more than when using the CLSI guideline. In real life, this novel algorithm will yield 5-10% more isolates than the classic CLSI guideline.</p>
|
||||||
|
<p>As with <code><a href="../reference/first_isolate.html">filter_first_isolate()</a></code>, there’s a shortcut for this new algorithm too:</p>
|
||||||
|
<div class="sourceCode" id="cb18"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb18-1" data-line-number="1">data_1st <-<span class="st"> </span>data <span class="op">%>%</span><span class="st"> </span></a>
|
||||||
|
<a class="sourceLine" id="cb18-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="../reference/first_isolate.html">filter_first_weighted_isolate</a></span>()</a></code></pre></div>
|
||||||
|
<p>So we end up with 4,318 isolates for analysis.</p>
|
||||||
|
<p>We can remove unneeded columns:</p>
|
||||||
|
<div class="sourceCode" id="cb19"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb19-1" data-line-number="1">data_1st <-<span class="st"> </span>data_1st <span class="op">%>%</span><span class="st"> </span></a>
|
||||||
|
<a class="sourceLine" id="cb19-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="http://dplyr.tidyverse.org/reference/select.html">select</a></span>(<span class="op">-</span>first, <span class="op">-</span>keyab)</a></code></pre></div>
|
||||||
|
<p>Now our data looks like:</p>
|
||||||
|
<div class="sourceCode" id="cb20"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb20-1" data-line-number="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/utils/topics/head">head</a></span>(data_1st)</a></code></pre></div>
|
||||||
|
<table class="table">
|
||||||
|
<thead><tr class="header">
|
||||||
|
<th></th>
|
||||||
|
<th align="center">date</th>
|
||||||
|
<th align="center">patient_id</th>
|
||||||
|
<th align="center">gender</th>
|
||||||
|
<th align="center">hospital</th>
|
||||||
|
<th align="center">bacteria</th>
|
||||||
|
<th align="center">amox</th>
|
||||||
|
<th align="center">amcl</th>
|
||||||
|
<th align="center">cipr</th>
|
||||||
|
<th align="center">gent</th>
|
||||||
|
<th align="center">gramstain</th>
|
||||||
|
<th align="center">family</th>
|
||||||
|
<th align="center">first_weighted</th>
|
||||||
|
</tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr class="odd">
|
||||||
|
<td>1</td>
|
||||||
|
<td align="center">2017-01-24</td>
|
||||||
|
<td align="center">M8</td>
|
||||||
|
<td align="center">F</td>
|
||||||
|
<td align="center">Hospital D</td>
|
||||||
|
<td align="center">B_STRPTC_PNE</td>
|
||||||
|
<td align="center">I</td>
|
||||||
|
<td align="center">I</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">R</td>
|
||||||
|
<td align="center">Gram positive</td>
|
||||||
|
<td align="center">Streptococcaceae</td>
|
||||||
|
<td align="center">TRUE</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="even">
|
||||||
|
<td>2</td>
|
||||||
|
<td align="center">2016-12-18</td>
|
||||||
|
<td align="center">J6</td>
|
||||||
|
<td align="center">M</td>
|
||||||
|
<td align="center">Hospital A</td>
|
||||||
|
<td align="center">B_ESCHR_COL</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">Gram negative</td>
|
||||||
|
<td align="center">Enterobacteriaceae</td>
|
||||||
|
<td align="center">TRUE</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="odd">
|
||||||
|
<td>3</td>
|
||||||
|
<td align="center">2015-06-29</td>
|
||||||
|
<td align="center">E1</td>
|
||||||
|
<td align="center">M</td>
|
||||||
|
<td align="center">Hospital C</td>
|
||||||
|
<td align="center">B_ESCHR_COL</td>
|
||||||
|
<td align="center">R</td>
|
||||||
|
<td align="center">R</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">Gram negative</td>
|
||||||
|
<td align="center">Enterobacteriaceae</td>
|
||||||
|
<td align="center">TRUE</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="even">
|
||||||
|
<td>4</td>
|
||||||
|
<td align="center">2013-02-28</td>
|
||||||
|
<td align="center">B1</td>
|
||||||
|
<td align="center">M</td>
|
||||||
|
<td align="center">Hospital C</td>
|
||||||
|
<td align="center">B_ESCHR_COL</td>
|
||||||
|
<td align="center">R</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">Gram negative</td>
|
||||||
|
<td align="center">Enterobacteriaceae</td>
|
||||||
|
<td align="center">TRUE</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="odd">
|
||||||
|
<td>6</td>
|
||||||
|
<td align="center">2014-04-02</td>
|
||||||
|
<td align="center">M2</td>
|
||||||
|
<td align="center">M</td>
|
||||||
|
<td align="center">Hospital D</td>
|
||||||
|
<td align="center">B_STPHY_AUR</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">R</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">Gram positive</td>
|
||||||
|
<td align="center">Staphylococcaceae</td>
|
||||||
|
<td align="center">TRUE</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="even">
|
||||||
|
<td>7</td>
|
||||||
|
<td align="center">2015-11-12</td>
|
||||||
|
<td align="center">E2</td>
|
||||||
|
<td align="center">M</td>
|
||||||
|
<td align="center">Hospital B</td>
|
||||||
|
<td align="center">B_KLBSL_PNE</td>
|
||||||
|
<td align="center">R</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">R</td>
|
||||||
|
<td align="center">S</td>
|
||||||
|
<td align="center">Gram negative</td>
|
||||||
|
<td align="center">Enterobacteriaceae</td>
|
||||||
|
<td align="center">TRUE</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p>Time for the analysis!</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="analysing-the-data" class="section level2">
|
||||||
|
<h2 class="hasAnchor">
|
||||||
|
<a href="#analysing-the-data" class="anchor"></a>Analysing the data</h2>
|
||||||
|
<p>(work in progress)</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
|
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
|
||||||
|
<div id="tocnav">
|
||||||
|
<h2 class="hasAnchor">
|
||||||
|
<a href="#tocnav" class="anchor"></a>Contents</h2>
|
||||||
|
<ul class="nav nav-pills nav-stacked">
|
||||||
|
<li><a href="#introduction">Introduction</a></li>
|
||||||
|
<li>
|
||||||
|
<a href="#tutorial">Tutorial</a><ul class="nav nav-pills nav-stacked">
|
||||||
|
<li><a href="#needed-r-packages">Needed R packages</a></li>
|
||||||
|
<li><a href="#creation-of-data">Creation of data</a></li>
|
||||||
|
<li><a href="#cleaning-the-data">Cleaning the data</a></li>
|
||||||
|
<li><a href="#adding-new-variables">Adding new variables</a></li>
|
||||||
|
<li><a href="#analysing-the-data">Analysing the data</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -28,10 +28,24 @@ pre, code {
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
}
|
}
|
||||||
|
pre {
|
||||||
|
font-size: 90% !important;
|
||||||
|
}
|
||||||
li, p {
|
li, p {
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* slightly smaller blockquote */
|
||||||
|
blockquote {
|
||||||
|
font-size: 98%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 2nd list in navigation should be smaller */
|
||||||
|
#tocnav li li {
|
||||||
|
font-size: 90%;
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
/* new <help> element with dotted underline */
|
/* new <help> element with dotted underline */
|
||||||
help {
|
help {
|
||||||
border-bottom: 1px dotted;
|
border-bottom: 1px dotted;
|
||||||
@ -60,3 +74,18 @@ help {
|
|||||||
#navbar .fas {
|
#navbar .fas {
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* tables */
|
||||||
|
.table {
|
||||||
|
font-size: 90%;
|
||||||
|
}
|
||||||
|
.table td {
|
||||||
|
padding: 4px !important;
|
||||||
|
}
|
||||||
|
thead {
|
||||||
|
border-top: 2px solid black;
|
||||||
|
border-bottom: 2px solid black;
|
||||||
|
}
|
||||||
|
tbody {
|
||||||
|
border-bottom: 2px solid black;
|
||||||
|
}
|
||||||
|
@ -169,6 +169,62 @@
|
|||||||
<h3 class="hasAnchor">
|
<h3 class="hasAnchor">
|
||||||
<a href="#get-started" class="anchor"></a>Get started</h3>
|
<a href="#get-started" class="anchor"></a>Get started</h3>
|
||||||
<p>To find out how to conduct AMR analysis, please <a href="./articles/AMR.html">continue reading here to get started</a> or click the button ‘Get Started’ in the top menu.</p>
|
<p>To find out how to conduct AMR analysis, please <a href="./articles/AMR.html">continue reading here to get started</a> or click the button ‘Get Started’ in the top menu.</p>
|
||||||
|
</div>
|
||||||
|
<div id="short-introduction" class="section level3">
|
||||||
|
<h3 class="hasAnchor">
|
||||||
|
<a href="#short-introduction" class="anchor"></a>Short introduction</h3>
|
||||||
|
<p><img src="reference/figures/itis_logo.jpg" height="60px"></p>
|
||||||
|
<p>This package contains the <strong>complete microbial taxonomic data</strong> (with all nine taxonomic ranks - from kingdom to subspecies) from the publicly available Integrated Taxonomic Information System (ITIS, <a href="https://www.itis.gov" class="uri">https://www.itis.gov</a>).</p>
|
||||||
|
<p>All (sub)species from <strong>the taxonomic kingdoms Bacteria, Fungi and Protozoa are included in this package</strong>, as well as all previously accepted names known to ITIS. Furthermore, the responsible authors and year of publication are available. This allows users to use authoritative taxonomic information for their data analysis on any microorganism, not only human pathogens. It also helps to quickly determine the Gram stain of bacteria, since all bacteria are classified into subkingdom Negibacteria or Posibacteria. ITIS is a partnership of U.S., Canadian, and Mexican agencies and taxonomic specialists.</p>
|
||||||
|
<p>The <code>AMR</code> package basically does four important things:</p>
|
||||||
|
<ol>
|
||||||
|
<li>
|
||||||
|
<p>It <strong>cleanses existing data</strong>, by transforming it to reproducible and profound <em>classes</em>, making the most efficient use of R. These functions all use artificial intelligence to guess results that you would expect:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Use <code><a href="reference/as.mo.html">as.mo()</a></code> to get an ID of a microorganism. The IDs are human readable for the trained eye - the ID of <em>Klebsiella pneumoniae</em> is “B_KLBSL_PNE” (B stands for Bacteria) and the ID of <em>S. aureus</em> is “B_STPHY_AUR”. The function takes almost any text as input that looks like the name or code of a microorganism like “E. coli”, “esco” and “esccol”. Even <code><a href="reference/as.mo.html">as.mo("MRSA")</a></code> will return the ID of <em>S. aureus</em>. Moreover, it can group all coagulase negative and positive <em>Staphylococci</em>, and can transform <em>Streptococci</em> into Lancefield groups. To find bacteria based on your input, it uses Artificial Intelligence to look up values in the included ITIS data, consisting of more than 18,000 microorganisms.</li>
|
||||||
|
<li>Use <code><a href="reference/as.rsi.html">as.rsi()</a></code> to transform values to valid antimicrobial results. It produces just S, I or R based on your input and warns about invalid values. Even values like “<=0.002; S” (combined MIC/RSI) will result in “S”.</li>
|
||||||
|
<li>Use <code><a href="reference/as.mic.html">as.mic()</a></code> to cleanse your MIC values. It produces a so-called factor (called <em>ordinal</em> in SPSS) with valid MIC values as levels. A value like “<=0.002; S” (combined MIC/RSI) will result in “<=0.002”.</li>
|
||||||
|
<li>Use <code><a href="reference/as.atc.html">as.atc()</a></code> to get the ATC code of an antibiotic as defined by the WHO. This package contains a database with most LIS codes, official names, DDDs and even trade names of antibiotics. For example, the values “Furabid”, “Furadantin”, “nitro” all return the ATC code of Nitrofurantoine.</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<p>It <strong>enhances existing data</strong> and <strong>adds new data</strong> from data sets included in this package.</p>
|
||||||
|
<ul>
|
||||||
|
<li>Use <code><a href="reference/eucast_rules.html">eucast_rules()</a></code> to apply <a href="http://www.eucast.org/expert_rules_and_intrinsic_resistance/">EUCAST expert rules to isolates</a>.</li>
|
||||||
|
<li>Use <code><a href="reference/first_isolate.html">first_isolate()</a></code> to identify the first isolates of every patient <a href="https://clsi.org/standards/products/microbiology/documents/m39/">using guidelines from the CLSI</a> (Clinical and Laboratory Standards Institute).
|
||||||
|
<ul>
|
||||||
|
<li>You can also identify first <em>weighted</em> isolates of every patient, an adjusted version of the CLSI guideline. This takes into account key antibiotics of every strain and compares them.</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>Use <code><a href="reference/mdro.html">mdro()</a></code> (abbreviation of Multi Drug Resistant Organisms) to check your isolates for exceptional resistance with country-specific guidelines or EUCAST rules. Currently, national guidelines for Germany and the Netherlands are supported.</li>
|
||||||
|
<li>The data set <code>microorganisms</code> contains the complete taxonomic tree of more than 18,000 microorganisms (bacteria, fungi/yeasts and protozoa). Furthermore, the colloquial name and Gram stain are available, which enables resistance analysis of e.g. different antibiotics per Gram stain. The package also contains functions to look up values in this data set like <code><a href="reference/mo_property.html">mo_genus()</a></code>, <code><a href="reference/mo_property.html">mo_family()</a></code>, <code><a href="reference/mo_property.html">mo_gramstain()</a></code> or even <code><a href="reference/mo_property.html">mo_phylum()</a></code>. As they use <code><a href="reference/as.mo.html">as.mo()</a></code> internally, they also use artificial intelligence. For example, <code><a href="reference/mo_property.html">mo_genus("MRSA")</a></code> and <code><a href="reference/mo_property.html">mo_genus("S. aureus")</a></code> will both return <code>"Staphylococcus"</code>. They also come with support for German, Dutch, Spanish, Italian, French and Portuguese. These functions can be used to add new variables to your data.</li>
|
||||||
|
<li>The data set <code>antibiotics</code> contains the ATC code, LIS codes, official name, trivial name and DDD of both oral and parenteral administration. It also contains a total of 298 trade names. Use functions like <code><a href="reference/ab_property.html">ab_name()</a></code> and <code><a href="reference/ab_property.html">ab_tradenames()</a></code> to look up values. The <code>ab_*</code> functions use <code><a href="reference/as.atc.html">as.atc()</a></code> internally so they support AI to guess your expected result. For example, <code><a href="reference/ab_property.html">ab_name("Fluclox")</a></code>, <code><a href="reference/ab_property.html">ab_name("Floxapen")</a></code> and <code><a href="reference/ab_property.html">ab_name("J01CF05")</a></code> will all return <code>"Flucloxacillin"</code>. These functions can again be used to add new variables to your data.</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<p>It <strong>analyses the data</strong> with convenient functions that use well-known methods.</p>
|
||||||
|
<ul>
|
||||||
|
<li>Calculate the resistance (and even co-resistance) of microbial isolates with the <code><a href="reference/portion.html">portion_R()</a></code>, <code><a href="reference/portion.html">portion_IR()</a></code>, <code><a href="reference/portion.html">portion_I()</a></code>, <code><a href="reference/portion.html">portion_SI()</a></code> and <code><a href="reference/portion.html">portion_S()</a></code> functions. Similarly, the <em>number</em> of isolates can be determined with the <code><a href="reference/count.html">count_R()</a></code>, <code><a href="reference/count.html">count_IR()</a></code>, <code><a href="reference/count.html">count_I()</a></code>, <code><a href="reference/count.html">count_SI()</a></code> and <code><a href="reference/count.html">count_S()</a></code> functions. All these functions can be used <a href="https://dplyr.tidyverse.org/#usage">with the <code>dplyr</code> package</a> (e.g. in conjunction with <a href="https://dplyr.tidyverse.org/reference/summarise.html"><code>summarise</code></a>)</li>
|
||||||
|
<li>Plot AMR results with <code><a href="reference/ggplot_rsi.html">geom_rsi()</a></code>, a function made for the <code>ggplot2</code> package</li>
|
||||||
|
<li>Predict antimicrobial resistance for the nextcoming years using logistic regression models with the <code><a href="reference/resistance_predict.html">resistance_predict()</a></code> function</li>
|
||||||
|
<li>Conduct descriptive statistics to enhance base R: calculate <code><a href="reference/kurtosis.html">kurtosis()</a></code>, <code><a href="reference/skewness.html">skewness()</a></code> and create frequency tables with <code><a href="reference/freq.html">freq()</a></code>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<p>It <strong>teaches the user</strong> how to use all the above actions.</p>
|
||||||
|
<ul>
|
||||||
|
<li>The package contains extensive help pages with many examples.</li>
|
||||||
|
<li>It also contains an example data set called <code>septic_patients</code>. This data set contains:
|
||||||
|
<ul>
|
||||||
|
<li>2,000 blood culture isolates from anonymised septic patients between 2001 and 2017 in the Northern Netherlands</li>
|
||||||
|
<li>Results of 40 antibiotics (each antibiotic in its own column) with a total of 38,414 antimicrobial results</li>
|
||||||
|
<li>Real and genuine data</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
<hr>
|
<hr>
|
||||||
<p><a href="https://www.rug.nl"><img src="./logo_rug.png" height="60px"></a> <a href="https://www.umcg.nl"><img src="./logo_umcg.png" height="60px"></a> <a href="https://www.certe.nl"><img src="./logo_certe.png" height="60px"></a> <a href="http://www.eurhealth-1health.eu"><img src="./logo_eh1h.png" height="60px"></a> <a href="http://www.eurhealth-1health.eu"><img src="./logo_interreg.png" height="60px"></a></p>
|
<p><a href="https://www.rug.nl"><img src="./logo_rug.png" height="60px"></a> <a href="https://www.umcg.nl"><img src="./logo_umcg.png" height="60px"></a> <a href="https://www.certe.nl"><img src="./logo_certe.png" height="60px"></a> <a href="http://www.eurhealth-1health.eu"><img src="./logo_eh1h.png" height="60px"></a> <a href="http://www.eurhealth-1health.eu"><img src="./logo_interreg.png" height="60px"></a></p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -168,25 +168,25 @@
|
|||||||
<a href="#new" class="anchor"></a>New</h4>
|
<a href="#new" class="anchor"></a>New</h4>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<strong>BREAKING</strong>: removed deprecated functions, parameters and references to ‘bactid’. Use <code>as.mo</code> to identify an MO code.</li>
|
<strong>BREAKING</strong>: removed deprecated functions, parameters and references to ‘bactid’. Use <code><a href="../reference/as.mo.html">as.mo()</a></code> to identify an MO code.</li>
|
||||||
<li>New website: <a href="https://msberends.gitlab.io/AMR" class="uri">https://msberends.gitlab.io/AMR</a> (built with the great <a href="https://pkgdown.r-lib.org/"><code>pkgdown</code></a>)
|
<li>New website: <a href="https://msberends.gitlab.io/AMR" class="uri">https://msberends.gitlab.io/AMR</a> (built with the great <a href="https://pkgdown.r-lib.org/"><code>pkgdown</code></a>)
|
||||||
<ul>
|
<ul>
|
||||||
<li>Contains the complete manual of this package and all of its functions with an explanation of their parameters</li>
|
<li>Contains the complete manual of this package and all of its functions with an explanation of their parameters</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li>Support for <a href="https://dplyr.tidyverse.org"><code>dplyr</code></a> version 0.8.0</li>
|
<li>Support for <a href="https://dplyr.tidyverse.org"><code>dplyr</code></a> version 0.8.0</li>
|
||||||
<li>Function <code>mo_failures</code> to review values that could not be coerced to a valid MO code, using <code>as.mo</code>. This latter function will now only show a maximum of 25 uncoerced values.</li>
|
<li>Function <code><a href="../reference/mo_failures.html">mo_failures()</a></code> to review values that could not be coerced to a valid MO code, using <code><a href="../reference/as.mo.html">as.mo()</a></code>. This latter function will now only show a maximum of 25 uncoerced values.</li>
|
||||||
<li>Function <code>mo_renamed</code> to get a list of all returned values from <code>as.mo</code> that have had taxonomic renaming</li>
|
<li>Function <code><a href="../reference/mo_renamed.html">mo_renamed()</a></code> to get a list of all returned values from <code><a href="../reference/as.mo.html">as.mo()</a></code> that have had taxonomic renaming</li>
|
||||||
<li>Function <code>age</code> to calculate the (patients) age in years</li>
|
<li>Function <code><a href="../reference/age.html">age()</a></code> to calculate the (patients) age in years</li>
|
||||||
<li>Function <code>age_groups</code> to split ages into custom or predefined groups (like children or elderly). This allows for easier demographic antimicrobial resistance analysis per age group.</li>
|
<li>Function <code><a href="../reference/age_groups.html">age_groups()</a></code> to split ages into custom or predefined groups (like children or elderly). This allows for easier demographic antimicrobial resistance analysis per age group.</li>
|
||||||
<li>
|
<li>
|
||||||
<p>Functions <code>filter_first_isolate</code> and <code>filter_first_weighted_isolate()</code> to shorten and fasten filtering on data sets with antimicrobial results, e.g.:</p>
|
<p>Functions <code><a href="../reference/first_isolate.html">filter_first_isolate()</a></code> and <code><a href="../reference/first_isolate.html">filter_first_weighted_isolate()</a></code> to shorten and fasten filtering on data sets with antimicrobial results, e.g.:</p>
|
||||||
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" data-line-number="1">septic_patients <span class="op">%>%</span><span class="st"> </span><span class="kw">filter_first_isolate</span>()</a>
|
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" data-line-number="1">septic_patients <span class="op">%>%</span><span class="st"> </span><span class="kw"><a href="../reference/first_isolate.html">filter_first_isolate</a></span>()</a>
|
||||||
<a class="sourceLine" id="cb1-2" data-line-number="2"><span class="co"># or</span></a>
|
<a class="sourceLine" id="cb1-2" data-line-number="2"><span class="co"># or</span></a>
|
||||||
<a class="sourceLine" id="cb1-3" data-line-number="3"><span class="kw">filter_first_isolate</span>(septic_patients)</a></code></pre></div>
|
<a class="sourceLine" id="cb1-3" data-line-number="3"><span class="kw"><a href="../reference/first_isolate.html">filter_first_isolate</a></span>(septic_patients)</a></code></pre></div>
|
||||||
<p>is equal to:</p>
|
<p>is equal to:</p>
|
||||||
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb2-1" data-line-number="1">septic_patients <span class="op">%>%</span></a>
|
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb2-1" data-line-number="1">septic_patients <span class="op">%>%</span></a>
|
||||||
<a class="sourceLine" id="cb2-2" data-line-number="2"><span class="st"> </span><span class="kw">mutate</span>(<span class="dt">only_firsts =</span> <span class="kw">first_isolate</span>(septic_patients, ...)) <span class="op">%>%</span></a>
|
<a class="sourceLine" id="cb2-2" data-line-number="2"><span class="st"> </span><span class="kw">mutate</span>(<span class="dt">only_firsts =</span> <span class="kw"><a href="../reference/first_isolate.html">first_isolate</a></span>(septic_patients, ...)) <span class="op">%>%</span></a>
|
||||||
<a class="sourceLine" id="cb2-3" data-line-number="3"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/stats/topics/filter">filter</a></span>(only_firsts <span class="op">==</span><span class="st"> </span><span class="ot">TRUE</span>) <span class="op">%>%</span></a>
|
<a class="sourceLine" id="cb2-3" data-line-number="3"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/stats/topics/filter">filter</a></span>(only_firsts <span class="op">==</span><span class="st"> </span><span class="ot">TRUE</span>) <span class="op">%>%</span></a>
|
||||||
<a class="sourceLine" id="cb2-4" data-line-number="4"><span class="st"> </span><span class="kw">select</span>(<span class="op">-</span>only_firsts)</a></code></pre></div>
|
<a class="sourceLine" id="cb2-4" data-line-number="4"><span class="st"> </span><span class="kw">select</span>(<span class="op">-</span>only_firsts)</a></code></pre></div>
|
||||||
</li>
|
</li>
|
||||||
@ -196,7 +196,8 @@
|
|||||||
<h4 class="hasAnchor">
|
<h4 class="hasAnchor">
|
||||||
<a href="#changed" class="anchor"></a>Changed</h4>
|
<a href="#changed" class="anchor"></a>Changed</h4>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Improvements for <code>as.mo</code>:
|
<li>Fixed a critical bug in <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code> where some rules that depend on previous applied rules would not be applied adequately</li>
|
||||||
|
<li>Improvements for <code><a href="../reference/as.mo.html">as.mo()</a></code>:
|
||||||
<ul>
|
<ul>
|
||||||
<li>Finds better results when input is in other languages</li>
|
<li>Finds better results when input is in other languages</li>
|
||||||
<li>Better handling for subspecies</li>
|
<li>Better handling for subspecies</li>
|
||||||
@ -208,24 +209,24 @@
|
|||||||
<li>Support for formatted console text</li>
|
<li>Support for formatted console text</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li>Function <code>first_isolate</code>:
|
<li>Function <code><a href="../reference/first_isolate.html">first_isolate()</a></code>:
|
||||||
<ul>
|
<ul>
|
||||||
|
<li>Fixed a bug where distances between dates would not be calculated right - in the <code>septic_patients</code> data set this yielded a differences of 0.15% more isolates</li>
|
||||||
<li>Will now use a column named like “patid” for the patient ID (parameter <code>col_patientid</code>), when this parameter was left blank</li>
|
<li>Will now use a column named like “patid” for the patient ID (parameter <code>col_patientid</code>), when this parameter was left blank</li>
|
||||||
<li>Will now use a column named like “key(…)ab” or “key(…)antibiotics” for the key antibiotics (parameter <code>col_keyantibiotics</code>), when this parameter was left blank</li>
|
<li>Will now use a column named like “key(…)ab” or “key(…)antibiotics” for the key antibiotics (parameter <code>col_keyantibiotics()</code>), when this parameter was left blank</li>
|
||||||
<li>Removed parameter <code>output_logical</code>, the function will now always return a logical value</li>
|
<li>Removed parameter <code>output_logical</code>, the function will now always return a logical value</li>
|
||||||
<li>Renamed parameter <code>filter_specimen</code> to <code>specimen_group</code>, although using <code>filter_specimen</code> will still work</li>
|
<li>Renamed parameter <code>filter_specimen</code> to <code>specimen_group</code>, although using <code>filter_specimen</code> will still work</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li>A note to the manual pages of the <code>portion</code> functions, that low counts can influence the outcome and that the <code>portion</code> functions may camouflage this, since they only return the portion (albeit being dependent on the <code>minimum</code> parameter)</li>
|
<li>A note to the manual pages of the <code>portion</code> functions, that low counts can influence the outcome and that the <code>portion</code> functions may camouflage this, since they only return the portion (albeit being dependent on the <code>minimum</code> parameter)</li>
|
||||||
<li>Function <code>mo_taxonomy</code> now contains the kingdom too</li>
|
<li>Function <code><a href="../reference/mo_property.html">mo_taxonomy()</a></code> now contains the kingdom too</li>
|
||||||
<li>Function <code>first_isolate</code> will now use a column named like “patid” for the patient ID, when this parameter was left blank</li>
|
<li>Reduce false positives for <code><a href="../reference/as.rsi.html">is.rsi.eligible()</a></code>
|
||||||
<li>Reduce false positives for <code>is.rsi.eligible</code>
|
|
||||||
</li>
|
</li>
|
||||||
<li>Summaries of class <code>mo</code> will now return the top 3 and the unique count, e.g. using <code><a href="https://www.rdocumentation.org/packages/base/topics/summary">summary(mo)</a></code>
|
<li>Summaries of class <code>mo</code> will now return the top 3 and the unique count, e.g. using <code><a href="https://www.rdocumentation.org/packages/base/topics/summary">summary(mo)</a></code>
|
||||||
</li>
|
</li>
|
||||||
<li>Small text updates to summaries of class <code>rsi</code> and <code>mic</code>
|
<li>Small text updates to summaries of class <code>rsi</code> and <code>mic</code>
|
||||||
</li>
|
</li>
|
||||||
<li>Frequency tables (<code>freq</code> function):
|
<li>Frequency tables (<code><a href="../reference/freq.html">freq()</a></code> function):
|
||||||
<ul>
|
<ul>
|
||||||
<li>Header info is now available as a list, with the <code>header</code> function</li>
|
<li>Header info is now available as a list, with the <code>header</code> function</li>
|
||||||
<li>Added header info for class <code>mo</code> to show unique count of families, genera and species</li>
|
<li>Added header info for class <code>mo</code> to show unique count of families, genera and species</li>
|
||||||
@ -238,11 +239,11 @@
|
|||||||
<li>Factor levels will be in header when present in input data</li>
|
<li>Factor levels will be in header when present in input data</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li>Function <code>scale_y_percent</code> now contains the <code>limits</code> parameter</li>
|
<li>Function <code><a href="../reference/ggplot_rsi.html">scale_y_percent()</a></code> now contains the <code>limits</code> parameter</li>
|
||||||
<li>Automatic parameter filling for <code>mdro</code>, <code>key_antibiotics</code> and <code>eucast_rules</code>
|
<li>Automatic parameter filling for <code><a href="../reference/mdro.html">mdro()</a></code>, <code><a href="../reference/key_antibiotics.html">key_antibiotics()</a></code> and <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code>
|
||||||
</li>
|
</li>
|
||||||
<li>Updated examples for resistance prediction (<code>resistance_predict</code> function)</li>
|
<li>Updated examples for resistance prediction (<code><a href="../reference/resistance_predict.html">resistance_predict()</a></code> function)</li>
|
||||||
<li>Fix for <code>as.mic</code> to support more values ending in (several) zeroes</li>
|
<li>Fix for <code><a href="../reference/as.mic.html">as.mic()</a></code> to support more values ending in (several) zeroes</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div id="other" class="section level4">
|
<div id="other" class="section level4">
|
||||||
@ -297,30 +298,30 @@
|
|||||||
<li>Fewer than 3 characters as input for <code>as.mo</code> will return NA</li>
|
<li>Fewer than 3 characters as input for <code>as.mo</code> will return NA</li>
|
||||||
<li>
|
<li>
|
||||||
<p>Function <code>as.mo</code> (and all <code>mo_*</code> wrappers) now supports genus abbreviations with “species” attached</p>
|
<p>Function <code>as.mo</code> (and all <code>mo_*</code> wrappers) now supports genus abbreviations with “species” attached</p>
|
||||||
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" data-line-number="1"><span class="kw">as.mo</span>(<span class="st">"E. species"</span>) <span class="co"># B_ESCHR</span></a>
|
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" data-line-number="1"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"E. species"</span>) <span class="co"># B_ESCHR</span></a>
|
||||||
<a class="sourceLine" id="cb3-2" data-line-number="2"><span class="kw">mo_fullname</span>(<span class="st">"E. spp."</span>) <span class="co"># "Escherichia species"</span></a>
|
<a class="sourceLine" id="cb3-2" data-line-number="2"><span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"E. spp."</span>) <span class="co"># "Escherichia species"</span></a>
|
||||||
<a class="sourceLine" id="cb3-3" data-line-number="3"><span class="kw">as.mo</span>(<span class="st">"S. spp"</span>) <span class="co"># B_STPHY</span></a>
|
<a class="sourceLine" id="cb3-3" data-line-number="3"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"S. spp"</span>) <span class="co"># B_STPHY</span></a>
|
||||||
<a class="sourceLine" id="cb3-4" data-line-number="4"><span class="kw">mo_fullname</span>(<span class="st">"S. species"</span>) <span class="co"># "Staphylococcus species"</span></a></code></pre></div>
|
<a class="sourceLine" id="cb3-4" data-line-number="4"><span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"S. species"</span>) <span class="co"># "Staphylococcus species"</span></a></code></pre></div>
|
||||||
</li>
|
</li>
|
||||||
<li>Added parameter <code>combine_IR</code> (TRUE/FALSE) to functions <code>portion_df</code> and <code>count_df</code>, to indicate that all values of I and R must be merged into one, so the output only consists of S vs. IR (susceptible vs. non-susceptible)</li>
|
<li>Added parameter <code>combine_IR</code> (TRUE/FALSE) to functions <code>portion_df</code> and <code>count_df</code>, to indicate that all values of I and R must be merged into one, so the output only consists of S vs. IR (susceptible vs. non-susceptible)</li>
|
||||||
<li>Fix for <code>portion_*(..., as_percent = TRUE)</code> when minimal number of isolates would not be met</li>
|
<li>Fix for <code>portion_*(..., as_percent = TRUE)</code> when minimal number of isolates would not be met</li>
|
||||||
<li>Added parameter <code>also_single_tested</code> for <code>portion_*</code> and <code>count_*</code> functions to also include cases where not all antibiotics were tested but at least one of the tested antibiotics includes the target antimicribial interpretation, see <code>?portion</code>
|
<li>Added parameter <code>also_single_tested</code> for <code>portion_*</code> and <code>count_*</code> functions to also include cases where not all antibiotics were tested but at least one of the tested antibiotics includes the target antimicribial interpretation, see <code><a href="../reference/portion.html">?portion</a></code>
|
||||||
</li>
|
</li>
|
||||||
<li>Using <code>portion_*</code> functions now throws a warning when total available isolate is below parameter <code>minimum</code>
|
<li>Using <code>portion_*</code> functions now throws a warning when total available isolate is below parameter <code>minimum</code>
|
||||||
</li>
|
</li>
|
||||||
<li>Functions <code>as.mo</code>, <code>as.rsi</code>, <code>as.mic</code>, <code>as.atc</code> and <code>freq</code> will not set package name as attribute anymore</li>
|
<li>Functions <code>as.mo</code>, <code>as.rsi</code>, <code>as.mic</code>, <code>as.atc</code> and <code>freq</code> will not set package name as attribute anymore</li>
|
||||||
<li>Frequency tables - <code>freq()</code>:
|
<li>Frequency tables - <code><a href="../reference/freq.html">freq()</a></code>:
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<p>Support for grouping variables, test with:</p>
|
<p>Support for grouping variables, test with:</p>
|
||||||
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" data-line-number="1">septic_patients <span class="op">%>%</span><span class="st"> </span></a>
|
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" data-line-number="1">septic_patients <span class="op">%>%</span><span class="st"> </span></a>
|
||||||
<a class="sourceLine" id="cb4-2" data-line-number="2"><span class="st"> </span><span class="kw">group_by</span>(hospital_id) <span class="op">%>%</span><span class="st"> </span></a>
|
<a class="sourceLine" id="cb4-2" data-line-number="2"><span class="st"> </span><span class="kw">group_by</span>(hospital_id) <span class="op">%>%</span><span class="st"> </span></a>
|
||||||
<a class="sourceLine" id="cb4-3" data-line-number="3"><span class="st"> </span><span class="kw">freq</span>(gender)</a></code></pre></div>
|
<a class="sourceLine" id="cb4-3" data-line-number="3"><span class="st"> </span><span class="kw"><a href="../reference/freq.html">freq</a></span>(gender)</a></code></pre></div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<p>Support for (un)selecting columns:</p>
|
<p>Support for (un)selecting columns:</p>
|
||||||
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb5-1" data-line-number="1">septic_patients <span class="op">%>%</span><span class="st"> </span></a>
|
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb5-1" data-line-number="1">septic_patients <span class="op">%>%</span><span class="st"> </span></a>
|
||||||
<a class="sourceLine" id="cb5-2" data-line-number="2"><span class="st"> </span><span class="kw">freq</span>(hospital_id) <span class="op">%>%</span><span class="st"> </span></a>
|
<a class="sourceLine" id="cb5-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="../reference/freq.html">freq</a></span>(hospital_id) <span class="op">%>%</span><span class="st"> </span></a>
|
||||||
<a class="sourceLine" id="cb5-3" data-line-number="3"><span class="st"> </span><span class="kw">select</span>(<span class="op">-</span>count, <span class="op">-</span>cum_count) <span class="co"># only get item, percent, cum_percent</span></a></code></pre></div>
|
<a class="sourceLine" id="cb5-3" data-line-number="3"><span class="st"> </span><span class="kw">select</span>(<span class="op">-</span>count, <span class="op">-</span>cum_count) <span class="co"># only get item, percent, cum_percent</span></a></code></pre></div>
|
||||||
</li>
|
</li>
|
||||||
<li>Check for <code><a href="https://www.rdocumentation.org/packages/hms/topics/hms">hms::is.hms</a></code>
|
<li>Check for <code><a href="https://www.rdocumentation.org/packages/hms/topics/hms">hms::is.hms</a></code>
|
||||||
@ -341,7 +342,7 @@
|
|||||||
<li>Removed diacritics from all authors (columns <code>microorganisms$ref</code> and <code>microorganisms.old$ref</code>) to comply with CRAN policy to only allow ASCII characters</li>
|
<li>Removed diacritics from all authors (columns <code>microorganisms$ref</code> and <code>microorganisms.old$ref</code>) to comply with CRAN policy to only allow ASCII characters</li>
|
||||||
<li>Fix for <code>mo_property</code> not working properly</li>
|
<li>Fix for <code>mo_property</code> not working properly</li>
|
||||||
<li>Fix for <code>eucast_rules</code> where some Streptococci would become ceftazidime R in EUCAST rule 4.5</li>
|
<li>Fix for <code>eucast_rules</code> where some Streptococci would become ceftazidime R in EUCAST rule 4.5</li>
|
||||||
<li>Support for named vectors of class <code>mo</code>, useful for <code>top_freq()</code>
|
<li>Support for named vectors of class <code>mo</code>, useful for <code><a href="../reference/freq.html">top_freq()</a></code>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<code>ggplot_rsi</code> and <code>scale_y_percent</code> have <code>breaks</code> parameter</li>
|
<code>ggplot_rsi</code> and <code>scale_y_percent</code> have <code>breaks</code> parameter</li>
|
||||||
@ -401,16 +402,16 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>They also come with support for German, Dutch, French, Italian, Spanish and Portuguese:</p>
|
<p>They also come with support for German, Dutch, French, Italian, Spanish and Portuguese:</p>
|
||||||
<div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb6-1" data-line-number="1"><span class="kw">mo_gramstain</span>(<span class="st">"E. coli"</span>)</a>
|
<div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb6-1" data-line-number="1"><span class="kw"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="st">"E. coli"</span>)</a>
|
||||||
<a class="sourceLine" id="cb6-2" data-line-number="2"><span class="co"># [1] "Gram negative"</span></a>
|
<a class="sourceLine" id="cb6-2" data-line-number="2"><span class="co"># [1] "Gram negative"</span></a>
|
||||||
<a class="sourceLine" id="cb6-3" data-line-number="3"><span class="kw">mo_gramstain</span>(<span class="st">"E. coli"</span>, <span class="dt">language =</span> <span class="st">"de"</span>) <span class="co"># German</span></a>
|
<a class="sourceLine" id="cb6-3" data-line-number="3"><span class="kw"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="st">"E. coli"</span>, <span class="dt">language =</span> <span class="st">"de"</span>) <span class="co"># German</span></a>
|
||||||
<a class="sourceLine" id="cb6-4" data-line-number="4"><span class="co"># [1] "Gramnegativ"</span></a>
|
<a class="sourceLine" id="cb6-4" data-line-number="4"><span class="co"># [1] "Gramnegativ"</span></a>
|
||||||
<a class="sourceLine" id="cb6-5" data-line-number="5"><span class="kw">mo_gramstain</span>(<span class="st">"E. coli"</span>, <span class="dt">language =</span> <span class="st">"es"</span>) <span class="co"># Spanish</span></a>
|
<a class="sourceLine" id="cb6-5" data-line-number="5"><span class="kw"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="st">"E. coli"</span>, <span class="dt">language =</span> <span class="st">"es"</span>) <span class="co"># Spanish</span></a>
|
||||||
<a class="sourceLine" id="cb6-6" data-line-number="6"><span class="co"># [1] "Gram negativo"</span></a>
|
<a class="sourceLine" id="cb6-6" data-line-number="6"><span class="co"># [1] "Gram negativo"</span></a>
|
||||||
<a class="sourceLine" id="cb6-7" data-line-number="7"><span class="kw">mo_fullname</span>(<span class="st">"S. group A"</span>, <span class="dt">language =</span> <span class="st">"pt"</span>) <span class="co"># Portuguese</span></a>
|
<a class="sourceLine" id="cb6-7" data-line-number="7"><span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"S. group A"</span>, <span class="dt">language =</span> <span class="st">"pt"</span>) <span class="co"># Portuguese</span></a>
|
||||||
<a class="sourceLine" id="cb6-8" data-line-number="8"><span class="co"># [1] "Streptococcus grupo A"</span></a></code></pre></div>
|
<a class="sourceLine" id="cb6-8" data-line-number="8"><span class="co"># [1] "Streptococcus grupo A"</span></a></code></pre></div>
|
||||||
<p>Furthermore, former taxonomic names will give a note about the current taxonomic name:</p>
|
<p>Furthermore, former taxonomic names will give a note about the current taxonomic name:</p>
|
||||||
<div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb7-1" data-line-number="1"><span class="kw">mo_gramstain</span>(<span class="st">"Esc blattae"</span>)</a>
|
<div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb7-1" data-line-number="1"><span class="kw"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="st">"Esc blattae"</span>)</a>
|
||||||
<a class="sourceLine" id="cb7-2" data-line-number="2"><span class="co"># Note: 'Escherichia blattae' (Burgess et al., 1973) was renamed 'Shimwellia blattae' (Priest and Barker, 2010)</span></a>
|
<a class="sourceLine" id="cb7-2" data-line-number="2"><span class="co"># Note: 'Escherichia blattae' (Burgess et al., 1973) was renamed 'Shimwellia blattae' (Priest and Barker, 2010)</span></a>
|
||||||
<a class="sourceLine" id="cb7-3" data-line-number="3"><span class="co"># [1] "Gram negative"</span></a></code></pre></div>
|
<a class="sourceLine" id="cb7-3" data-line-number="3"><span class="co"># [1] "Gram negative"</span></a></code></pre></div>
|
||||||
</li>
|
</li>
|
||||||
@ -423,15 +424,15 @@
|
|||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<p>Functions <code>as.mo</code> and <code>is.mo</code> as replacements for <code>as.bactid</code> and <code>is.bactid</code> (since the <code>microoganisms</code> data set not only contains bacteria). These last two functions are deprecated and will be removed in a future release. The <code>as.mo</code> function determines microbial IDs using Artificial Intelligence (AI):</p>
|
<p>Functions <code>as.mo</code> and <code>is.mo</code> as replacements for <code>as.bactid</code> and <code>is.bactid</code> (since the <code>microoganisms</code> data set not only contains bacteria). These last two functions are deprecated and will be removed in a future release. The <code>as.mo</code> function determines microbial IDs using Artificial Intelligence (AI):</p>
|
||||||
<div class="sourceCode" id="cb8"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb8-1" data-line-number="1"><span class="kw">as.mo</span>(<span class="st">"E. coli"</span>)</a>
|
<div class="sourceCode" id="cb8"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb8-1" data-line-number="1"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"E. coli"</span>)</a>
|
||||||
<a class="sourceLine" id="cb8-2" data-line-number="2"><span class="co"># [1] B_ESCHR_COL</span></a>
|
<a class="sourceLine" id="cb8-2" data-line-number="2"><span class="co"># [1] B_ESCHR_COL</span></a>
|
||||||
<a class="sourceLine" id="cb8-3" data-line-number="3"><span class="kw">as.mo</span>(<span class="st">"MRSA"</span>)</a>
|
<a class="sourceLine" id="cb8-3" data-line-number="3"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"MRSA"</span>)</a>
|
||||||
<a class="sourceLine" id="cb8-4" data-line-number="4"><span class="co"># [1] B_STPHY_AUR</span></a>
|
<a class="sourceLine" id="cb8-4" data-line-number="4"><span class="co"># [1] B_STPHY_AUR</span></a>
|
||||||
<a class="sourceLine" id="cb8-5" data-line-number="5"><span class="kw">as.mo</span>(<span class="st">"S group A"</span>)</a>
|
<a class="sourceLine" id="cb8-5" data-line-number="5"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"S group A"</span>)</a>
|
||||||
<a class="sourceLine" id="cb8-6" data-line-number="6"><span class="co"># [1] B_STRPTC_GRA</span></a></code></pre></div>
|
<a class="sourceLine" id="cb8-6" data-line-number="6"><span class="co"># [1] B_STRPTC_GRA</span></a></code></pre></div>
|
||||||
<p>And with great speed too - on a quite regular Linux server from 2007 it takes us less than 0.02 seconds to transform 25,000 items:</p>
|
<p>And with great speed too - on a quite regular Linux server from 2007 it takes us less than 0.02 seconds to transform 25,000 items:</p>
|
||||||
<div class="sourceCode" id="cb9"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb9-1" data-line-number="1">thousands_of_E_colis <-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/rep">rep</a></span>(<span class="st">"E. coli"</span>, <span class="dv">25000</span>)</a>
|
<div class="sourceCode" id="cb9"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb9-1" data-line-number="1">thousands_of_E_colis <-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/rep">rep</a></span>(<span class="st">"E. coli"</span>, <span class="dv">25000</span>)</a>
|
||||||
<a class="sourceLine" id="cb9-2" data-line-number="2">microbenchmark<span class="op">::</span><span class="kw">microbenchmark</span>(<span class="kw">as.mo</span>(thousands_of_E_colis), <span class="dt">unit =</span> <span class="st">"s"</span>)</a>
|
<a class="sourceLine" id="cb9-2" data-line-number="2">microbenchmark<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/microbenchmark/topics/microbenchmark">microbenchmark</a></span>(<span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(thousands_of_E_colis), <span class="dt">unit =</span> <span class="st">"s"</span>)</a>
|
||||||
<a class="sourceLine" id="cb9-3" data-line-number="3"><span class="co"># Unit: seconds</span></a>
|
<a class="sourceLine" id="cb9-3" data-line-number="3"><span class="co"># Unit: seconds</span></a>
|
||||||
<a class="sourceLine" id="cb9-4" data-line-number="4"><span class="co"># min median max neval</span></a>
|
<a class="sourceLine" id="cb9-4" data-line-number="4"><span class="co"># min median max neval</span></a>
|
||||||
<a class="sourceLine" id="cb9-5" data-line-number="5"><span class="co"># 0.01817717 0.01843957 0.03878077 100</span></a></code></pre></div>
|
<a class="sourceLine" id="cb9-5" data-line-number="5"><span class="co"># 0.01817717 0.01843957 0.03878077 100</span></a></code></pre></div>
|
||||||
@ -462,11 +463,11 @@
|
|||||||
<li>Added three antimicrobial agents to the <code>antibiotics</code> data set: Terbinafine (D01BA02), Rifaximin (A07AA11) and Isoconazole (D01AC05)</li>
|
<li>Added three antimicrobial agents to the <code>antibiotics</code> data set: Terbinafine (D01BA02), Rifaximin (A07AA11) and Isoconazole (D01AC05)</li>
|
||||||
<li>
|
<li>
|
||||||
<p>Added 163 trade names to the <code>antibiotics</code> data set, it now contains 298 different trade names in total, e.g.:</p>
|
<p>Added 163 trade names to the <code>antibiotics</code> data set, it now contains 298 different trade names in total, e.g.:</p>
|
||||||
<div class="sourceCode" id="cb10"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb10-1" data-line-number="1"><span class="kw">ab_official</span>(<span class="st">"Bactroban"</span>)</a>
|
<div class="sourceCode" id="cb10"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb10-1" data-line-number="1"><span class="kw"><a href="../reference/ab_property.html">ab_official</a></span>(<span class="st">"Bactroban"</span>)</a>
|
||||||
<a class="sourceLine" id="cb10-2" data-line-number="2"><span class="co"># [1] "Mupirocin"</span></a>
|
<a class="sourceLine" id="cb10-2" data-line-number="2"><span class="co"># [1] "Mupirocin"</span></a>
|
||||||
<a class="sourceLine" id="cb10-3" data-line-number="3"><span class="kw">ab_name</span>(<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="st">"Bactroban"</span>, <span class="st">"Amoxil"</span>, <span class="st">"Zithromax"</span>, <span class="st">"Floxapen"</span>))</a>
|
<a class="sourceLine" id="cb10-3" data-line-number="3"><span class="kw"><a href="../reference/ab_property.html">ab_name</a></span>(<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="st">"Bactroban"</span>, <span class="st">"Amoxil"</span>, <span class="st">"Zithromax"</span>, <span class="st">"Floxapen"</span>))</a>
|
||||||
<a class="sourceLine" id="cb10-4" data-line-number="4"><span class="co"># [1] "Mupirocin" "Amoxicillin" "Azithromycin" "Flucloxacillin"</span></a>
|
<a class="sourceLine" id="cb10-4" data-line-number="4"><span class="co"># [1] "Mupirocin" "Amoxicillin" "Azithromycin" "Flucloxacillin"</span></a>
|
||||||
<a class="sourceLine" id="cb10-5" data-line-number="5"><span class="kw">ab_atc</span>(<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="st">"Bactroban"</span>, <span class="st">"Amoxil"</span>, <span class="st">"Zithromax"</span>, <span class="st">"Floxapen"</span>))</a>
|
<a class="sourceLine" id="cb10-5" data-line-number="5"><span class="kw"><a href="../reference/ab_property.html">ab_atc</a></span>(<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="st">"Bactroban"</span>, <span class="st">"Amoxil"</span>, <span class="st">"Zithromax"</span>, <span class="st">"Floxapen"</span>))</a>
|
||||||
<a class="sourceLine" id="cb10-6" data-line-number="6"><span class="co"># [1] "R01AX06" "J01CA04" "J01FA10" "J01CF05"</span></a></code></pre></div>
|
<a class="sourceLine" id="cb10-6" data-line-number="6"><span class="co"># [1] "R01AX06" "J01CA04" "J01FA10" "J01CF05"</span></a></code></pre></div>
|
||||||
</li>
|
</li>
|
||||||
<li>For <code>first_isolate</code>, rows will be ignored when there’s no species available</li>
|
<li>For <code>first_isolate</code>, rows will be ignored when there’s no species available</li>
|
||||||
@ -478,13 +479,13 @@
|
|||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<p>Support for quasiquotation in the functions series <code>count_*</code> and <code>portions_*</code>, and <code>n_rsi</code>. This allows to check for more than 2 vectors or columns.</p>
|
<p>Support for quasiquotation in the functions series <code>count_*</code> and <code>portions_*</code>, and <code>n_rsi</code>. This allows to check for more than 2 vectors or columns.</p>
|
||||||
<div class="sourceCode" id="cb11"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb11-1" data-line-number="1">septic_patients <span class="op">%>%</span><span class="st"> </span><span class="kw">select</span>(amox, cipr) <span class="op">%>%</span><span class="st"> </span><span class="kw">count_IR</span>()</a>
|
<div class="sourceCode" id="cb11"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb11-1" data-line-number="1">septic_patients <span class="op">%>%</span><span class="st"> </span><span class="kw">select</span>(amox, cipr) <span class="op">%>%</span><span class="st"> </span><span class="kw"><a href="../reference/count.html">count_IR</a></span>()</a>
|
||||||
<a class="sourceLine" id="cb11-2" data-line-number="2"><span class="co"># which is the same as:</span></a>
|
<a class="sourceLine" id="cb11-2" data-line-number="2"><span class="co"># which is the same as:</span></a>
|
||||||
<a class="sourceLine" id="cb11-3" data-line-number="3">septic_patients <span class="op">%>%</span><span class="st"> </span><span class="kw">count_IR</span>(amox, cipr)</a>
|
<a class="sourceLine" id="cb11-3" data-line-number="3">septic_patients <span class="op">%>%</span><span class="st"> </span><span class="kw"><a href="../reference/count.html">count_IR</a></span>(amox, cipr)</a>
|
||||||
<a class="sourceLine" id="cb11-4" data-line-number="4"></a>
|
<a class="sourceLine" id="cb11-4" data-line-number="4"></a>
|
||||||
<a class="sourceLine" id="cb11-5" data-line-number="5">septic_patients <span class="op">%>%</span><span class="st"> </span><span class="kw">portion_S</span>(amcl)</a>
|
<a class="sourceLine" id="cb11-5" data-line-number="5">septic_patients <span class="op">%>%</span><span class="st"> </span><span class="kw"><a href="../reference/portion.html">portion_S</a></span>(amcl)</a>
|
||||||
<a class="sourceLine" id="cb11-6" data-line-number="6">septic_patients <span class="op">%>%</span><span class="st"> </span><span class="kw">portion_S</span>(amcl, gent)</a>
|
<a class="sourceLine" id="cb11-6" data-line-number="6">septic_patients <span class="op">%>%</span><span class="st"> </span><span class="kw"><a href="../reference/portion.html">portion_S</a></span>(amcl, gent)</a>
|
||||||
<a class="sourceLine" id="cb11-7" data-line-number="7">septic_patients <span class="op">%>%</span><span class="st"> </span><span class="kw">portion_S</span>(amcl, gent, pita)</a></code></pre></div>
|
<a class="sourceLine" id="cb11-7" data-line-number="7">septic_patients <span class="op">%>%</span><span class="st"> </span><span class="kw"><a href="../reference/portion.html">portion_S</a></span>(amcl, gent, pita)</a></code></pre></div>
|
||||||
</li>
|
</li>
|
||||||
<li>Edited <code>ggplot_rsi</code> and <code>geom_rsi</code> so they can cope with <code>count_df</code>. The new <code>fun</code> parameter has value <code>portion_df</code> at default, but can be set to <code>count_df</code>.</li>
|
<li>Edited <code>ggplot_rsi</code> and <code>geom_rsi</code> so they can cope with <code>count_df</code>. The new <code>fun</code> parameter has value <code>portion_df</code> at default, but can be set to <code>count_df</code>.</li>
|
||||||
<li>Fix for <code>ggplot_rsi</code> when the <code>ggplot2</code> package was not loaded</li>
|
<li>Fix for <code>ggplot_rsi</code> when the <code>ggplot2</code> package was not loaded</li>
|
||||||
@ -499,11 +500,11 @@
|
|||||||
<li>
|
<li>
|
||||||
<p>Support for types (classes) list and matrix for <code>freq</code></p>
|
<p>Support for types (classes) list and matrix for <code>freq</code></p>
|
||||||
<div class="sourceCode" id="cb12"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb12-1" data-line-number="1">my_matrix =<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/with">with</a></span>(septic_patients, <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/matrix">matrix</a></span>(<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(age, gender), <span class="dt">ncol =</span> <span class="dv">2</span>))</a>
|
<div class="sourceCode" id="cb12"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb12-1" data-line-number="1">my_matrix =<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/with">with</a></span>(septic_patients, <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/matrix">matrix</a></span>(<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(age, gender), <span class="dt">ncol =</span> <span class="dv">2</span>))</a>
|
||||||
<a class="sourceLine" id="cb12-2" data-line-number="2"><span class="kw">freq</span>(my_matrix)</a></code></pre></div>
|
<a class="sourceLine" id="cb12-2" data-line-number="2"><span class="kw"><a href="../reference/freq.html">freq</a></span>(my_matrix)</a></code></pre></div>
|
||||||
<p>For lists, subsetting is possible:</p>
|
<p>For lists, subsetting is possible:</p>
|
||||||
<div class="sourceCode" id="cb13"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb13-1" data-line-number="1">my_list =<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/list">list</a></span>(<span class="dt">age =</span> septic_patients<span class="op">$</span>age, <span class="dt">gender =</span> septic_patients<span class="op">$</span>gender)</a>
|
<div class="sourceCode" id="cb13"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb13-1" data-line-number="1">my_list =<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/list">list</a></span>(<span class="dt">age =</span> septic_patients<span class="op">$</span>age, <span class="dt">gender =</span> septic_patients<span class="op">$</span>gender)</a>
|
||||||
<a class="sourceLine" id="cb13-2" data-line-number="2">my_list <span class="op">%>%</span><span class="st"> </span><span class="kw">freq</span>(age)</a>
|
<a class="sourceLine" id="cb13-2" data-line-number="2">my_list <span class="op">%>%</span><span class="st"> </span><span class="kw"><a href="../reference/freq.html">freq</a></span>(age)</a>
|
||||||
<a class="sourceLine" id="cb13-3" data-line-number="3">my_list <span class="op">%>%</span><span class="st"> </span><span class="kw">freq</span>(gender)</a></code></pre></div>
|
<a class="sourceLine" id="cb13-3" data-line-number="3">my_list <span class="op">%>%</span><span class="st"> </span><span class="kw"><a href="../reference/freq.html">freq</a></span>(gender)</a></code></pre></div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@ -545,7 +546,7 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<code>septic_patients %>% select(tobr, gent) %>% ggplot_rsi</code> will show portions of S, I and R immediately in a pretty plot</li>
|
<code>septic_patients %>% select(tobr, gent) %>% ggplot_rsi</code> will show portions of S, I and R immediately in a pretty plot</li>
|
||||||
<li>Support for grouped variables, see <code>?ggplot_rsi</code>
|
<li>Support for grouped variables, see <code><a href="../reference/ggplot_rsi.html">?ggplot_rsi</a></code>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
@ -566,7 +567,7 @@
|
|||||||
<li>
|
<li>
|
||||||
<del>Function <code>ratio</code> to transform a vector of values to a preset ratio</del>
|
<del>Function <code>ratio</code> to transform a vector of values to a preset ratio</del>
|
||||||
<ul>
|
<ul>
|
||||||
<li><del>For example: <code>ratio(c(10, 500, 10), ratio = "1:2:1")</code> would return <code>130, 260, 130</code></del></li>
|
<li><del>For example: <code><a href="../reference/AMR-deprecated.html">ratio(c(10, 500, 10), ratio = "1:2:1")</a></code> would return <code>130, 260, 130</code></del></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li>Support for Addins menu in RStudio to quickly insert <code>%in%</code> or <code>%like%</code> (and give them keyboard shortcuts), or to view the datasets that come with this package</li>
|
<li>Support for Addins menu in RStudio to quickly insert <code>%in%</code> or <code>%like%</code> (and give them keyboard shortcuts), or to view the datasets that come with this package</li>
|
||||||
@ -577,13 +578,13 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li>A vignette to explain its usage</li>
|
<li>A vignette to explain its usage</li>
|
||||||
<li>Support for <code>rsi</code> (antimicrobial resistance) to use as input</li>
|
<li>Support for <code>rsi</code> (antimicrobial resistance) to use as input</li>
|
||||||
<li>Support for <code>table</code> to use as input: <code>freq(table(x, y))</code>
|
<li>Support for <code>table</code> to use as input: <code><a href="../reference/freq.html">freq(table(x, y))</a></code>
|
||||||
</li>
|
</li>
|
||||||
<li>Support for existing functions <code>hist</code> and <code>plot</code> to use a frequency table as input: <code><a href="https://www.rdocumentation.org/packages/graphics/topics/hist">hist(freq(df$age))</a></code>
|
<li>Support for existing functions <code>hist</code> and <code>plot</code> to use a frequency table as input: <code><a href="https://www.rdocumentation.org/packages/graphics/topics/hist">hist(freq(df$age))</a></code>
|
||||||
</li>
|
</li>
|
||||||
<li>Support for <code>as.vector</code>, <code>as.data.frame</code>, <code>as_tibble</code> and <code>format</code>
|
<li>Support for <code>as.vector</code>, <code>as.data.frame</code>, <code>as_tibble</code> and <code>format</code>
|
||||||
</li>
|
</li>
|
||||||
<li>Support for quasiquotation: <code>freq(mydata, mycolumn)</code> is the same as <code>mydata %>% freq(mycolumn)</code>
|
<li>Support for quasiquotation: <code><a href="../reference/freq.html">freq(mydata, mycolumn)</a></code> is the same as <code>mydata %>% freq(mycolumn)</code>
|
||||||
</li>
|
</li>
|
||||||
<li>Function <code>top_freq</code> function to return the top/below <em>n</em> items as vector</li>
|
<li>Function <code>top_freq</code> function to return the top/below <em>n</em> items as vector</li>
|
||||||
<li>Header of frequency tables now also show Mean Absolute Deviaton (MAD) and Interquartile Range (IQR)</li>
|
<li>Header of frequency tables now also show Mean Absolute Deviaton (MAD) and Interquartile Range (IQR)</li>
|
||||||
@ -615,16 +616,16 @@
|
|||||||
<li>Combined MIC/RSI values will now be coerced by the <code>rsi</code> and <code>mic</code> functions:
|
<li>Combined MIC/RSI values will now be coerced by the <code>rsi</code> and <code>mic</code> functions:
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<code>as.rsi("<=0.002; S")</code> will return <code>S</code>
|
<code><a href="../reference/as.rsi.html">as.rsi("<=0.002; S")</a></code> will return <code>S</code>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<code>as.mic("<=0.002; S")</code> will return <code><=0.002</code>
|
<code><a href="../reference/as.mic.html">as.mic("<=0.002; S")</a></code> will return <code><=0.002</code>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li>Now possible to coerce MIC values with a space between operator and value, i.e. <code>as.mic("<= 0.002")</code> now works</li>
|
<li>Now possible to coerce MIC values with a space between operator and value, i.e. <code><a href="../reference/as.mic.html">as.mic("<= 0.002")</a></code> now works</li>
|
||||||
<li>Classes <code>rsi</code> and <code>mic</code> do not add the attribute <code>package.version</code> anymore</li>
|
<li>Classes <code>rsi</code> and <code>mic</code> do not add the attribute <code>package.version</code> anymore</li>
|
||||||
<li>Added <code>"groups"</code> option for <code>atc_property(..., property)</code>. It will return a vector of the ATC hierarchy as defined by the <a href="https://www.whocc.no/atc/structure_and_principles/">WHO</a>. The new function <code>atc_groups</code> is a convenient wrapper around this.</li>
|
<li>Added <code>"groups"</code> option for <code><a href="../reference/atc_property.html">atc_property(..., property)</a></code>. It will return a vector of the ATC hierarchy as defined by the <a href="https://www.whocc.no/atc/structure_and_principles/">WHO</a>. The new function <code>atc_groups</code> is a convenient wrapper around this.</li>
|
||||||
<li>Build-in host check for <code>atc_property</code> as it requires the host set by <code>url</code> to be responsive</li>
|
<li>Build-in host check for <code>atc_property</code> as it requires the host set by <code>url</code> to be responsive</li>
|
||||||
<li>Improved <code>first_isolate</code> algorithm to exclude isolates where bacteria ID or genus is unavailable</li>
|
<li>Improved <code>first_isolate</code> algorithm to exclude isolates where bacteria ID or genus is unavailable</li>
|
||||||
<li>Fix for warning <em>hybrid evaluation forced for row_number</em> (<a href="https://github.com/tidyverse/dplyr/commit/924b62"><code>924b62</code></a>) from the <code>dplyr</code> package v0.7.5 and above</li>
|
<li>Fix for warning <em>hybrid evaluation forced for row_number</em> (<a href="https://github.com/tidyverse/dplyr/commit/924b62"><code>924b62</code></a>) from the <code>dplyr</code> package v0.7.5 and above</li>
|
||||||
@ -662,7 +663,7 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li>Full support for Windows, Linux and macOS</li>
|
<li>Full support for Windows, Linux and macOS</li>
|
||||||
<li>Full support for old R versions, only R-3.0.0 (April 2013) or later is needed (needed packages may have other dependencies)</li>
|
<li>Full support for old R versions, only R-3.0.0 (April 2013) or later is needed (needed packages may have other dependencies)</li>
|
||||||
<li>Function <code>n_rsi</code> to count cases where antibiotic test results were available, to be used in conjunction with <code><a href="https://www.rdocumentation.org/packages/dplyr/topics/summarise">dplyr::summarise</a></code>, see ?rsi</li>
|
<li>Function <code>n_rsi</code> to count cases where antibiotic test results were available, to be used in conjunction with <code><a href="http://dplyr.tidyverse.org/reference/summarise.html">dplyr::summarise</a></code>, see ?rsi</li>
|
||||||
<li>Function <code>guess_bactid</code> to <strong>determine the ID</strong> of a microorganism based on genus/species or known abbreviations like MRSA</li>
|
<li>Function <code>guess_bactid</code> to <strong>determine the ID</strong> of a microorganism based on genus/species or known abbreviations like MRSA</li>
|
||||||
<li>Function <code>guess_atc</code> to <strong>determine the ATC</strong> of an antibiotic based on name, trade name, or known abbreviations</li>
|
<li>Function <code>guess_atc</code> to <strong>determine the ATC</strong> of an antibiotic based on name, trade name, or known abbreviations</li>
|
||||||
<li>Function <code>freq</code> to create <strong>frequency tables</strong>, with additional info in a header</li>
|
<li>Function <code>freq</code> to create <strong>frequency tables</strong>, with additional info in a header</li>
|
||||||
@ -675,7 +676,7 @@
|
|||||||
<li>Functions <code>BRMO</code> and <code>MRGN</code> are wrappers for Dutch and German guidelines, respectively</li>
|
<li>Functions <code>BRMO</code> and <code>MRGN</code> are wrappers for Dutch and German guidelines, respectively</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li>New algorithm to determine weighted isolates, can now be <code>"points"</code> or <code>"keyantibiotics"</code>, see <code>?first_isolate</code>
|
<li>New algorithm to determine weighted isolates, can now be <code>"points"</code> or <code>"keyantibiotics"</code>, see <code><a href="../reference/first_isolate.html">?first_isolate</a></code>
|
||||||
</li>
|
</li>
|
||||||
<li>New print format for <code>tibble</code>s and <code>data.table</code>s</li>
|
<li>New print format for <code>tibble</code>s and <code>data.table</code>s</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
pandoc: 2.3.1
|
pandoc: 2.3.1
|
||||||
pkgdown: 1.3.0
|
pkgdown: 1.3.0
|
||||||
pkgdown_sha: ~
|
pkgdown_sha: ~
|
||||||
articles: []
|
articles:
|
||||||
|
AMR: AMR.html
|
||||||
urls:
|
urls:
|
||||||
reference: https://msberends.gitlab.io/reference
|
reference: https://msberends.gitlab.io/reference
|
||||||
article: https://msberends.gitlab.io/articles
|
article: https://msberends.gitlab.io/articles
|
||||||
|
@ -163,7 +163,7 @@
|
|||||||
|
|
||||||
<div class="ref-description">
|
<div class="ref-description">
|
||||||
|
|
||||||
<p>Use these functions to return a specific property of an antibiotic from the <code>antibiotics</code> data set, based on their ATC code. Get such a code with <code>as.atc</code>.</p>
|
<p>Use these functions to return a specific property of an antibiotic from the <code><a href='antibiotics.html'>antibiotics</a></code> data set, based on their ATC code. Get such a code with <code><a href='as.atc.html'>as.atc</a></code>.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -188,11 +188,11 @@
|
|||||||
<colgroup><col class="name" /><col class="desc" /></colgroup>
|
<colgroup><col class="name" /><col class="desc" /></colgroup>
|
||||||
<tr>
|
<tr>
|
||||||
<th>x</th>
|
<th>x</th>
|
||||||
<td><p>a (vector of a) valid <code>atc</code> code or any text that can be coerced to a valid atc with <code>as.atc</code></p></td>
|
<td><p>a (vector of a) valid <code><a href='as.atc.html'>atc</a></code> code or any text that can be coerced to a valid atc with <code><a href='as.atc.html'>as.atc</a></code></p></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>property</th>
|
<th>property</th>
|
||||||
<td><p>one of the column names of one of the <code>antibiotics</code> data set, like <code>"atc"</code> and <code>"official"</code></p></td>
|
<td><p>one of the column names of one of the <code><a href='antibiotics.html'>antibiotics</a></code> data set, like <code>"atc"</code> and <code>"official"</code></p></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>language</th>
|
<th>language</th>
|
||||||
@ -206,7 +206,7 @@
|
|||||||
|
|
||||||
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
||||||
|
|
||||||
<div class='dont-index'><p><code>antibiotics</code></p></div>
|
<div class='dont-index'><p><code><a href='antibiotics.html'>antibiotics</a></code></p></div>
|
||||||
|
|
||||||
|
|
||||||
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
||||||
|
@ -163,7 +163,7 @@
|
|||||||
|
|
||||||
<div class="ref-description">
|
<div class="ref-description">
|
||||||
|
|
||||||
<p>Convert antibiotic codes to a (trivial) antibiotic name or ATC code, or vice versa. This uses the data from <code>antibiotics</code>.</p>
|
<p>Convert antibiotic codes to a (trivial) antibiotic name or ATC code, or vice versa. This uses the data from <code><a href='antibiotics.html'>antibiotics</a></code>.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -179,7 +179,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>from, to</th>
|
<th>from, to</th>
|
||||||
<td><p>type to transform from and to. See <code>antibiotics</code> for its column names. WIth <code>from = "guess"</code> the from will be guessed from <code>"atc"</code>, <code>"certe"</code> and <code>"umcg"</code>. When using <code>to = "atc"</code>, the ATC code will be searched using <code>as.atc</code>.</p></td>
|
<td><p>type to transform from and to. See <code><a href='antibiotics.html'>antibiotics</a></code> for its column names. WIth <code>from = "guess"</code> the from will be guessed from <code>"atc"</code>, <code>"certe"</code> and <code>"umcg"</code>. When using <code>to = "atc"</code>, the ATC code will be searched using <code><a href='as.atc.html'>as.atc</a></code>.</p></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>textbetween</th>
|
<th>textbetween</th>
|
||||||
@ -193,11 +193,11 @@
|
|||||||
|
|
||||||
<h2 class="hasAnchor" id="source"><a class="anchor" href="#source"></a>Source</h2>
|
<h2 class="hasAnchor" id="source"><a class="anchor" href="#source"></a>Source</h2>
|
||||||
|
|
||||||
<p><code>antibiotics</code></p>
|
<p><code><a href='antibiotics.html'>antibiotics</a></code></p>
|
||||||
|
|
||||||
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
|
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
|
||||||
|
|
||||||
<p><strong>The <code>ab_property</code> functions are faster and more concise</strong>, but do not support concatenated strings, like <code>abname("AMCL+GENT"</code>.</p>
|
<p><strong>The <code><a href='ab_property.html'>ab_property</a></code> functions are faster and more concise</strong>, but do not support concatenated strings, like <code>abname("AMCL+GENT"</code>.</p>
|
||||||
|
|
||||||
|
|
||||||
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
||||||
|
@ -188,7 +188,7 @@
|
|||||||
|
|
||||||
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
||||||
|
|
||||||
<div class='dont-index'><p><code>age_groups</code> to splits age into groups</p></div>
|
<div class='dont-index'><p><code><a href='age_groups.html'>age_groups</a></code> to splits age into groups</p></div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -174,7 +174,7 @@
|
|||||||
<colgroup><col class="name" /><col class="desc" /></colgroup>
|
<colgroup><col class="name" /><col class="desc" /></colgroup>
|
||||||
<tr>
|
<tr>
|
||||||
<th>x</th>
|
<th>x</th>
|
||||||
<td><p>age, e.g. calculated with <code>age</code></p></td>
|
<td><p>age, e.g. calculated with <code><a href='age.html'>age</a></code></p></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>split_at</th>
|
<th>split_at</th>
|
||||||
@ -201,7 +201,7 @@
|
|||||||
|
|
||||||
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
||||||
|
|
||||||
<div class='dont-index'><p><code>age</code> to determine ages based on one or more reference dates</p></div>
|
<div class='dont-index'><p><code><a href='age.html'>age</a></code> to determine ages based on one or more reference dates</p></div>
|
||||||
|
|
||||||
|
|
||||||
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
||||||
@ -230,13 +230,13 @@
|
|||||||
<span class='co'># resistance of ciprofloxacine per age group</span>
|
<span class='co'># resistance of ciprofloxacine per age group</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
|
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
|
||||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/mutate'>mutate</a></span>(<span class='kw'>first_isolate</span> <span class='kw'>=</span> <span class='fu'>first_isolate</span>(<span class='no'>.</span>)) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>first_isolate</span> <span class='kw'>=</span> <span class='fu'><a href='first_isolate.html'>first_isolate</a></span>(<span class='no'>.</span>)) <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>,
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>,
|
||||||
<span class='no'>mo</span> <span class='kw'>==</span> <span class='fu'>as.mo</span>(<span class='st'>"E. coli"</span>)) <span class='kw'>%>%</span>
|
<span class='no'>mo</span> <span class='kw'>==</span> <span class='fu'><a href='as.mo.html'>as.mo</a></span>(<span class='st'>"E. coli"</span>)) <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='kw'>age_group</span> <span class='kw'>=</span> <span class='fu'>age_groups</span>(<span class='no'>age</span>)) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='kw'>age_group</span> <span class='kw'>=</span> <span class='fu'>age_groups</span>(<span class='no'>age</span>)) <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>age_group</span>,
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>age_group</span>,
|
||||||
<span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
<span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
||||||
<span class='fu'>ggplot_rsi</span>(<span class='kw'>x</span> <span class='kw'>=</span> <span class='st'>"age_group"</span>)
|
<span class='fu'><a href='ggplot_rsi.html'>ggplot_rsi</a></span>(<span class='kw'>x</span> <span class='kw'>=</span> <span class='st'>"age_group"</span>)
|
||||||
<span class='co'># }</span></pre>
|
<span class='co'># }</span></pre>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
|
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
|
||||||
|
@ -175,11 +175,11 @@
|
|||||||
<dt><code>atc</code></dt><dd><p>ATC code, like <code>J01CR02</code></p></dd>
|
<dt><code>atc</code></dt><dd><p>ATC code, like <code>J01CR02</code></p></dd>
|
||||||
<dt><code>certe</code></dt><dd><p>Certe code, like <code>amcl</code></p></dd>
|
<dt><code>certe</code></dt><dd><p>Certe code, like <code>amcl</code></p></dd>
|
||||||
<dt><code>umcg</code></dt><dd><p>UMCG code, like <code>AMCL</code></p></dd>
|
<dt><code>umcg</code></dt><dd><p>UMCG code, like <code>AMCL</code></p></dd>
|
||||||
<dt><code>abbr</code></dt><dd><p>Abbreviation as used by many countries, used internally by <code>as.atc</code></p></dd>
|
<dt><code>abbr</code></dt><dd><p>Abbreviation as used by many countries, used internally by <code><a href='as.atc.html'>as.atc</a></code></p></dd>
|
||||||
<dt><code>official</code></dt><dd><p>Official name by the WHO, like <code>"Amoxicillin and beta-lactamase inhibitor"</code></p></dd>
|
<dt><code>official</code></dt><dd><p>Official name by the WHO, like <code>"Amoxicillin and beta-lactamase inhibitor"</code></p></dd>
|
||||||
<dt><code>official_nl</code></dt><dd><p>Official name in the Netherlands, like <code>"Amoxicilline met enzymremmer"</code></p></dd>
|
<dt><code>official_nl</code></dt><dd><p>Official name in the Netherlands, like <code>"Amoxicilline met enzymremmer"</code></p></dd>
|
||||||
<dt><code>trivial_nl</code></dt><dd><p>Trivial name in Dutch, like <code>"Amoxicilline/clavulaanzuur"</code></p></dd>
|
<dt><code>trivial_nl</code></dt><dd><p>Trivial name in Dutch, like <code>"Amoxicilline/clavulaanzuur"</code></p></dd>
|
||||||
<dt><code>trade_name</code></dt><dd><p>Trade name as used by many countries (a total of 294), used internally by <code>as.atc</code></p></dd>
|
<dt><code>trade_name</code></dt><dd><p>Trade name as used by many countries (a total of 294), used internally by <code><a href='as.atc.html'>as.atc</a></code></p></dd>
|
||||||
<dt><code>oral_ddd</code></dt><dd><p>Defined Daily Dose (DDD), oral treatment</p></dd>
|
<dt><code>oral_ddd</code></dt><dd><p>Defined Daily Dose (DDD), oral treatment</p></dd>
|
||||||
<dt><code>oral_units</code></dt><dd><p>Units of <code>ddd_units</code></p></dd>
|
<dt><code>oral_units</code></dt><dd><p>Units of <code>ddd_units</code></p></dd>
|
||||||
<dt><code>iv_ddd</code></dt><dd><p>Defined Daily Dose (DDD), parenteral treatment</p></dd>
|
<dt><code>iv_ddd</code></dt><dd><p>Defined Daily Dose (DDD), parenteral treatment</p></dd>
|
||||||
@ -198,7 +198,7 @@
|
|||||||
|
|
||||||
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
||||||
|
|
||||||
<div class='dont-index'><p><code>microorganisms</code></p></div>
|
<div class='dont-index'><p><code><a href='microorganisms.html'>microorganisms</a></code></p></div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -163,7 +163,7 @@
|
|||||||
|
|
||||||
<div class="ref-description">
|
<div class="ref-description">
|
||||||
|
|
||||||
<p>Use this function to determine the ATC code of one or more antibiotics. The data set <code>antibiotics</code> will be searched for abbreviations, official names and trade names.</p>
|
<p>Use this function to determine the ATC code of one or more antibiotics. The data set <code><a href='antibiotics.html'>antibiotics</a></code> will be searched for abbreviations, official names and trade names.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -188,13 +188,13 @@
|
|||||||
|
|
||||||
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
|
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
|
||||||
|
|
||||||
<p>Use the <code>ab_property</code> functions to get properties based on the returned ATC code, see Examples.</p>
|
<p>Use the <code><a href='ab_property.html'>ab_property</a></code> functions to get properties based on the returned ATC code, see Examples.</p>
|
||||||
<p>In the ATC classification system, the active substances are classified in a hierarchy with five different levels. The system has fourteen main anatomical/pharmacological groups or 1st levels. Each ATC main group is divided into 2nd levels which could be either pharmacological or therapeutic groups. The 3rd and 4th levels are chemical, pharmacological or therapeutic subgroups and the 5th level is the chemical substance. The 2nd, 3rd and 4th levels are often used to identify pharmacological subgroups when that is considered more appropriate than therapeutic or chemical subgroups.
|
<p>In the ATC classification system, the active substances are classified in a hierarchy with five different levels. The system has fourteen main anatomical/pharmacological groups or 1st levels. Each ATC main group is divided into 2nd levels which could be either pharmacological or therapeutic groups. The 3rd and 4th levels are chemical, pharmacological or therapeutic subgroups and the 5th level is the chemical substance. The 2nd, 3rd and 4th levels are often used to identify pharmacological subgroups when that is considered more appropriate than therapeutic or chemical subgroups.
|
||||||
Source: <a href='https://www.whocc.no/atc/structure_and_principles/'>https://www.whocc.no/atc/structure_and_principles/</a></p>
|
Source: <a href='https://www.whocc.no/atc/structure_and_principles/'>https://www.whocc.no/atc/structure_and_principles/</a></p>
|
||||||
|
|
||||||
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
||||||
|
|
||||||
<div class='dont-index'><p><code>antibiotics</code> for the dataframe that is being used to determine ATCs.</p></div>
|
<div class='dont-index'><p><code><a href='antibiotics.html'>antibiotics</a></code> for the dataframe that is being used to determine ATCs.</p></div>
|
||||||
|
|
||||||
|
|
||||||
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
||||||
@ -212,8 +212,8 @@
|
|||||||
|
|
||||||
<span class='co'># Use ab_* functions to get a specific property based on an ATC code</span>
|
<span class='co'># Use ab_* functions to get a specific property based on an ATC code</span>
|
||||||
<span class='no'>Cipro</span> <span class='kw'><-</span> <span class='fu'>as.atc</span>(<span class='st'>"cipro"</span>) <span class='co'># returns `J01MA02`</span>
|
<span class='no'>Cipro</span> <span class='kw'><-</span> <span class='fu'>as.atc</span>(<span class='st'>"cipro"</span>) <span class='co'># returns `J01MA02`</span>
|
||||||
<span class='fu'>ab_official</span>(<span class='no'>Cipro</span>) <span class='co'># returns "Ciprofloxacin"</span>
|
<span class='fu'><a href='ab_property.html'>ab_official</a></span>(<span class='no'>Cipro</span>) <span class='co'># returns "Ciprofloxacin"</span>
|
||||||
<span class='fu'>ab_umcg</span>(<span class='no'>Cipro</span>) <span class='co'># returns "CIPR", the code used in the UMCG</span>
|
<span class='fu'><a href='ab_property.html'>ab_umcg</a></span>(<span class='no'>Cipro</span>) <span class='co'># returns "CIPR", the code used in the UMCG</span>
|
||||||
<span class='co'># }</span></pre>
|
<span class='co'># }</span></pre>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
|
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
|
||||||
|
@ -190,7 +190,7 @@
|
|||||||
|
|
||||||
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
||||||
|
|
||||||
<div class='dont-index'><p><code>as.rsi</code></p></div>
|
<div class='dont-index'><p><code><a href='as.rsi.html'>as.rsi</a></code></p></div>
|
||||||
|
|
||||||
|
|
||||||
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
||||||
@ -203,7 +203,7 @@
|
|||||||
|
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/graphics/topics/plot'>plot</a></span>(<span class='no'>mic_data</span>)
|
<span class='fu'><a href='https://www.rdocumentation.org/packages/graphics/topics/plot'>plot</a></span>(<span class='no'>mic_data</span>)
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/graphics/topics/barplot'>barplot</a></span>(<span class='no'>mic_data</span>)
|
<span class='fu'><a href='https://www.rdocumentation.org/packages/graphics/topics/barplot'>barplot</a></span>(<span class='no'>mic_data</span>)
|
||||||
<span class='fu'>freq</span>(<span class='no'>mic_data</span>)
|
<span class='fu'><a href='freq.html'>freq</a></span>(<span class='no'>mic_data</span>)
|
||||||
<span class='co'># }</span></pre>
|
<span class='co'># }</span></pre>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
|
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
|
||||||
|
@ -198,7 +198,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>reference_df</th>
|
<th>reference_df</th>
|
||||||
<td><p>a <code>data.frame</code> to use for extra reference when translating <code>x</code> to a valid <code>mo</code>. The first column can be any microbial name, code or ID (used in your analysis or organisation), the second column must be a valid <code>mo</code> as found in the <code>microorganisms</code> data set.</p></td>
|
<td><p>a <code>data.frame</code> to use for extra reference when translating <code>x</code> to a valid <code>mo</code>. The first column can be any microbial name, code or ID (used in your analysis or organisation), the second column must be a valid <code>mo</code> as found in the <code><a href='microorganisms.html'>microorganisms</a></code> data set.</p></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
@ -221,7 +221,7 @@
|
|||||||
| ----> genus, a 5-7 letter acronym, mostly without vowels
|
| ----> genus, a 5-7 letter acronym, mostly without vowels
|
||||||
----> taxonomic kingdom, either B (Bacteria), F (Fungi) or P (Protozoa)
|
----> taxonomic kingdom, either B (Bacteria), F (Fungi) or P (Protozoa)
|
||||||
</pre>
|
</pre>
|
||||||
<p>Use the <code>mo_property</code> functions to get properties based on the returned code, see Examples.</p>
|
<p>Use the <code><a href='mo_property.html'>mo_property</a></code> functions to get properties based on the returned code, see Examples.</p>
|
||||||
<p>This function uses Artificial Intelligence (AI) to help getting fast and logical results. It tries to find matches in this order:</p><ul>
|
<p>This function uses Artificial Intelligence (AI) to help getting fast and logical results. It tries to find matches in this order:</p><ul>
|
||||||
<li><p>Taxonomic kingdom: it first searches in bacteria, then fungi, then protozoa</p></li>
|
<li><p>Taxonomic kingdom: it first searches in bacteria, then fungi, then protozoa</p></li>
|
||||||
<li><p>Human pathogenic prevalence: it first searches in more prevalent microorganisms, then less prevalent ones</p></li>
|
<li><p>Human pathogenic prevalence: it first searches in more prevalent microorganisms, then less prevalent ones</p></li>
|
||||||
@ -258,8 +258,8 @@ This package contains the <strong>complete microbial taxonomic data</strong> (wi
|
|||||||
|
|
||||||
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
||||||
|
|
||||||
<div class='dont-index'><p><code>microorganisms</code> for the <code>data.frame</code> with ITIS content that is being used to determine ID's. <br />
|
<div class='dont-index'><p><code><a href='microorganisms.html'>microorganisms</a></code> for the <code>data.frame</code> with ITIS content that is being used to determine ID's. <br />
|
||||||
The <code>mo_property</code> functions (like <code>mo_genus</code>, <code>mo_gramstain</code>) to get properties based on the returned code.</p></div>
|
The <code><a href='mo_property.html'>mo_property</a></code> functions (like <code><a href='mo_property.html'>mo_genus</a></code>, <code><a href='mo_property.html'>mo_gramstain</a></code>) to get properties based on the returned code.</p></div>
|
||||||
|
|
||||||
|
|
||||||
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
||||||
@ -291,10 +291,10 @@ The <code>mo_property</code> functions (like <code>mo_genus</code>, <code>mo_gra
|
|||||||
|
|
||||||
<span class='co'># Use mo_* functions to get a specific property based on `mo`</span>
|
<span class='co'># Use mo_* functions to get a specific property based on `mo`</span>
|
||||||
<span class='no'>Ecoli</span> <span class='kw'><-</span> <span class='fu'>as.mo</span>(<span class='st'>"E. coli"</span>) <span class='co'># returns `B_ESCHR_COL`</span>
|
<span class='no'>Ecoli</span> <span class='kw'><-</span> <span class='fu'>as.mo</span>(<span class='st'>"E. coli"</span>) <span class='co'># returns `B_ESCHR_COL`</span>
|
||||||
<span class='fu'>mo_genus</span>(<span class='no'>Ecoli</span>) <span class='co'># returns "Escherichia"</span>
|
<span class='fu'><a href='mo_property.html'>mo_genus</a></span>(<span class='no'>Ecoli</span>) <span class='co'># returns "Escherichia"</span>
|
||||||
<span class='fu'>mo_gramstain</span>(<span class='no'>Ecoli</span>) <span class='co'># returns "Gram negative"</span>
|
<span class='fu'><a href='mo_property.html'>mo_gramstain</a></span>(<span class='no'>Ecoli</span>) <span class='co'># returns "Gram negative"</span>
|
||||||
<span class='co'># but it uses as.mo internally too, so you could also just use:</span>
|
<span class='co'># but it uses as.mo internally too, so you could also just use:</span>
|
||||||
<span class='fu'>mo_genus</span>(<span class='st'>"E. coli"</span>) <span class='co'># returns "Escherichia"</span>
|
<span class='fu'><a href='mo_property.html'>mo_genus</a></span>(<span class='st'>"E. coli"</span>) <span class='co'># returns "Escherichia"</span>
|
||||||
|
|
||||||
|
|
||||||
<span class='co'># }</span><span class='co'># NOT RUN {</span>
|
<span class='co'># }</span><span class='co'># NOT RUN {</span>
|
||||||
@ -303,16 +303,16 @@ The <code>mo_property</code> functions (like <code>mo_genus</code>, <code>mo_gra
|
|||||||
<span class='co'># the select function of tidyverse is also supported:</span>
|
<span class='co'># the select function of tidyverse is also supported:</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
|
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
|
||||||
<span class='no'>df</span>$<span class='no'>mo</span> <span class='kw'><-</span> <span class='no'>df</span> <span class='kw'>%>%</span>
|
<span class='no'>df</span>$<span class='no'>mo</span> <span class='kw'><-</span> <span class='no'>df</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>microorganism_name</span>) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>microorganism_name</span>) <span class='kw'>%>%</span>
|
||||||
<span class='fu'>as.mo</span>()
|
<span class='fu'>as.mo</span>()
|
||||||
|
|
||||||
<span class='co'># and can even contain 2 columns, which is convenient for genus/species combinations:</span>
|
<span class='co'># and can even contain 2 columns, which is convenient for genus/species combinations:</span>
|
||||||
<span class='no'>df</span>$<span class='no'>mo</span> <span class='kw'><-</span> <span class='no'>df</span> <span class='kw'>%>%</span>
|
<span class='no'>df</span>$<span class='no'>mo</span> <span class='kw'><-</span> <span class='no'>df</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>genus</span>, <span class='no'>species</span>) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>genus</span>, <span class='no'>species</span>) <span class='kw'>%>%</span>
|
||||||
<span class='fu'>as.mo</span>()
|
<span class='fu'>as.mo</span>()
|
||||||
<span class='co'># although this works easier and does the same:</span>
|
<span class='co'># although this works easier and does the same:</span>
|
||||||
<span class='no'>df</span> <span class='kw'><-</span> <span class='no'>df</span> <span class='kw'>%>%</span>
|
<span class='no'>df</span> <span class='kw'><-</span> <span class='no'>df</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/mutate'>mutate</a></span>(<span class='kw'>mo</span> <span class='kw'>=</span> <span class='fu'>as.mo</span>(<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/paste'>paste</a></span>(<span class='no'>genus</span>, <span class='no'>species</span>)))
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>mo</span> <span class='kw'>=</span> <span class='fu'>as.mo</span>(<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/paste'>paste</a></span>(<span class='no'>genus</span>, <span class='no'>species</span>)))
|
||||||
<span class='co'># }</span></pre>
|
<span class='co'># }</span></pre>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
|
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
|
||||||
|
@ -192,7 +192,7 @@
|
|||||||
|
|
||||||
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
||||||
|
|
||||||
<div class='dont-index'><p><code>as.mic</code></p></div>
|
<div class='dont-index'><p><code><a href='as.mic.html'>as.mic</a></code></p></div>
|
||||||
|
|
||||||
|
|
||||||
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
||||||
@ -206,16 +206,16 @@
|
|||||||
|
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/graphics/topics/plot'>plot</a></span>(<span class='no'>rsi_data</span>) <span class='co'># for percentages</span>
|
<span class='fu'><a href='https://www.rdocumentation.org/packages/graphics/topics/plot'>plot</a></span>(<span class='no'>rsi_data</span>) <span class='co'># for percentages</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/graphics/topics/barplot'>barplot</a></span>(<span class='no'>rsi_data</span>) <span class='co'># for frequencies</span>
|
<span class='fu'><a href='https://www.rdocumentation.org/packages/graphics/topics/barplot'>barplot</a></span>(<span class='no'>rsi_data</span>) <span class='co'># for frequencies</span>
|
||||||
<span class='fu'>freq</span>(<span class='no'>rsi_data</span>) <span class='co'># frequency table with informative header</span>
|
<span class='fu'><a href='freq.html'>freq</a></span>(<span class='no'>rsi_data</span>) <span class='co'># frequency table with informative header</span>
|
||||||
|
|
||||||
<span class='co'># using dplyr's mutate</span>
|
<span class='co'># using dplyr's mutate</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
|
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
|
||||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/summarise_all'>mutate_at</a></span>(<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/vars'>vars</a></span>(<span class='no'>peni</span>:<span class='no'>rifa</span>), <span class='no'>as.rsi</span>)
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/summarise_all.html'>mutate_at</a></span>(<span class='fu'><a href='http://dplyr.tidyverse.org/reference/vars.html'>vars</a></span>(<span class='no'>peni</span>:<span class='no'>rifa</span>), <span class='no'>as.rsi</span>)
|
||||||
|
|
||||||
<span class='co'># fastest way to transform all columns with already valid AB results to class `rsi`:</span>
|
<span class='co'># fastest way to transform all columns with already valid AB results to class `rsi`:</span>
|
||||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/summarise_all'>mutate_if</a></span>(<span class='no'>is.rsi.eligible</span>,
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/summarise_all.html'>mutate_if</a></span>(<span class='no'>is.rsi.eligible</span>,
|
||||||
<span class='no'>as.rsi</span>)
|
<span class='no'>as.rsi</span>)
|
||||||
<span class='co'># }</span></pre>
|
<span class='co'># }</span></pre>
|
||||||
</div>
|
</div>
|
||||||
|
@ -232,7 +232,7 @@
|
|||||||
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
||||||
<pre class="examples"><span class='co'># NOT RUN {</span>
|
<pre class="examples"><span class='co'># NOT RUN {</span>
|
||||||
<span class='co'># What's the ATC of amoxicillin?</span>
|
<span class='co'># What's the ATC of amoxicillin?</span>
|
||||||
<span class='fu'>guess_atc</span>(<span class='st'>"Amoxicillin"</span>)
|
<span class='fu'><a href='as.atc.html'>guess_atc</a></span>(<span class='st'>"Amoxicillin"</span>)
|
||||||
<span class='co'># [1] "J01CA04"</span>
|
<span class='co'># [1] "J01CA04"</span>
|
||||||
|
|
||||||
<span class='co'># oral DDD (Defined Daily Dose) of amoxicillin</span>
|
<span class='co'># oral DDD (Defined Daily Dose) of amoxicillin</span>
|
||||||
|
@ -191,7 +191,7 @@ count_R and count_IR can be used to count resistant isolates, count_S and count_
|
|||||||
<colgroup><col class="name" /><col class="desc" /></colgroup>
|
<colgroup><col class="name" /><col class="desc" /></colgroup>
|
||||||
<tr>
|
<tr>
|
||||||
<th>...</th>
|
<th>...</th>
|
||||||
<td><p>one or more vectors (or columns) with antibiotic interpretations. They will be transformed internally with <code>as.rsi</code> if needed.</p></td>
|
<td><p>one or more vectors (or columns) with antibiotic interpretations. They will be transformed internally with <code><a href='as.rsi.html'>as.rsi</a></code> if needed.</p></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>also_single_tested</th>
|
<th>also_single_tested</th>
|
||||||
@ -199,11 +199,11 @@ count_R and count_IR can be used to count resistant isolates, count_S and count_
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>data</th>
|
<th>data</th>
|
||||||
<td><p>a <code>data.frame</code> containing columns with class <code>rsi</code> (see <code>as.rsi</code>)</p></td>
|
<td><p>a <code>data.frame</code> containing columns with class <code>rsi</code> (see <code><a href='as.rsi.html'>as.rsi</a></code>)</p></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>translate_ab</th>
|
<th>translate_ab</th>
|
||||||
<td><p>a column name of the <code>antibiotics</code> data set to translate the antibiotic abbreviations to, using <code>abname</code>. This can be set with <code><a href='https://www.rdocumentation.org/packages/base/topics/options'>getOption</a>("get_antibiotic_names")</code>.</p></td>
|
<td><p>a column name of the <code><a href='antibiotics.html'>antibiotics</a></code> data set to translate the antibiotic abbreviations to, using <code><a href='abname.html'>abname</a></code>. This can be set with <code><a href='https://www.rdocumentation.org/packages/base/topics/options'>getOption</a>("get_antibiotic_names")</code>.</p></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>combine_IR</th>
|
<th>combine_IR</th>
|
||||||
@ -221,13 +221,13 @@ count_R and count_IR can be used to count resistant isolates, count_S and count_
|
|||||||
|
|
||||||
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
|
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
|
||||||
|
|
||||||
<p>These functions are meant to count isolates. Use the <code>portion_*</code> functions to calculate microbial resistance.</p>
|
<p>These functions are meant to count isolates. Use the <code><a href='portion.html'>portion</a>_*</code> functions to calculate microbial resistance.</p>
|
||||||
<p><code>n_rsi</code> is an alias of <code>count_all</code>. They can be used to count all available isolates, i.e. where all input antibiotics have an available result (S, I or R). Their use is equal to <code><a href='https://www.rdocumentation.org/packages/dplyr/topics/n_distinct'>n_distinct</a></code>. Their function is equal to <code>count_S(...) + count_IR(...)</code>.</p>
|
<p><code>n_rsi</code> is an alias of <code>count_all</code>. They can be used to count all available isolates, i.e. where all input antibiotics have an available result (S, I or R). Their use is equal to <code><a href='http://dplyr.tidyverse.org/reference/n_distinct.html'>n_distinct</a></code>. Their function is equal to <code>count_S(...) + count_IR(...)</code>.</p>
|
||||||
<p><code>count_df</code> takes any variable from <code>data</code> that has an <code>"rsi"</code> class (created with <code>as.rsi</code>) and counts the amounts of R, I and S. The resulting <em>tidy data</em> (see Source) <code>data.frame</code> will have three rows (S/I/R) and a column for each variable with class <code>"rsi"</code>.</p>
|
<p><code>count_df</code> takes any variable from <code>data</code> that has an <code>"rsi"</code> class (created with <code><a href='as.rsi.html'>as.rsi</a></code>) and counts the amounts of R, I and S. The resulting <em>tidy data</em> (see Source) <code>data.frame</code> will have three rows (S/I/R) and a column for each variable with class <code>"rsi"</code>.</p>
|
||||||
|
|
||||||
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
||||||
|
|
||||||
<div class='dont-index'><p><code>portion_*</code> to calculate microbial resistance and susceptibility.</p></div>
|
<div class='dont-index'><p><code><a href='portion.html'>portion</a>_*</code> to calculate microbial resistance and susceptibility.</p></div>
|
||||||
|
|
||||||
|
|
||||||
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
||||||
@ -251,17 +251,17 @@ count_R and count_IR can be used to count resistant isolates, count_S and count_
|
|||||||
<span class='co'># calculate back to count e.g. non-susceptible isolates.</span>
|
<span class='co'># calculate back to count e.g. non-susceptible isolates.</span>
|
||||||
<span class='co'># This results in the same:</span>
|
<span class='co'># This results in the same:</span>
|
||||||
<span class='fu'>count_IR</span>(<span class='no'>septic_patients</span>$<span class='no'>amox</span>)
|
<span class='fu'>count_IR</span>(<span class='no'>septic_patients</span>$<span class='no'>amox</span>)
|
||||||
<span class='fu'>portion_IR</span>(<span class='no'>septic_patients</span>$<span class='no'>amox</span>) * <span class='fu'>n_rsi</span>(<span class='no'>septic_patients</span>$<span class='no'>amox</span>)
|
<span class='fu'><a href='portion.html'>portion_IR</a></span>(<span class='no'>septic_patients</span>$<span class='no'>amox</span>) * <span class='fu'>n_rsi</span>(<span class='no'>septic_patients</span>$<span class='no'>amox</span>)
|
||||||
|
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
|
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
|
||||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/summarise'>summarise</a></span>(<span class='kw'>R</span> <span class='kw'>=</span> <span class='fu'>count_R</span>(<span class='no'>cipr</span>),
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/summarise.html'>summarise</a></span>(<span class='kw'>R</span> <span class='kw'>=</span> <span class='fu'>count_R</span>(<span class='no'>cipr</span>),
|
||||||
<span class='kw'>I</span> <span class='kw'>=</span> <span class='fu'>count_I</span>(<span class='no'>cipr</span>),
|
<span class='kw'>I</span> <span class='kw'>=</span> <span class='fu'>count_I</span>(<span class='no'>cipr</span>),
|
||||||
<span class='kw'>S</span> <span class='kw'>=</span> <span class='fu'>count_S</span>(<span class='no'>cipr</span>),
|
<span class='kw'>S</span> <span class='kw'>=</span> <span class='fu'>count_S</span>(<span class='no'>cipr</span>),
|
||||||
<span class='kw'>n1</span> <span class='kw'>=</span> <span class='fu'>count_all</span>(<span class='no'>cipr</span>), <span class='co'># the actual total; sum of all three</span>
|
<span class='kw'>n1</span> <span class='kw'>=</span> <span class='fu'>count_all</span>(<span class='no'>cipr</span>), <span class='co'># the actual total; sum of all three</span>
|
||||||
<span class='kw'>n2</span> <span class='kw'>=</span> <span class='fu'>n_rsi</span>(<span class='no'>cipr</span>), <span class='co'># same - analogous to n_distinct</span>
|
<span class='kw'>n2</span> <span class='kw'>=</span> <span class='fu'>n_rsi</span>(<span class='no'>cipr</span>), <span class='co'># same - analogous to n_distinct</span>
|
||||||
<span class='kw'>total</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/n'>n</a></span>()) <span class='co'># NOT the amount of tested isolates!</span>
|
<span class='kw'>total</span> <span class='kw'>=</span> <span class='fu'><a href='http://dplyr.tidyverse.org/reference/n.html'>n</a></span>()) <span class='co'># NOT the amount of tested isolates!</span>
|
||||||
|
|
||||||
<span class='co'># Count co-resistance between amoxicillin/clav acid and gentamicin,</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'># so we can see that combination therapy does a lot more than mono therapy.</span>
|
||||||
@ -279,13 +279,13 @@ count_R and count_IR can be used to count resistant isolates, count_S and count_
|
|||||||
|
|
||||||
<span class='co'># Get portions S/I/R immediately of all rsi columns</span>
|
<span class='co'># Get portions S/I/R immediately of all rsi columns</span>
|
||||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>amox</span>, <span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>amox</span>, <span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
||||||
<span class='fu'>count_df</span>(<span class='kw'>translate</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)
|
<span class='fu'>count_df</span>(<span class='kw'>translate</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)
|
||||||
|
|
||||||
<span class='co'># It also supports grouping variables</span>
|
<span class='co'># It also supports grouping variables</span>
|
||||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>hospital_id</span>, <span class='no'>amox</span>, <span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>hospital_id</span>, <span class='no'>amox</span>, <span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
||||||
<span class='fu'>count_df</span>(<span class='kw'>translate</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)
|
<span class='fu'>count_df</span>(<span class='kw'>translate</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)
|
||||||
|
|
||||||
<span class='co'># }</span></pre>
|
<span class='co'># }</span></pre>
|
||||||
|
@ -199,7 +199,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>col_mo</th>
|
<th>col_mo</th>
|
||||||
<td><p>column name of the unique IDs of the microorganisms (see <code>mo</code>), defaults to the first column of class <code>mo</code>. Values will be coerced using <code>as.mo</code>.</p></td>
|
<td><p>column name of the unique IDs of the microorganisms (see <code><a href='as.mo.html'>mo</a></code>), defaults to the first column of class <code>mo</code>. Values will be coerced using <code><a href='as.mo.html'>as.mo</a></code>.</p></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>info</th>
|
<th>info</th>
|
||||||
|
@ -198,7 +198,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>col_mo</th>
|
<th>col_mo</th>
|
||||||
<td><p>column name of the unique IDs of the microorganisms (see <code>mo</code>), defaults to the first column of class <code>mo</code>. Values will be coerced using <code>as.mo</code>.</p></td>
|
<td><p>column name of the unique IDs of the microorganisms (see <code><a href='as.mo.html'>mo</a></code>), defaults to the first column of class <code>mo</code>. Values will be coerced using <code><a href='as.mo.html'>as.mo</a></code>.</p></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>col_testcode</th>
|
<th>col_testcode</th>
|
||||||
@ -214,7 +214,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>col_keyantibiotics</th>
|
<th>col_keyantibiotics</th>
|
||||||
<td><p>column name of the key antibiotics to determine first <em>weighted</em> isolates, see <code>key_antibiotics</code>. Defaults to the first column that starts with 'key' followed by 'ab' or 'antibiotics' (case insensitive). Use <code>col_keyantibiotics = FALSE</code> to prevent this.</p></td>
|
<td><p>column name of the key antibiotics to determine first <em>weighted</em> isolates, see <code><a href='key_antibiotics.html'>key_antibiotics</a></code>. Defaults to the first column that starts with 'key' followed by 'ab' or 'antibiotics' (case insensitive). Use <code>col_keyantibiotics = FALSE</code> to prevent this.</p></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>episode_days</th>
|
<th>episode_days</th>
|
||||||
@ -291,7 +291,7 @@ To conduct an analysis of antimicrobial resistance, you should only include the
|
|||||||
|
|
||||||
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
||||||
|
|
||||||
<div class='dont-index'><p><code>key_antibiotics</code></p></div>
|
<div class='dont-index'><p><code><a href='key_antibiotics.html'>key_antibiotics</a></code></p></div>
|
||||||
|
|
||||||
|
|
||||||
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
||||||
@ -302,11 +302,11 @@ To conduct an analysis of antimicrobial resistance, you should only include the
|
|||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
|
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
|
||||||
<span class='co'># Filter on first isolates:</span>
|
<span class='co'># Filter on first isolates:</span>
|
||||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/mutate'>mutate</a></span>(<span class='kw'>first_isolate</span> <span class='kw'>=</span> <span class='fu'>first_isolate</span>(<span class='no'>.</span>,
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>first_isolate</span> <span class='kw'>=</span> <span class='fu'>first_isolate</span>(<span class='no'>.</span>,
|
||||||
<span class='kw'>col_date</span> <span class='kw'>=</span> <span class='st'>"date"</span>,
|
<span class='kw'>col_date</span> <span class='kw'>=</span> <span class='st'>"date"</span>,
|
||||||
<span class='kw'>col_patient_id</span> <span class='kw'>=</span> <span class='st'>"patient_id"</span>,
|
<span class='kw'>col_patient_id</span> <span class='kw'>=</span> <span class='st'>"patient_id"</span>,
|
||||||
<span class='kw'>col_mo</span> <span class='kw'>=</span> <span class='st'>"mo"</span>)) <span class='kw'>%>%</span>
|
<span class='kw'>col_mo</span> <span class='kw'>=</span> <span class='st'>"mo"</span>)) <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>)
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>)
|
||||||
|
|
||||||
<span class='co'># Which can be shortened to:</span>
|
<span class='co'># Which can be shortened to:</span>
|
||||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||||
@ -317,15 +317,15 @@ To conduct an analysis of antimicrobial resistance, you should only include the
|
|||||||
|
|
||||||
<span class='co'># Now let's see if first isolates matter:</span>
|
<span class='co'># Now let's see if first isolates matter:</span>
|
||||||
<span class='no'>A</span> <span class='kw'><-</span> <span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
<span class='no'>A</span> <span class='kw'><-</span> <span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/summarise'>summarise</a></span>(<span class='kw'>count</span> <span class='kw'>=</span> <span class='fu'>n_rsi</span>(<span class='no'>gent</span>), <span class='co'># gentamicin availability</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/summarise.html'>summarise</a></span>(<span class='kw'>count</span> <span class='kw'>=</span> <span class='fu'><a href='count.html'>n_rsi</a></span>(<span class='no'>gent</span>), <span class='co'># gentamicin availability</span>
|
||||||
<span class='kw'>resistance</span> <span class='kw'>=</span> <span class='fu'>portion_IR</span>(<span class='no'>gent</span>)) <span class='co'># gentamicin resistance</span>
|
<span class='kw'>resistance</span> <span class='kw'>=</span> <span class='fu'><a href='portion.html'>portion_IR</a></span>(<span class='no'>gent</span>)) <span class='co'># gentamicin resistance</span>
|
||||||
|
|
||||||
<span class='no'>B</span> <span class='kw'><-</span> <span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
<span class='no'>B</span> <span class='kw'><-</span> <span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'>filter_first_weighted_isolate</span>() <span class='kw'>%>%</span> <span class='co'># the 1st isolate filter</span>
|
<span class='fu'>filter_first_weighted_isolate</span>() <span class='kw'>%>%</span> <span class='co'># the 1st isolate filter</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/summarise'>summarise</a></span>(<span class='kw'>count</span> <span class='kw'>=</span> <span class='fu'>n_rsi</span>(<span class='no'>gent</span>), <span class='co'># gentamicin availability</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/summarise.html'>summarise</a></span>(<span class='kw'>count</span> <span class='kw'>=</span> <span class='fu'><a href='count.html'>n_rsi</a></span>(<span class='no'>gent</span>), <span class='co'># gentamicin availability</span>
|
||||||
<span class='kw'>resistance</span> <span class='kw'>=</span> <span class='fu'>portion_IR</span>(<span class='no'>gent</span>)) <span class='co'># gentamicin resistance</span>
|
<span class='kw'>resistance</span> <span class='kw'>=</span> <span class='fu'><a href='portion.html'>portion_IR</a></span>(<span class='no'>gent</span>)) <span class='co'># gentamicin resistance</span>
|
||||||
|
|
||||||
<span class='co'># Have a look at A and B.</span>
|
<span class='co'># Have a look at A and B.</span>
|
||||||
<span class='co'># B is more reliable because every isolate is only counted once.</span>
|
<span class='co'># B is more reliable because every isolate is only counted once.</span>
|
||||||
@ -337,7 +337,7 @@ To conduct an analysis of antimicrobial resistance, you should only include the
|
|||||||
|
|
||||||
<span class='co'># }</span><span class='co'># NOT RUN {</span>
|
<span class='co'># }</span><span class='co'># NOT RUN {</span>
|
||||||
<span class='co'># set key antibiotics to a new variable</span>
|
<span class='co'># set key antibiotics to a new variable</span>
|
||||||
<span class='no'>tbl</span>$<span class='no'>keyab</span> <span class='kw'><-</span> <span class='fu'>key_antibiotics</span>(<span class='no'>tbl</span>)
|
<span class='no'>tbl</span>$<span class='no'>keyab</span> <span class='kw'><-</span> <span class='fu'><a href='key_antibiotics.html'>key_antibiotics</a></span>(<span class='no'>tbl</span>)
|
||||||
|
|
||||||
<span class='no'>tbl</span>$<span class='no'>first_isolate</span> <span class='kw'><-</span>
|
<span class='no'>tbl</span>$<span class='no'>first_isolate</span> <span class='kw'><-</span>
|
||||||
<span class='fu'>first_isolate</span>(<span class='no'>tbl</span>)
|
<span class='fu'>first_isolate</span>(<span class='no'>tbl</span>)
|
||||||
|
@ -317,34 +317,34 @@
|
|||||||
|
|
||||||
<span class='co'># you could also use `select` or `pull` to get your variables</span>
|
<span class='co'># you could also use `select` or `pull` to get your variables</span>
|
||||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>hospital_id</span> <span class='kw'>==</span> <span class='st'>"A"</span>) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>hospital_id</span> <span class='kw'>==</span> <span class='st'>"A"</span>) <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>mo</span>) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>mo</span>) <span class='kw'>%>%</span>
|
||||||
<span class='fu'>freq</span>()
|
<span class='fu'>freq</span>()
|
||||||
|
|
||||||
|
|
||||||
<span class='co'># multiple selected variables will be pasted together</span>
|
<span class='co'># multiple selected variables will be pasted together</span>
|
||||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||||
<span class='no'>left_join_microorganisms</span> <span class='kw'>%>%</span>
|
<span class='no'>left_join_microorganisms</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>hospital_id</span> <span class='kw'>==</span> <span class='st'>"A"</span>) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>hospital_id</span> <span class='kw'>==</span> <span class='st'>"A"</span>) <span class='kw'>%>%</span>
|
||||||
<span class='fu'>freq</span>(<span class='no'>genus</span>, <span class='no'>species</span>)
|
<span class='fu'>freq</span>(<span class='no'>genus</span>, <span class='no'>species</span>)
|
||||||
|
|
||||||
|
|
||||||
<span class='co'># group a variable and analyse another</span>
|
<span class='co'># group a variable and analyse another</span>
|
||||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
||||||
<span class='fu'>freq</span>(<span class='no'>gender</span>)
|
<span class='fu'>freq</span>(<span class='no'>gender</span>)
|
||||||
|
|
||||||
|
|
||||||
<span class='co'># get top 10 bugs of hospital A as a vector</span>
|
<span class='co'># get top 10 bugs of hospital A as a vector</span>
|
||||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>hospital_id</span> <span class='kw'>==</span> <span class='st'>"A"</span>) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>hospital_id</span> <span class='kw'>==</span> <span class='st'>"A"</span>) <span class='kw'>%>%</span>
|
||||||
<span class='fu'>freq</span>(<span class='no'>mo</span>) <span class='kw'>%>%</span>
|
<span class='fu'>freq</span>(<span class='no'>mo</span>) <span class='kw'>%>%</span>
|
||||||
<span class='fu'>top_freq</span>(<span class='fl'>10</span>)
|
<span class='fu'>top_freq</span>(<span class='fl'>10</span>)
|
||||||
|
|
||||||
|
|
||||||
<span class='co'># save frequency table to an object</span>
|
<span class='co'># save frequency table to an object</span>
|
||||||
<span class='no'>years</span> <span class='kw'><-</span> <span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
<span class='no'>years</span> <span class='kw'><-</span> <span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/mutate'>mutate</a></span>(<span class='kw'>year</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/format'>format</a></span>(<span class='no'>date</span>, <span class='st'>"%Y"</span>)) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>year</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/format'>format</a></span>(<span class='no'>date</span>, <span class='st'>"%Y"</span>)) <span class='kw'>%>%</span>
|
||||||
<span class='fu'>freq</span>(<span class='no'>year</span>)
|
<span class='fu'>freq</span>(<span class='no'>year</span>)
|
||||||
|
|
||||||
|
|
||||||
@ -395,11 +395,11 @@
|
|||||||
<span class='co'># only get selected columns</span>
|
<span class='co'># only get selected columns</span>
|
||||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'>freq</span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
<span class='fu'>freq</span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>item</span>, <span class='no'>percent</span>)
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>item</span>, <span class='no'>percent</span>)
|
||||||
|
|
||||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'>freq</span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
<span class='fu'>freq</span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(-<span class='no'>count</span>, -<span class='no'>cum_count</span>)
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/select.html'>select</a></span>(-<span class='no'>count</span>, -<span class='no'>cum_count</span>)
|
||||||
|
|
||||||
|
|
||||||
<span class='co'># check differences between frequency tables</span>
|
<span class='co'># check differences between frequency tables</span>
|
||||||
|
@ -163,7 +163,7 @@
|
|||||||
|
|
||||||
<div class="ref-description">
|
<div class="ref-description">
|
||||||
|
|
||||||
<p>Determines the system language to be used for language-dependent output of AMR functions, like <code>mo_gramstain</code> and <code>mo_type</code>.</p>
|
<p>Determines the system language to be used for language-dependent output of AMR functions, like <code><a href='mo_property.html'>mo_gramstain</a></code> and <code><a href='mo_property.html'>mo_type</a></code>.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -193,11 +193,11 @@
|
|||||||
<colgroup><col class="name" /><col class="desc" /></colgroup>
|
<colgroup><col class="name" /><col class="desc" /></colgroup>
|
||||||
<tr>
|
<tr>
|
||||||
<th>data</th>
|
<th>data</th>
|
||||||
<td><p>a <code>data.frame</code> with column(s) of class <code>"rsi"</code> (see <code>as.rsi</code>)</p></td>
|
<td><p>a <code>data.frame</code> with column(s) of class <code>"rsi"</code> (see <code><a href='as.rsi.html'>as.rsi</a></code>)</p></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>position</th>
|
<th>position</th>
|
||||||
<td><p>position adjustment of bars, either <code>"fill"</code> (default when <code>fun</code> is <code>count_df</code>), <code>"stack"</code> (default when <code>fun</code> is <code>portion_df</code>) or <code>"dodge"</code></p></td>
|
<td><p>position adjustment of bars, either <code>"fill"</code> (default when <code>fun</code> is <code><a href='count.html'>count_df</a></code>), <code>"stack"</code> (default when <code>fun</code> is <code><a href='portion.html'>portion_df</a></code>) or <code>"dodge"</code></p></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>x</th>
|
<th>x</th>
|
||||||
@ -221,11 +221,11 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>translate_ab</th>
|
<th>translate_ab</th>
|
||||||
<td><p>a column name of the <code>antibiotics</code> data set to translate the antibiotic abbreviations into, using <code>abname</code>. Default behaviour is to translate to official names according to the WHO. Use <code>translate_ab = FALSE</code> to disable translation.</p></td>
|
<td><p>a column name of the <code><a href='antibiotics.html'>antibiotics</a></code> data set to translate the antibiotic abbreviations into, using <code><a href='abname.html'>abname</a></code>. Default behaviour is to translate to official names according to the WHO. Use <code>translate_ab = FALSE</code> to disable translation.</p></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>fun</th>
|
<th>fun</th>
|
||||||
<td><p>function to transform <code>data</code>, either <code>count_df</code> (default) or <code>portion_df</code></p></td>
|
<td><p>function to transform <code>data</code>, either <code><a href='count.html'>count_df</a></code> (default) or <code><a href='portion.html'>portion_df</a></code></p></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>nrow</th>
|
<th>nrow</th>
|
||||||
@ -251,9 +251,9 @@
|
|||||||
|
|
||||||
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
|
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
|
||||||
|
|
||||||
<p>At default, the names of antibiotics will be shown on the plots using <code>abname</code>. This can be set with the option <code>get_antibiotic_names</code> (a logical value), so change it e.g. to <code>FALSE</code> with <code><a href='https://www.rdocumentation.org/packages/base/topics/options'>options(get_antibiotic_names = FALSE)</a></code>.</p>
|
<p>At default, the names of antibiotics will be shown on the plots using <code><a href='abname.html'>abname</a></code>. This can be set with the option <code>get_antibiotic_names</code> (a logical value), so change it e.g. to <code>FALSE</code> with <code><a href='https://www.rdocumentation.org/packages/base/topics/options'>options(get_antibiotic_names = FALSE)</a></code>.</p>
|
||||||
<p><strong>The functions</strong><br />
|
<p><strong>The functions</strong><br />
|
||||||
<code>geom_rsi</code> will take any variable from the data that has an <code>rsi</code> class (created with <code>as.rsi</code>) using <code>fun</code> (<code>count_df</code> at default, can also be <code>portion_df</code>) and will plot bars with the percentage R, I and S. The default behaviour is to have the bars stacked and to have the different antibiotics on the x axis.</p>
|
<code>geom_rsi</code> will take any variable from the data that has an <code>rsi</code> class (created with <code><a href='as.rsi.html'>as.rsi</a></code>) using <code>fun</code> (<code><a href='count.html'>count_df</a></code> at default, can also be <code><a href='portion.html'>portion_df</a></code>) and will plot bars with the percentage R, I and S. The default behaviour is to have the bars stacked and to have the different antibiotics on the x axis.</p>
|
||||||
<p><code>facet_rsi</code> creates 2d plots (at default based on S/I/R) using <code><a href='https://ggplot2.tidyverse.org/reference/facet_wrap.html'>facet_wrap</a></code>.</p>
|
<p><code>facet_rsi</code> creates 2d plots (at default based on S/I/R) using <code><a href='https://ggplot2.tidyverse.org/reference/facet_wrap.html'>facet_wrap</a></code>.</p>
|
||||||
<p><code>scale_y_percent</code> transforms the y axis to a 0 to 100% range using <code>scale_continuous</code>.</p>
|
<p><code>scale_y_percent</code> transforms the y axis to a 0 to 100% range using <code>scale_continuous</code>.</p>
|
||||||
<p><code>scale_rsi_colours</code> sets colours to the bars: green for S, yellow for I and red for R, using <code>scale_brewer</code>.</p>
|
<p><code>scale_rsi_colours</code> sets colours to the bars: green for S, yellow for I and red for R, using <code>scale_brewer</code>.</p>
|
||||||
@ -268,7 +268,7 @@
|
|||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>ggplot2</span>)
|
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>ggplot2</span>)
|
||||||
|
|
||||||
<span class='co'># get antimicrobial results for drugs against a UTI:</span>
|
<span class='co'># get antimicrobial results for drugs against a UTI:</span>
|
||||||
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/ggplot.html'>ggplot</a></span>(<span class='no'>septic_patients</span> <span class='kw'>%>%</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>amox</span>, <span class='no'>nitr</span>, <span class='no'>fosf</span>, <span class='no'>trim</span>, <span class='no'>cipr</span>)) +
|
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/ggplot.html'>ggplot</a></span>(<span class='no'>septic_patients</span> <span class='kw'>%>%</span> <span class='fu'><a href='http://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>amox</span>, <span class='no'>nitr</span>, <span class='no'>fosf</span>, <span class='no'>trim</span>, <span class='no'>cipr</span>)) +
|
||||||
<span class='fu'>geom_rsi</span>()
|
<span class='fu'>geom_rsi</span>()
|
||||||
|
|
||||||
<span class='co'># prettify the plot using some additional functions:</span>
|
<span class='co'># prettify the plot using some additional functions:</span>
|
||||||
@ -282,17 +282,17 @@
|
|||||||
|
|
||||||
<span class='co'># or better yet, simplify this using the wrapper function - a single command:</span>
|
<span class='co'># or better yet, simplify this using the wrapper function - a single command:</span>
|
||||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>amox</span>, <span class='no'>nitr</span>, <span class='no'>fosf</span>, <span class='no'>trim</span>, <span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>amox</span>, <span class='no'>nitr</span>, <span class='no'>fosf</span>, <span class='no'>trim</span>, <span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
||||||
<span class='fu'>ggplot_rsi</span>()
|
<span class='fu'>ggplot_rsi</span>()
|
||||||
|
|
||||||
<span class='co'># get only portions and no counts:</span>
|
<span class='co'># get only portions and no counts:</span>
|
||||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>amox</span>, <span class='no'>nitr</span>, <span class='no'>fosf</span>, <span class='no'>trim</span>, <span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>amox</span>, <span class='no'>nitr</span>, <span class='no'>fosf</span>, <span class='no'>trim</span>, <span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
||||||
<span class='fu'>ggplot_rsi</span>(<span class='kw'>fun</span> <span class='kw'>=</span> <span class='no'>portion_df</span>)
|
<span class='fu'>ggplot_rsi</span>(<span class='kw'>fun</span> <span class='kw'>=</span> <span class='no'>portion_df</span>)
|
||||||
|
|
||||||
<span class='co'># add other ggplot2 parameters as you like:</span>
|
<span class='co'># add other ggplot2 parameters as you like:</span>
|
||||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>amox</span>, <span class='no'>nitr</span>, <span class='no'>fosf</span>, <span class='no'>trim</span>, <span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>amox</span>, <span class='no'>nitr</span>, <span class='no'>fosf</span>, <span class='no'>trim</span>, <span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
||||||
<span class='fu'>ggplot_rsi</span>(<span class='kw'>width</span> <span class='kw'>=</span> <span class='fl'>0.5</span>,
|
<span class='fu'>ggplot_rsi</span>(<span class='kw'>width</span> <span class='kw'>=</span> <span class='fl'>0.5</span>,
|
||||||
<span class='kw'>colour</span> <span class='kw'>=</span> <span class='st'>"black"</span>,
|
<span class='kw'>colour</span> <span class='kw'>=</span> <span class='st'>"black"</span>,
|
||||||
<span class='kw'>size</span> <span class='kw'>=</span> <span class='fl'>1</span>,
|
<span class='kw'>size</span> <span class='kw'>=</span> <span class='fl'>1</span>,
|
||||||
@ -301,25 +301,25 @@
|
|||||||
|
|
||||||
<span class='co'># resistance of ciprofloxacine per age group</span>
|
<span class='co'># resistance of ciprofloxacine per age group</span>
|
||||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/mutate'>mutate</a></span>(<span class='kw'>first_isolate</span> <span class='kw'>=</span> <span class='fu'>first_isolate</span>(<span class='no'>.</span>)) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>first_isolate</span> <span class='kw'>=</span> <span class='fu'><a href='first_isolate.html'>first_isolate</a></span>(<span class='no'>.</span>)) <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>,
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>,
|
||||||
<span class='no'>mo</span> <span class='kw'>==</span> <span class='fu'>as.mo</span>(<span class='st'>"E. coli"</span>)) <span class='kw'>%>%</span>
|
<span class='no'>mo</span> <span class='kw'>==</span> <span class='fu'><a href='as.mo.html'>as.mo</a></span>(<span class='st'>"E. coli"</span>)) <span class='kw'>%>%</span>
|
||||||
<span class='co'># `age_group` is also a function of this package:</span>
|
<span class='co'># `age_group` is also a function of this package:</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='kw'>age_group</span> <span class='kw'>=</span> <span class='fu'>age_groups</span>(<span class='no'>age</span>)) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='kw'>age_group</span> <span class='kw'>=</span> <span class='fu'><a href='age_groups.html'>age_groups</a></span>(<span class='no'>age</span>)) <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>age_group</span>,
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>age_group</span>,
|
||||||
<span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
<span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
||||||
<span class='fu'>ggplot_rsi</span>(<span class='kw'>x</span> <span class='kw'>=</span> <span class='st'>"age_group"</span>)
|
<span class='fu'>ggplot_rsi</span>(<span class='kw'>x</span> <span class='kw'>=</span> <span class='st'>"age_group"</span>)
|
||||||
<span class='co'># }</span><span class='co'># NOT RUN {</span>
|
<span class='co'># }</span><span class='co'># NOT RUN {</span>
|
||||||
<span class='co'># for colourblind mode, use divergent colours from the viridis package:</span>
|
<span class='co'># for colourblind mode, use divergent colours from the viridis package:</span>
|
||||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>amox</span>, <span class='no'>nitr</span>, <span class='no'>fosf</span>, <span class='no'>trim</span>, <span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>amox</span>, <span class='no'>nitr</span>, <span class='no'>fosf</span>, <span class='no'>trim</span>, <span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
||||||
<span class='fu'>ggplot_rsi</span>() + <span class='fu'><a href='https://ggplot2.tidyverse.org/reference/scale_viridis.html'>scale_fill_viridis_d</a></span>()
|
<span class='fu'>ggplot_rsi</span>() + <span class='fu'><a href='https://ggplot2.tidyverse.org/reference/scale_viridis.html'>scale_fill_viridis_d</a></span>()
|
||||||
|
|
||||||
|
|
||||||
<span class='co'># it also supports groups (don't forget to use the group var on `x` or `facet`):</span>
|
<span class='co'># it also supports groups (don't forget to use the group var on `x` or `facet`):</span>
|
||||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>hospital_id</span>, <span class='no'>amox</span>, <span class='no'>nitr</span>, <span class='no'>fosf</span>, <span class='no'>trim</span>, <span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>hospital_id</span>, <span class='no'>amox</span>, <span class='no'>nitr</span>, <span class='no'>fosf</span>, <span class='no'>trim</span>, <span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
||||||
<span class='fu'>ggplot_rsi</span>(<span class='kw'>x</span> <span class='kw'>=</span> <span class='no'>hospital_id</span>,
|
<span class='fu'>ggplot_rsi</span>(<span class='kw'>x</span> <span class='kw'>=</span> <span class='no'>hospital_id</span>,
|
||||||
<span class='kw'>facet</span> <span class='kw'>=</span> <span class='no'>Antibiotic</span>,
|
<span class='kw'>facet</span> <span class='kw'>=</span> <span class='no'>Antibiotic</span>,
|
||||||
<span class='kw'>nrow</span> <span class='kw'>=</span> <span class='fl'>1</span>) +
|
<span class='kw'>nrow</span> <span class='kw'>=</span> <span class='fl'>1</span>) +
|
||||||
@ -329,22 +329,22 @@
|
|||||||
<span class='co'># genuine analysis: check 2 most prevalent microorganisms</span>
|
<span class='co'># genuine analysis: check 2 most prevalent microorganisms</span>
|
||||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||||
<span class='co'># create new bacterial ID's, with all CoNS under the same group (Becker et al.)</span>
|
<span class='co'># create new bacterial ID's, with all CoNS under the same group (Becker et al.)</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/mutate'>mutate</a></span>(<span class='kw'>mo</span> <span class='kw'>=</span> <span class='fu'>as.mo</span>(<span class='no'>mo</span>, <span class='kw'>Becker</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>mo</span> <span class='kw'>=</span> <span class='fu'><a href='as.mo.html'>as.mo</a></span>(<span class='no'>mo</span>, <span class='kw'>Becker</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)) <span class='kw'>%>%</span>
|
||||||
<span class='co'># filter on top three bacterial ID's</span>
|
<span class='co'># filter on top three bacterial ID's</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>mo</span> <span class='kw'>%in%</span> <span class='fu'>top_freq</span>(<span class='fu'>freq</span>(<span class='no'>.</span>$<span class='no'>mo</span>), <span class='fl'>3</span>)) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>mo</span> <span class='kw'>%in%</span> <span class='fu'><a href='freq.html'>top_freq</a></span>(<span class='fu'><a href='freq.html'>freq</a></span>(<span class='no'>.</span>$<span class='no'>mo</span>), <span class='fl'>3</span>)) <span class='kw'>%>%</span>
|
||||||
<span class='co'># determine first isolates</span>
|
<span class='co'># determine first isolates</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/mutate'>mutate</a></span>(<span class='kw'>first_isolate</span> <span class='kw'>=</span> <span class='fu'>first_isolate</span>(<span class='no'>.</span>,
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>first_isolate</span> <span class='kw'>=</span> <span class='fu'><a href='first_isolate.html'>first_isolate</a></span>(<span class='no'>.</span>,
|
||||||
<span class='kw'>col_date</span> <span class='kw'>=</span> <span class='st'>"date"</span>,
|
<span class='kw'>col_date</span> <span class='kw'>=</span> <span class='st'>"date"</span>,
|
||||||
<span class='kw'>col_patient_id</span> <span class='kw'>=</span> <span class='st'>"patient_id"</span>,
|
<span class='kw'>col_patient_id</span> <span class='kw'>=</span> <span class='st'>"patient_id"</span>,
|
||||||
<span class='kw'>col_mo</span> <span class='kw'>=</span> <span class='st'>"mo"</span>)) <span class='kw'>%>%</span>
|
<span class='kw'>col_mo</span> <span class='kw'>=</span> <span class='st'>"mo"</span>)) <span class='kw'>%>%</span>
|
||||||
<span class='co'># filter on first isolates</span>
|
<span class='co'># filter on first isolates</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>) <span class='kw'>%>%</span>
|
||||||
<span class='co'># get short MO names (like "E. coli")</span>
|
<span class='co'># get short MO names (like "E. coli")</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/mutate'>mutate</a></span>(<span class='kw'>mo</span> <span class='kw'>=</span> <span class='fu'>mo_shortname</span>(<span class='no'>mo</span>, <span class='kw'>Becker</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>mo</span> <span class='kw'>=</span> <span class='fu'><a href='mo_property.html'>mo_shortname</a></span>(<span class='no'>mo</span>, <span class='kw'>Becker</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)) <span class='kw'>%>%</span>
|
||||||
<span class='co'># select this short name and some antiseptic drugs</span>
|
<span class='co'># select this short name and some antiseptic drugs</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>mo</span>, <span class='no'>cfur</span>, <span class='no'>gent</span>, <span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>mo</span>, <span class='no'>cfur</span>, <span class='no'>gent</span>, <span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
||||||
<span class='co'># group by MO</span>
|
<span class='co'># group by MO</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='no'>mo</span>) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='no'>mo</span>) <span class='kw'>%>%</span>
|
||||||
<span class='co'># plot the thing, putting MOs on the facet</span>
|
<span class='co'># plot the thing, putting MOs on the facet</span>
|
||||||
<span class='fu'>ggplot_rsi</span>(<span class='kw'>x</span> <span class='kw'>=</span> <span class='no'>Antibiotic</span>,
|
<span class='fu'>ggplot_rsi</span>(<span class='kw'>x</span> <span class='kw'>=</span> <span class='no'>Antibiotic</span>,
|
||||||
<span class='kw'>facet</span> <span class='kw'>=</span> <span class='no'>mo</span>,
|
<span class='kw'>facet</span> <span class='kw'>=</span> <span class='no'>mo</span>,
|
||||||
|
@ -163,7 +163,7 @@
|
|||||||
|
|
||||||
<div class="ref-description">
|
<div class="ref-description">
|
||||||
|
|
||||||
<p>Join the dataset <code>microorganisms</code> easily to an existing table or character vector.</p>
|
<p>Join the dataset <code><a href='microorganisms.html'>microorganisms</a></code> easily to an existing table or character vector.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -188,7 +188,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>by</th>
|
<th>by</th>
|
||||||
<td><p>a variable to join by - if left empty will search for a column with class <code>mo</code> (created with <code>as.mo</code>) or will be <code>"mo"</code> if that column name exists in <code>x</code>, could otherwise be a column name of <code>x</code> with values that exist in <code>microorganisms$mo</code> (like <code>by = "bacteria_id"</code>), or another column in <code>microorganisms</code> (but then it should be named, like <code>by = c("my_genus_species" = "fullname")</code>)</p></td>
|
<td><p>a variable to join by - if left empty will search for a column with class <code>mo</code> (created with <code><a href='as.mo.html'>as.mo</a></code>) or will be <code>"mo"</code> if that column name exists in <code>x</code>, could otherwise be a column name of <code>x</code> with values that exist in <code>microorganisms$mo</code> (like <code>by = "bacteria_id"</code>), or another column in <code><a href='microorganisms.html'>microorganisms</a></code> (but then it should be named, like <code>by = c("my_genus_species" = "fullname")</code>)</p></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>suffix</th>
|
<th>suffix</th>
|
||||||
@ -207,7 +207,7 @@
|
|||||||
|
|
||||||
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
||||||
<pre class="examples"><span class='co'># NOT RUN {</span>
|
<pre class="examples"><span class='co'># NOT RUN {</span>
|
||||||
<span class='fu'>left_join_microorganisms</span>(<span class='fu'>as.mo</span>(<span class='st'>"K. pneumoniae"</span>))
|
<span class='fu'>left_join_microorganisms</span>(<span class='fu'><a href='as.mo.html'>as.mo</a></span>(<span class='st'>"K. pneumoniae"</span>))
|
||||||
<span class='fu'>left_join_microorganisms</span>(<span class='st'>"B_KLBSL_PNE"</span>)
|
<span class='fu'>left_join_microorganisms</span>(<span class='st'>"B_KLBSL_PNE"</span>)
|
||||||
|
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
|
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
|
||||||
@ -216,7 +216,7 @@
|
|||||||
<span class='no'>df</span> <span class='kw'><-</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/data.frame'>data.frame</a></span>(<span class='kw'>date</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/seq'>seq</a></span>(<span class='kw'>from</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/as.Date'>as.Date</a></span>(<span class='st'>"2018-01-01"</span>),
|
<span class='no'>df</span> <span class='kw'><-</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/data.frame'>data.frame</a></span>(<span class='kw'>date</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/seq'>seq</a></span>(<span class='kw'>from</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/as.Date'>as.Date</a></span>(<span class='st'>"2018-01-01"</span>),
|
||||||
<span class='kw'>to</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/as.Date'>as.Date</a></span>(<span class='st'>"2018-01-07"</span>),
|
<span class='kw'>to</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/as.Date'>as.Date</a></span>(<span class='st'>"2018-01-07"</span>),
|
||||||
<span class='kw'>by</span> <span class='kw'>=</span> <span class='fl'>1</span>),
|
<span class='kw'>by</span> <span class='kw'>=</span> <span class='fl'>1</span>),
|
||||||
<span class='kw'>bacteria</span> <span class='kw'>=</span> <span class='fu'>as.mo</span>(<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='st'>"S. aureus"</span>, <span class='st'>"MRSA"</span>, <span class='st'>"MSSA"</span>, <span class='st'>"STAAUR"</span>,
|
<span class='kw'>bacteria</span> <span class='kw'>=</span> <span class='fu'><a href='as.mo.html'>as.mo</a></span>(<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='st'>"S. aureus"</span>, <span class='st'>"MRSA"</span>, <span class='st'>"MSSA"</span>, <span class='st'>"STAAUR"</span>,
|
||||||
<span class='st'>"E. coli"</span>, <span class='st'>"E. coli"</span>, <span class='st'>"E. coli"</span>)),
|
<span class='st'>"E. coli"</span>, <span class='st'>"E. coli"</span>, <span class='st'>"E. coli"</span>)),
|
||||||
<span class='kw'>stringsAsFactors</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)
|
<span class='kw'>stringsAsFactors</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/colnames'>colnames</a></span>(<span class='no'>df</span>)
|
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/colnames'>colnames</a></span>(<span class='no'>df</span>)
|
||||||
|
@ -163,7 +163,7 @@
|
|||||||
|
|
||||||
<div class="ref-description">
|
<div class="ref-description">
|
||||||
|
|
||||||
<p>These function can be used to determine first isolates (see <code>first_isolate</code>). Using key antibiotics to determine first isolates is more reliable than without key antibiotics. These selected isolates will then be called first <em>weighted</em> isolates.</p>
|
<p>These function can be used to determine first isolates (see <code><a href='first_isolate.html'>first_isolate</a></code>). Using key antibiotics to determine first isolates is more reliable than without key antibiotics. These selected isolates will then be called first <em>weighted</em> isolates.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -187,7 +187,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>col_mo</th>
|
<th>col_mo</th>
|
||||||
<td><p>column name of the unique IDs of the microorganisms (see <code>mo</code>), defaults to the first column of class <code>mo</code>. Values will be coerced using <code>as.mo</code>.</p></td>
|
<td><p>column name of the unique IDs of the microorganisms (see <code><a href='as.mo.html'>mo</a></code>), defaults to the first column of class <code>mo</code>. Values will be coerced using <code><a href='as.mo.html'>as.mo</a></code>.</p></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>universal_1, universal_2, universal_3, universal_4, universal_5, universal_6</th>
|
<th>universal_1, universal_2, universal_3, universal_4, universal_5, universal_6</th>
|
||||||
@ -233,7 +233,7 @@
|
|||||||
|
|
||||||
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
|
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
|
||||||
|
|
||||||
<p>The function <code>key_antibiotics</code> returns a character vector with 12 antibiotic results for every isolate. These isolates can then be compared using <code>key_antibiotics_equal</code>, to check if two isolates have generally the same antibiogram. Missing and invalid values are replaced with a dot (<code>"."</code>). The <code>first_isolate</code> function only uses this function on the same microbial species from the same patient. Using this, an MRSA will be included after a susceptible <em>S. aureus</em> (MSSA) found within the same episode (see <code>episode</code> parameter of <code>first_isolate</code>). Without key antibiotic comparison it wouldn't.</p>
|
<p>The function <code>key_antibiotics</code> returns a character vector with 12 antibiotic results for every isolate. These isolates can then be compared using <code>key_antibiotics_equal</code>, to check if two isolates have generally the same antibiogram. Missing and invalid values are replaced with a dot (<code>"."</code>). The <code><a href='first_isolate.html'>first_isolate</a></code> function only uses this function on the same microbial species from the same patient. Using this, an MRSA will be included after a susceptible <em>S. aureus</em> (MSSA) found within the same episode (see <code>episode</code> parameter of <code><a href='first_isolate.html'>first_isolate</a></code>). Without key antibiotic comparison it wouldn't.</p>
|
||||||
<p>At default, the antibiotics that are used for <strong>Gram positive bacteria</strong> are (colum names): <br />
|
<p>At default, the antibiotics that are used for <strong>Gram positive bacteria</strong> are (colum names): <br />
|
||||||
<code>"amox"</code>, <code>"amcl"</code>, <code>"cfur"</code>, <code>"pita"</code>, <code>"cipr"</code>, <code>"trsu"</code> (until here is universal), <code>"vanc"</code>, <code>"teic"</code>, <code>"tetr"</code>, <code>"eryt"</code>, <code>"oxac"</code>, <code>"rifa"</code>.</p>
|
<code>"amox"</code>, <code>"amcl"</code>, <code>"cfur"</code>, <code>"pita"</code>, <code>"cipr"</code>, <code>"trsu"</code> (until here is universal), <code>"vanc"</code>, <code>"teic"</code>, <code>"tetr"</code>, <code>"eryt"</code>, <code>"oxac"</code>, <code>"rifa"</code>.</p>
|
||||||
<p>At default, the antibiotics that are used for <strong>Gram negative bacteria</strong> are (colum names): <br />
|
<p>At default, the antibiotics that are used for <strong>Gram negative bacteria</strong> are (colum names): <br />
|
||||||
@ -251,7 +251,7 @@
|
|||||||
|
|
||||||
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
||||||
|
|
||||||
<div class='dont-index'><p><code>first_isolate</code></p></div>
|
<div class='dont-index'><p><code><a href='first_isolate.html'>first_isolate</a></code></p></div>
|
||||||
|
|
||||||
|
|
||||||
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
||||||
@ -261,12 +261,12 @@
|
|||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
|
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
|
||||||
<span class='co'># set key antibiotics to a new variable</span>
|
<span class='co'># set key antibiotics to a new variable</span>
|
||||||
<span class='no'>my_patients</span> <span class='kw'><-</span> <span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
<span class='no'>my_patients</span> <span class='kw'><-</span> <span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/mutate'>mutate</a></span>(<span class='kw'>keyab</span> <span class='kw'>=</span> <span class='fu'>key_antibiotics</span>(<span class='no'>.</span>)) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>keyab</span> <span class='kw'>=</span> <span class='fu'>key_antibiotics</span>(<span class='no'>.</span>)) <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/mutate'>mutate</a></span>(
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(
|
||||||
<span class='co'># now calculate first isolates</span>
|
<span class='co'># now calculate first isolates</span>
|
||||||
<span class='kw'>first_regular</span> <span class='kw'>=</span> <span class='fu'>first_isolate</span>(<span class='no'>.</span>, <span class='kw'>col_keyantibiotics</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>),
|
<span class='kw'>first_regular</span> <span class='kw'>=</span> <span class='fu'><a href='first_isolate.html'>first_isolate</a></span>(<span class='no'>.</span>, <span class='kw'>col_keyantibiotics</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>),
|
||||||
<span class='co'># and first WEIGHTED isolates</span>
|
<span class='co'># and first WEIGHTED isolates</span>
|
||||||
<span class='kw'>first_weighted</span> <span class='kw'>=</span> <span class='fu'>first_isolate</span>(<span class='no'>.</span>, <span class='kw'>col_keyantibiotics</span> <span class='kw'>=</span> <span class='st'>"keyab"</span>)
|
<span class='kw'>first_weighted</span> <span class='kw'>=</span> <span class='fu'><a href='first_isolate.html'>first_isolate</a></span>(<span class='no'>.</span>, <span class='kw'>col_keyantibiotics</span> <span class='kw'>=</span> <span class='st'>"keyab"</span>)
|
||||||
)
|
)
|
||||||
|
|
||||||
<span class='co'># Check the difference, in this data set it results in 7% more isolates:</span>
|
<span class='co'># Check the difference, in this data set it results in 7% more isolates:</span>
|
||||||
|
@ -193,7 +193,7 @@
|
|||||||
|
|
||||||
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
||||||
|
|
||||||
<div class='dont-index'><p><code>skewness</code></p></div>
|
<div class='dont-index'><p><code><a href='skewness.html'>skewness</a></code></p></div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -228,9 +228,9 @@
|
|||||||
<span class='co'># get frequencies of bacteria whose name start with 'Ent' or 'ent'</span>
|
<span class='co'># get frequencies of bacteria whose name start with 'Ent' or 'ent'</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
|
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
|
||||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'>left_join_microorganisms</span>() <span class='kw'>%>%</span>
|
<span class='fu'><a href='join.html'>left_join_microorganisms</a></span>() <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>genus</span> <span class='kw'>%like%</span> <span class='st'>'^ent'</span>) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>genus</span> <span class='kw'>%like%</span> <span class='st'>'^ent'</span>) <span class='kw'>%>%</span>
|
||||||
<span class='fu'>freq</span>(<span class='no'>genus</span>, <span class='no'>species</span>)
|
<span class='fu'><a href='freq.html'>freq</a></span>(<span class='no'>genus</span>, <span class='no'>species</span>)
|
||||||
<span class='co'># }</span></pre>
|
<span class='co'># }</span></pre>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
|
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
|
||||||
|
@ -203,7 +203,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>col_mo</th>
|
<th>col_mo</th>
|
||||||
<td><p>column name of the unique IDs of the microorganisms (see <code>mo</code>), defaults to the first column of class <code>mo</code>. Values will be coerced using <code>as.mo</code>.</p></td>
|
<td><p>column name of the unique IDs of the microorganisms (see <code><a href='as.mo.html'>mo</a></code>), defaults to the first column of class <code>mo</code>. Values will be coerced using <code><a href='as.mo.html'>as.mo</a></code>.</p></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>info</th>
|
<th>info</th>
|
||||||
@ -537,7 +537,7 @@
|
|||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
|
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
|
||||||
|
|
||||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/mutate'>mutate</a></span>(<span class='kw'>EUCAST</span> <span class='kw'>=</span> <span class='fu'>mdro</span>(<span class='no'>.</span>),
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>EUCAST</span> <span class='kw'>=</span> <span class='fu'>mdro</span>(<span class='no'>.</span>),
|
||||||
<span class='kw'>BRMO</span> <span class='kw'>=</span> <span class='fu'>brmo</span>(<span class='no'>.</span>))
|
<span class='kw'>BRMO</span> <span class='kw'>=</span> <span class='fu'>brmo</span>(<span class='no'>.</span>))
|
||||||
<span class='co'># }</span></pre>
|
<span class='co'># }</span></pre>
|
||||||
</div>
|
</div>
|
||||||
|
@ -163,7 +163,7 @@
|
|||||||
|
|
||||||
<div class="ref-description">
|
<div class="ref-description">
|
||||||
|
|
||||||
<p>A data set containing all bacteria codes of Certe MMB. These codes can be joined to data with an ID from <code>microorganisms$mo</code> (using <code>left_join_microorganisms</code>). GLIMS codes can also be translated to valid <code>MO</code>s with <code>guess_mo</code>.</p>
|
<p>A data set containing all bacteria codes of Certe MMB. These codes can be joined to data with an ID from <code><a href='microorganisms.html'>microorganisms</a>$mo</code> (using <code><a href='join.html'>left_join_microorganisms</a></code>). GLIMS codes can also be translated to valid <code>MO</code>s with <code><a href='as.mo.html'>guess_mo</a></code>.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -173,12 +173,12 @@
|
|||||||
|
|
||||||
<p>A <code><a href='https://www.rdocumentation.org/packages/base/topics/data.frame'>data.frame</a></code> with 2,665 observations and 2 variables:</p><dl class='dl-horizontal'>
|
<p>A <code><a href='https://www.rdocumentation.org/packages/base/topics/data.frame'>data.frame</a></code> with 2,665 observations and 2 variables:</p><dl class='dl-horizontal'>
|
||||||
<dt><code>certe</code></dt><dd><p>Code of microorganism according to Certe MMB</p></dd>
|
<dt><code>certe</code></dt><dd><p>Code of microorganism according to Certe MMB</p></dd>
|
||||||
<dt><code>mo</code></dt><dd><p>Code of microorganism in <code>microorganisms</code></p></dd>
|
<dt><code>mo</code></dt><dd><p>Code of microorganism in <code><a href='microorganisms.html'>microorganisms</a></code></p></dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
||||||
|
|
||||||
<div class='dont-index'><p><code>as.mo</code> <code>microorganisms</code></p></div>
|
<div class='dont-index'><p><code><a href='as.mo.html'>as.mo</a></code> <code><a href='microorganisms.html'>microorganisms</a></code></p></div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -163,7 +163,7 @@
|
|||||||
|
|
||||||
<div class="ref-description">
|
<div class="ref-description">
|
||||||
|
|
||||||
<p>A data set containing the complete microbial taxonomy of the kingdoms Bacteria, Fungi and Protozoa. MO codes can be looked up using <code>as.mo</code>.</p>
|
<p>A data set containing the complete microbial taxonomy of the kingdoms Bacteria, Fungi and Protozoa. MO codes can be looked up using <code><a href='as.mo.html'>as.mo</a></code>.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -185,7 +185,7 @@
|
|||||||
<dt><code>subkingdom</code></dt><dd><p>Taxonomic subkingdom of the microorganism as found in ITIS, see Source</p></dd>
|
<dt><code>subkingdom</code></dt><dd><p>Taxonomic subkingdom of the microorganism as found in ITIS, see Source</p></dd>
|
||||||
<dt><code>kingdom</code></dt><dd><p>Taxonomic kingdom of the microorganism as found in ITIS, see Source</p></dd>
|
<dt><code>kingdom</code></dt><dd><p>Taxonomic kingdom of the microorganism as found in ITIS, see Source</p></dd>
|
||||||
<dt><code>gramstain</code></dt><dd><p>Gram of microorganism, like <code>"Gram negative"</code></p></dd>
|
<dt><code>gramstain</code></dt><dd><p>Gram of microorganism, like <code>"Gram negative"</code></p></dd>
|
||||||
<dt><code>prevalence</code></dt><dd><p>An integer based on estimated prevalence of the microorganism in humans. Used internally by <code>as.mo</code>, otherwise quite meaningless. It has a value of 25 for manually added items and a value of 1000 for all unprevalent microorganisms whose genus was somewhere in the top 250 (with another species).</p></dd>
|
<dt><code>prevalence</code></dt><dd><p>An integer based on estimated prevalence of the microorganism in humans. Used internally by <code><a href='as.mo.html'>as.mo</a></code>, otherwise quite meaningless. It has a value of 25 for manually added items and a value of 1000 for all unprevalent microorganisms whose genus was somewhere in the top 250 (with another species).</p></dd>
|
||||||
<dt><code>ref</code></dt><dd><p>Author(s) and year of concerning publication as found in ITIS, see Source</p></dd>
|
<dt><code>ref</code></dt><dd><p>Author(s) and year of concerning publication as found in ITIS, see Source</p></dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
@ -203,7 +203,7 @@ This package contains the <strong>complete microbial taxonomic data</strong> (wi
|
|||||||
|
|
||||||
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
||||||
|
|
||||||
<div class='dont-index'><p><code>as.mo</code> <code>mo_property</code> <code>microorganisms.umcg</code></p></div>
|
<div class='dont-index'><p><code><a href='as.mo.html'>as.mo</a></code> <code><a href='mo_property.html'>mo_property</a></code> <code><a href='microorganisms.umcg.html'>microorganisms.umcg</a></code></p></div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -163,7 +163,7 @@
|
|||||||
|
|
||||||
<div class="ref-description">
|
<div class="ref-description">
|
||||||
|
|
||||||
<p>A data set containing old (previously valid or accepted) taxonomic names according to ITIS. This data set is used internally by <code>as.mo</code>.</p>
|
<p>A data set containing old (previously valid or accepted) taxonomic names according to ITIS. This data set is used internally by <code><a href='as.mo.html'>as.mo</a></code>.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -192,7 +192,7 @@ This package contains the <strong>complete microbial taxonomic data</strong> (wi
|
|||||||
|
|
||||||
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
||||||
|
|
||||||
<div class='dont-index'><p><code>as.mo</code> <code>mo_property</code> <code>microorganisms</code></p></div>
|
<div class='dont-index'><p><code><a href='as.mo.html'>as.mo</a></code> <code><a href='mo_property.html'>mo_property</a></code> <code><a href='microorganisms.html'>microorganisms</a></code></p></div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -163,7 +163,7 @@
|
|||||||
|
|
||||||
<div class="ref-description">
|
<div class="ref-description">
|
||||||
|
|
||||||
<p>A data set containing all bacteria codes of UMCG MMB. These codes can be joined to data with an ID from <code>microorganisms$mo</code> (using <code>left_join_microorganisms</code>). GLIMS codes can also be translated to valid <code>MO</code>s with <code>guess_mo</code>.</p>
|
<p>A data set containing all bacteria codes of UMCG MMB. These codes can be joined to data with an ID from <code><a href='microorganisms.html'>microorganisms</a>$mo</code> (using <code><a href='join.html'>left_join_microorganisms</a></code>). GLIMS codes can also be translated to valid <code>MO</code>s with <code><a href='as.mo.html'>guess_mo</a></code>.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -178,7 +178,7 @@
|
|||||||
|
|
||||||
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
||||||
|
|
||||||
<div class='dont-index'><p><code>as.mo</code> <code>microorganisms.certe</code> <code>microorganisms</code></p></div>
|
<div class='dont-index'><p><code><a href='as.mo.html'>as.mo</a></code> <code><a href='microorganisms.certe.html'>microorganisms.certe</a></code> <code><a href='microorganisms.html'>microorganisms</a></code></p></div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -163,7 +163,7 @@
|
|||||||
|
|
||||||
<div class="ref-description">
|
<div class="ref-description">
|
||||||
|
|
||||||
<p>Returns a vector of all failed attempts to coerce values to a valid MO code with <code>as.mo</code>.</p>
|
<p>Returns a vector of all failed attempts to coerce values to a valid MO code with <code><a href='as.mo.html'>as.mo</a></code>.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -171,7 +171,7 @@
|
|||||||
|
|
||||||
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
||||||
|
|
||||||
<div class='dont-index'><p><code>as.mo</code></p></div>
|
<div class='dont-index'><p><code><a href='as.mo.html'>as.mo</a></code></p></div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -163,19 +163,19 @@
|
|||||||
|
|
||||||
<div class="ref-description">
|
<div class="ref-description">
|
||||||
|
|
||||||
<p>Use these functions to return a specific property of a microorganism from the <code>microorganisms</code> data set. All input values will be evaluated internally with <code>as.mo</code>.</p>
|
<p>Use these functions to return a specific property of a microorganism from the <code><a href='microorganisms.html'>microorganisms</a></code> data set. All input values will be evaluated internally with <code><a href='as.mo.html'>as.mo</a></code>.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<pre class="usage"><span class='fu'>mo_fullname</span>(<span class='no'>x</span>, <span class='kw'>language</span> <span class='kw'>=</span> <span class='fu'>get_locale</span>(), <span class='no'>...</span>)
|
<pre class="usage"><span class='fu'>mo_fullname</span>(<span class='no'>x</span>, <span class='kw'>language</span> <span class='kw'>=</span> <span class='fu'><a href='get_locale.html'>get_locale</a></span>(), <span class='no'>...</span>)
|
||||||
|
|
||||||
<span class='fu'>mo_shortname</span>(<span class='no'>x</span>, <span class='kw'>language</span> <span class='kw'>=</span> <span class='fu'>get_locale</span>(), <span class='no'>...</span>)
|
<span class='fu'>mo_shortname</span>(<span class='no'>x</span>, <span class='kw'>language</span> <span class='kw'>=</span> <span class='fu'><a href='get_locale.html'>get_locale</a></span>(), <span class='no'>...</span>)
|
||||||
|
|
||||||
<span class='fu'>mo_subspecies</span>(<span class='no'>x</span>, <span class='kw'>language</span> <span class='kw'>=</span> <span class='fu'>get_locale</span>(), <span class='no'>...</span>)
|
<span class='fu'>mo_subspecies</span>(<span class='no'>x</span>, <span class='kw'>language</span> <span class='kw'>=</span> <span class='fu'><a href='get_locale.html'>get_locale</a></span>(), <span class='no'>...</span>)
|
||||||
|
|
||||||
<span class='fu'>mo_species</span>(<span class='no'>x</span>, <span class='kw'>language</span> <span class='kw'>=</span> <span class='fu'>get_locale</span>(), <span class='no'>...</span>)
|
<span class='fu'>mo_species</span>(<span class='no'>x</span>, <span class='kw'>language</span> <span class='kw'>=</span> <span class='fu'><a href='get_locale.html'>get_locale</a></span>(), <span class='no'>...</span>)
|
||||||
|
|
||||||
<span class='fu'>mo_genus</span>(<span class='no'>x</span>, <span class='kw'>language</span> <span class='kw'>=</span> <span class='fu'>get_locale</span>(), <span class='no'>...</span>)
|
<span class='fu'>mo_genus</span>(<span class='no'>x</span>, <span class='kw'>language</span> <span class='kw'>=</span> <span class='fu'><a href='get_locale.html'>get_locale</a></span>(), <span class='no'>...</span>)
|
||||||
|
|
||||||
<span class='fu'>mo_family</span>(<span class='no'>x</span>, <span class='no'>...</span>)
|
<span class='fu'>mo_family</span>(<span class='no'>x</span>, <span class='no'>...</span>)
|
||||||
|
|
||||||
@ -189,9 +189,9 @@
|
|||||||
|
|
||||||
<span class='fu'>mo_kingdom</span>(<span class='no'>x</span>, <span class='no'>...</span>)
|
<span class='fu'>mo_kingdom</span>(<span class='no'>x</span>, <span class='no'>...</span>)
|
||||||
|
|
||||||
<span class='fu'>mo_type</span>(<span class='no'>x</span>, <span class='kw'>language</span> <span class='kw'>=</span> <span class='fu'>get_locale</span>(), <span class='no'>...</span>)
|
<span class='fu'>mo_type</span>(<span class='no'>x</span>, <span class='kw'>language</span> <span class='kw'>=</span> <span class='fu'><a href='get_locale.html'>get_locale</a></span>(), <span class='no'>...</span>)
|
||||||
|
|
||||||
<span class='fu'>mo_gramstain</span>(<span class='no'>x</span>, <span class='kw'>language</span> <span class='kw'>=</span> <span class='fu'>get_locale</span>(), <span class='no'>...</span>)
|
<span class='fu'>mo_gramstain</span>(<span class='no'>x</span>, <span class='kw'>language</span> <span class='kw'>=</span> <span class='fu'><a href='get_locale.html'>get_locale</a></span>(), <span class='no'>...</span>)
|
||||||
|
|
||||||
<span class='fu'>mo_TSN</span>(<span class='no'>x</span>, <span class='no'>...</span>)
|
<span class='fu'>mo_TSN</span>(<span class='no'>x</span>, <span class='no'>...</span>)
|
||||||
|
|
||||||
@ -203,26 +203,26 @@
|
|||||||
|
|
||||||
<span class='fu'>mo_taxonomy</span>(<span class='no'>x</span>, <span class='no'>...</span>)
|
<span class='fu'>mo_taxonomy</span>(<span class='no'>x</span>, <span class='no'>...</span>)
|
||||||
|
|
||||||
<span class='fu'>mo_property</span>(<span class='no'>x</span>, <span class='kw'>property</span> <span class='kw'>=</span> <span class='st'>"fullname"</span>, <span class='kw'>language</span> <span class='kw'>=</span> <span class='fu'>get_locale</span>(), <span class='no'>...</span>)</pre>
|
<span class='fu'>mo_property</span>(<span class='no'>x</span>, <span class='kw'>property</span> <span class='kw'>=</span> <span class='st'>"fullname"</span>, <span class='kw'>language</span> <span class='kw'>=</span> <span class='fu'><a href='get_locale.html'>get_locale</a></span>(), <span class='no'>...</span>)</pre>
|
||||||
|
|
||||||
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
|
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
|
||||||
<table class="ref-arguments">
|
<table class="ref-arguments">
|
||||||
<colgroup><col class="name" /><col class="desc" /></colgroup>
|
<colgroup><col class="name" /><col class="desc" /></colgroup>
|
||||||
<tr>
|
<tr>
|
||||||
<th>x</th>
|
<th>x</th>
|
||||||
<td><p>any (vector of) text that can be coerced to a valid microorganism code with <code>as.mo</code></p></td>
|
<td><p>any (vector of) text that can be coerced to a valid microorganism code with <code><a href='as.mo.html'>as.mo</a></code></p></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>language</th>
|
<th>language</th>
|
||||||
<td><p>language of the returned text, defaults to system language (see <code>get_locale</code>) and can also be set with <code><a href='https://www.rdocumentation.org/packages/base/topics/options'>getOption</a>("AMR_locale")</code>. Use <code>language = NULL</code> or <code>language = ""</code> to prevent translation.</p></td>
|
<td><p>language of the returned text, defaults to system language (see <code><a href='get_locale.html'>get_locale</a></code>) and can also be set with <code><a href='https://www.rdocumentation.org/packages/base/topics/options'>getOption</a>("AMR_locale")</code>. Use <code>language = NULL</code> or <code>language = ""</code> to prevent translation.</p></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>...</th>
|
<th>...</th>
|
||||||
<td><p>other parameters passed on to <code>as.mo</code></p></td>
|
<td><p>other parameters passed on to <code><a href='as.mo.html'>as.mo</a></code></p></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>property</th>
|
<th>property</th>
|
||||||
<td><p>one of the column names of one of the <code>microorganisms</code> data set or <code>"shortname"</code></p></td>
|
<td><p>one of the column names of one of the <code><a href='microorganisms.html'>microorganisms</a></code> data set or <code>"shortname"</code></p></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
@ -266,7 +266,7 @@ This package contains the <strong>complete microbial taxonomic data</strong> (wi
|
|||||||
|
|
||||||
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
||||||
|
|
||||||
<div class='dont-index'><p><code>microorganisms</code></p></div>
|
<div class='dont-index'><p><code><a href='microorganisms.html'>microorganisms</a></code></p></div>
|
||||||
|
|
||||||
|
|
||||||
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
||||||
|
@ -163,7 +163,7 @@
|
|||||||
|
|
||||||
<div class="ref-description">
|
<div class="ref-description">
|
||||||
|
|
||||||
<p>Returns a vector of all renamed items of the last coercion to valid MO codes with <code>as.mo</code>.</p>
|
<p>Returns a vector of all renamed items of the last coercion to valid MO codes with <code><a href='as.mo.html'>as.mo</a></code>.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -171,7 +171,7 @@
|
|||||||
|
|
||||||
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
||||||
|
|
||||||
<div class='dont-index'><p><code>as.mo</code></p></div>
|
<div class='dont-index'><p><code><a href='as.mo.html'>as.mo</a></code></p></div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -192,7 +192,7 @@ portion_R and portion_IR can be used to calculate resistance, portion_S and port
|
|||||||
<colgroup><col class="name" /><col class="desc" /></colgroup>
|
<colgroup><col class="name" /><col class="desc" /></colgroup>
|
||||||
<tr>
|
<tr>
|
||||||
<th>...</th>
|
<th>...</th>
|
||||||
<td><p>one or more vectors (or columns) with antibiotic interpretations. They will be transformed internally with <code>as.rsi</code> if needed. Use multiple columns to calculate (the lack of) co-resistance: the probability where one of two drugs have a resistant or susceptible result. See Examples.</p></td>
|
<td><p>one or more vectors (or columns) with antibiotic interpretations. They will be transformed internally with <code><a href='as.rsi.html'>as.rsi</a></code> if needed. Use multiple columns to calculate (the lack of) co-resistance: the probability where one of two drugs have a resistant or susceptible result. See Examples.</p></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>minimum</th>
|
<th>minimum</th>
|
||||||
@ -208,11 +208,11 @@ portion_R and portion_IR can be used to calculate resistance, portion_S and port
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>data</th>
|
<th>data</th>
|
||||||
<td><p>a <code>data.frame</code> containing columns with class <code>rsi</code> (see <code>as.rsi</code>)</p></td>
|
<td><p>a <code>data.frame</code> containing columns with class <code>rsi</code> (see <code><a href='as.rsi.html'>as.rsi</a></code>)</p></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>translate_ab</th>
|
<th>translate_ab</th>
|
||||||
<td><p>a column name of the <code>antibiotics</code> data set to translate the antibiotic abbreviations to, using <code>abname</code>. This can be set with <code><a href='https://www.rdocumentation.org/packages/base/topics/options'>getOption</a>("get_antibiotic_names")</code>.</p></td>
|
<td><p>a column name of the <code><a href='antibiotics.html'>antibiotics</a></code> data set to translate the antibiotic abbreviations to, using <code><a href='abname.html'>abname</a></code>. This can be set with <code><a href='https://www.rdocumentation.org/packages/base/topics/options'>getOption</a>("get_antibiotic_names")</code>.</p></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>combine_IR</th>
|
<th>combine_IR</th>
|
||||||
@ -231,10 +231,10 @@ portion_R and portion_IR can be used to calculate resistance, portion_S and port
|
|||||||
|
|
||||||
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
|
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
|
||||||
|
|
||||||
<p><strong>Remember that you should filter your table to let it contain only first isolates!</strong> Use <code>first_isolate</code> to determine them in your data set.</p>
|
<p><strong>Remember that you should filter your table to let it contain only first isolates!</strong> Use <code><a href='first_isolate.html'>first_isolate</a></code> to determine them in your data set.</p>
|
||||||
<p>These functions are not meant to count isolates, but to calculate the portion of resistance/susceptibility. Use the <code><a href='https://www.rdocumentation.org/packages/dplyr/topics/tally'>count</a></code> functions to count isolates. <em>Low counts can infuence the outcome - these <code>portion</code> functions may camouflage this, since they only return the portion albeit being dependent on the <code>minimum</code> parameter.</em></p>
|
<p>These functions are not meant to count isolates, but to calculate the portion of resistance/susceptibility. Use the <code><a href='count.html'>count</a></code> functions to count isolates. <em>Low counts can infuence the outcome - these <code>portion</code> functions may camouflage this, since they only return the portion albeit being dependent on the <code>minimum</code> parameter.</em></p>
|
||||||
<p><code>portion_df</code> takes any variable from <code>data</code> that has an <code>"rsi"</code> class (created with <code>as.rsi</code>) and calculates the portions R, I and S. The resulting <em>tidy data</em> (see Source) <code>data.frame</code> will have three rows (S/I/R) and a column for each variable with class <code>"rsi"</code>.</p>
|
<p><code>portion_df</code> takes any variable from <code>data</code> that has an <code>"rsi"</code> class (created with <code><a href='as.rsi.html'>as.rsi</a></code>) and calculates the portions R, I and S. The resulting <em>tidy data</em> (see Source) <code>data.frame</code> will have three rows (S/I/R) and a column for each variable with class <code>"rsi"</code>.</p>
|
||||||
<p>The old <code>rsi</code> function is still available for backwards compatibility but is deprecated.
|
<p>The old <code><a href='rsi.html'>rsi</a></code> function is still available for backwards compatibility but is deprecated.
|
||||||
<br /><br />
|
<br /><br />
|
||||||
To calculate the probability (<em>p</em>) of susceptibility of one antibiotic, we use this formula:
|
To calculate the probability (<em>p</em>) of susceptibility of one antibiotic, we use this formula:
|
||||||
<div style="text-align: center"><img src='figures/mono_therapy.png' alt='' /></div>
|
<div style="text-align: center"><img src='figures/mono_therapy.png' alt='' /></div>
|
||||||
@ -250,7 +250,7 @@ portion_R and portion_IR can be used to calculate resistance, portion_S and port
|
|||||||
|
|
||||||
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
||||||
|
|
||||||
<div class='dont-index'><p><code><a href='https://www.rdocumentation.org/packages/dplyr/topics/tally'>count</a>_*</code> to count resistant and susceptible isolates.</p></div>
|
<div class='dont-index'><p><code><a href='count.html'>count</a>_*</code> to count resistant and susceptible isolates.</p></div>
|
||||||
|
|
||||||
|
|
||||||
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
||||||
@ -274,58 +274,58 @@ portion_R and portion_IR can be used to calculate resistance, portion_S and port
|
|||||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span> <span class='fu'>portion_SI</span>(<span class='no'>amox</span>)
|
<span class='no'>septic_patients</span> <span class='kw'>%>%</span> <span class='fu'>portion_SI</span>(<span class='no'>amox</span>)
|
||||||
|
|
||||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/summarise'>summarise</a></span>(<span class='kw'>p</span> <span class='kw'>=</span> <span class='fu'>portion_S</span>(<span class='no'>cipr</span>),
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/summarise.html'>summarise</a></span>(<span class='kw'>p</span> <span class='kw'>=</span> <span class='fu'>portion_S</span>(<span class='no'>cipr</span>),
|
||||||
<span class='kw'>n</span> <span class='kw'>=</span> <span class='fu'>n_rsi</span>(<span class='no'>cipr</span>)) <span class='co'># n_rsi works like n_distinct in dplyr</span>
|
<span class='kw'>n</span> <span class='kw'>=</span> <span class='fu'><a href='count.html'>n_rsi</a></span>(<span class='no'>cipr</span>)) <span class='co'># n_rsi works like n_distinct in dplyr</span>
|
||||||
|
|
||||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/summarise'>summarise</a></span>(<span class='kw'>R</span> <span class='kw'>=</span> <span class='fu'>portion_R</span>(<span class='no'>cipr</span>, <span class='kw'>as_percent</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>),
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/summarise.html'>summarise</a></span>(<span class='kw'>R</span> <span class='kw'>=</span> <span class='fu'>portion_R</span>(<span class='no'>cipr</span>, <span class='kw'>as_percent</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>),
|
||||||
<span class='kw'>I</span> <span class='kw'>=</span> <span class='fu'>portion_I</span>(<span class='no'>cipr</span>, <span class='kw'>as_percent</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>),
|
<span class='kw'>I</span> <span class='kw'>=</span> <span class='fu'>portion_I</span>(<span class='no'>cipr</span>, <span class='kw'>as_percent</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>),
|
||||||
<span class='kw'>S</span> <span class='kw'>=</span> <span class='fu'>portion_S</span>(<span class='no'>cipr</span>, <span class='kw'>as_percent</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>),
|
<span class='kw'>S</span> <span class='kw'>=</span> <span class='fu'>portion_S</span>(<span class='no'>cipr</span>, <span class='kw'>as_percent</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>),
|
||||||
<span class='kw'>n</span> <span class='kw'>=</span> <span class='fu'>n_rsi</span>(<span class='no'>cipr</span>), <span class='co'># works like n_distinct in dplyr</span>
|
<span class='kw'>n</span> <span class='kw'>=</span> <span class='fu'><a href='count.html'>n_rsi</a></span>(<span class='no'>cipr</span>), <span class='co'># works like n_distinct in dplyr</span>
|
||||||
<span class='kw'>total</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/n'>n</a></span>()) <span class='co'># NOT the amount of tested isolates!</span>
|
<span class='kw'>total</span> <span class='kw'>=</span> <span class='fu'><a href='http://dplyr.tidyverse.org/reference/n.html'>n</a></span>()) <span class='co'># NOT the amount of tested isolates!</span>
|
||||||
|
|
||||||
<span class='co'># Calculate co-resistance between amoxicillin/clav acid and gentamicin,</span>
|
<span class='co'># Calculate 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'># so we can see that combination therapy does a lot more than mono therapy:</span>
|
||||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span> <span class='fu'>portion_S</span>(<span class='no'>amcl</span>) <span class='co'># S = 67.1%</span>
|
<span class='no'>septic_patients</span> <span class='kw'>%>%</span> <span class='fu'>portion_S</span>(<span class='no'>amcl</span>) <span class='co'># S = 67.1%</span>
|
||||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span> <span class='fu'>count_all</span>(<span class='no'>amcl</span>) <span class='co'># n = 1576</span>
|
<span class='no'>septic_patients</span> <span class='kw'>%>%</span> <span class='fu'><a href='count.html'>count_all</a></span>(<span class='no'>amcl</span>) <span class='co'># n = 1576</span>
|
||||||
|
|
||||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span> <span class='fu'>portion_S</span>(<span class='no'>gent</span>) <span class='co'># S = 74.0%</span>
|
<span class='no'>septic_patients</span> <span class='kw'>%>%</span> <span class='fu'>portion_S</span>(<span class='no'>gent</span>) <span class='co'># S = 74.0%</span>
|
||||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span> <span class='fu'>count_all</span>(<span class='no'>gent</span>) <span class='co'># n = 1855</span>
|
<span class='no'>septic_patients</span> <span class='kw'>%>%</span> <span class='fu'><a href='count.html'>count_all</a></span>(<span class='no'>gent</span>) <span class='co'># n = 1855</span>
|
||||||
|
|
||||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span> <span class='fu'>portion_S</span>(<span class='no'>amcl</span>, <span class='no'>gent</span>) <span class='co'># S = 92.0%</span>
|
<span class='no'>septic_patients</span> <span class='kw'>%>%</span> <span class='fu'>portion_S</span>(<span class='no'>amcl</span>, <span class='no'>gent</span>) <span class='co'># S = 92.0%</span>
|
||||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span> <span class='fu'>count_all</span>(<span class='no'>amcl</span>, <span class='no'>gent</span>) <span class='co'># n = 1517</span>
|
<span class='no'>septic_patients</span> <span class='kw'>%>%</span> <span class='fu'><a href='count.html'>count_all</a></span>(<span class='no'>amcl</span>, <span class='no'>gent</span>) <span class='co'># n = 1517</span>
|
||||||
|
|
||||||
|
|
||||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/summarise'>summarise</a></span>(<span class='kw'>cipro_p</span> <span class='kw'>=</span> <span class='fu'>portion_S</span>(<span class='no'>cipr</span>, <span class='kw'>as_percent</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>),
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/summarise.html'>summarise</a></span>(<span class='kw'>cipro_p</span> <span class='kw'>=</span> <span class='fu'>portion_S</span>(<span class='no'>cipr</span>, <span class='kw'>as_percent</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>),
|
||||||
<span class='kw'>cipro_n</span> <span class='kw'>=</span> <span class='fu'>count_all</span>(<span class='no'>cipr</span>),
|
<span class='kw'>cipro_n</span> <span class='kw'>=</span> <span class='fu'><a href='count.html'>count_all</a></span>(<span class='no'>cipr</span>),
|
||||||
<span class='kw'>genta_p</span> <span class='kw'>=</span> <span class='fu'>portion_S</span>(<span class='no'>gent</span>, <span class='kw'>as_percent</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>),
|
<span class='kw'>genta_p</span> <span class='kw'>=</span> <span class='fu'>portion_S</span>(<span class='no'>gent</span>, <span class='kw'>as_percent</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>),
|
||||||
<span class='kw'>genta_n</span> <span class='kw'>=</span> <span class='fu'>count_all</span>(<span class='no'>gent</span>),
|
<span class='kw'>genta_n</span> <span class='kw'>=</span> <span class='fu'><a href='count.html'>count_all</a></span>(<span class='no'>gent</span>),
|
||||||
<span class='kw'>combination_p</span> <span class='kw'>=</span> <span class='fu'>portion_S</span>(<span class='no'>cipr</span>, <span class='no'>gent</span>, <span class='kw'>as_percent</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>),
|
<span class='kw'>combination_p</span> <span class='kw'>=</span> <span class='fu'>portion_S</span>(<span class='no'>cipr</span>, <span class='no'>gent</span>, <span class='kw'>as_percent</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>),
|
||||||
<span class='kw'>combination_n</span> <span class='kw'>=</span> <span class='fu'>count_all</span>(<span class='no'>cipr</span>, <span class='no'>gent</span>))
|
<span class='kw'>combination_n</span> <span class='kw'>=</span> <span class='fu'><a href='count.html'>count_all</a></span>(<span class='no'>cipr</span>, <span class='no'>gent</span>))
|
||||||
|
|
||||||
<span class='co'># Get portions S/I/R immediately of all rsi columns</span>
|
<span class='co'># Get portions S/I/R immediately of all rsi columns</span>
|
||||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>amox</span>, <span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>amox</span>, <span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
||||||
<span class='fu'>portion_df</span>(<span class='kw'>translate</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)
|
<span class='fu'>portion_df</span>(<span class='kw'>translate</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)
|
||||||
|
|
||||||
<span class='co'># It also supports grouping variables</span>
|
<span class='co'># It also supports grouping variables</span>
|
||||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>hospital_id</span>, <span class='no'>amox</span>, <span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>hospital_id</span>, <span class='no'>amox</span>, <span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
||||||
<span class='fu'>portion_df</span>(<span class='kw'>translate</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)
|
<span class='fu'>portion_df</span>(<span class='kw'>translate</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)
|
||||||
|
|
||||||
|
|
||||||
<span class='co'># }</span><span class='co'># NOT RUN {</span>
|
<span class='co'># }</span><span class='co'># NOT RUN {</span>
|
||||||
<span class='co'># calculate current empiric combination therapy of Helicobacter gastritis:</span>
|
<span class='co'># calculate current empiric combination therapy of Helicobacter gastritis:</span>
|
||||||
<span class='no'>my_table</span> <span class='kw'>%>%</span>
|
<span class='no'>my_table</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>,
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>,
|
||||||
<span class='no'>genus</span> <span class='kw'>==</span> <span class='st'>"Helicobacter"</span>) <span class='kw'>%>%</span>
|
<span class='no'>genus</span> <span class='kw'>==</span> <span class='st'>"Helicobacter"</span>) <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/summarise'>summarise</a></span>(<span class='kw'>p</span> <span class='kw'>=</span> <span class='fu'>portion_S</span>(<span class='no'>amox</span>, <span class='no'>metr</span>), <span class='co'># amoxicillin with metronidazole</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/summarise.html'>summarise</a></span>(<span class='kw'>p</span> <span class='kw'>=</span> <span class='fu'>portion_S</span>(<span class='no'>amox</span>, <span class='no'>metr</span>), <span class='co'># amoxicillin with metronidazole</span>
|
||||||
<span class='kw'>n</span> <span class='kw'>=</span> <span class='fu'>count_all</span>(<span class='no'>amox</span>, <span class='no'>metr</span>))
|
<span class='kw'>n</span> <span class='kw'>=</span> <span class='fu'><a href='count.html'>count_all</a></span>(<span class='no'>amox</span>, <span class='no'>metr</span>))
|
||||||
<span class='co'># }</span></pre>
|
<span class='co'># }</span></pre>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
|
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
|
||||||
|
@ -163,7 +163,7 @@
|
|||||||
|
|
||||||
<div class="ref-description">
|
<div class="ref-description">
|
||||||
|
|
||||||
<p>This function is only useful for the MMB department of the UMCG. Use this function to <strong>import data by just defining the <code>file</code> parameter</strong>. It will automatically transform birth dates and calculate patients age, translate the column names to English, transform the MO codes with <code>as.mo</code> and transform all antimicrobial columns with <code>as.rsi</code>.</p>
|
<p>This function is only useful for the MMB department of the UMCG. Use this function to <strong>import data by just defining the <code>file</code> parameter</strong>. It will automatically transform birth dates and calculate patients age, translate the column names to English, transform the MO codes with <code><a href='as.mo.html'>as.mo</a></code> and transform all antimicrobial columns with <code><a href='as.rsi.html'>as.rsi</a></code>.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -240,7 +240,7 @@
|
|||||||
|
|
||||||
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
||||||
|
|
||||||
<div class='dont-index'><p>The <code>portion</code> function to calculate resistance, <br /> <code><a href='https://www.rdocumentation.org/packages/stats/topics/lm'>lm</a></code> <code><a href='https://www.rdocumentation.org/packages/stats/topics/glm'>glm</a></code></p></div>
|
<div class='dont-index'><p>The <code><a href='portion.html'>portion</a></code> function to calculate resistance, <br /> <code><a href='https://www.rdocumentation.org/packages/stats/topics/lm'>lm</a></code> <code><a href='https://www.rdocumentation.org/packages/stats/topics/glm'>glm</a></code></p></div>
|
||||||
|
|
||||||
|
|
||||||
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
||||||
@ -252,7 +252,7 @@
|
|||||||
<span class='co'># or use dplyr so you can actually read it:</span>
|
<span class='co'># or use dplyr so you can actually read it:</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
|
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
|
||||||
<span class='no'>tbl</span> <span class='kw'>%>%</span>
|
<span class='no'>tbl</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>,
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>,
|
||||||
<span class='no'>genus</span> <span class='kw'>==</span> <span class='st'>"Haemophilus"</span>) <span class='kw'>%>%</span>
|
<span class='no'>genus</span> <span class='kw'>==</span> <span class='st'>"Haemophilus"</span>) <span class='kw'>%>%</span>
|
||||||
<span class='fu'>resistance_predict</span>(<span class='no'>amcl</span>, <span class='no'>date</span>)
|
<span class='fu'>resistance_predict</span>(<span class='no'>amcl</span>, <span class='no'>date</span>)
|
||||||
<span class='co'># }</span><span class='co'># NOT RUN {</span>
|
<span class='co'># }</span><span class='co'># NOT RUN {</span>
|
||||||
@ -261,11 +261,11 @@
|
|||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
|
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
|
||||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||||
<span class='co'># get bacteria properties like genus and species</span>
|
<span class='co'># get bacteria properties like genus and species</span>
|
||||||
<span class='fu'>left_join_microorganisms</span>(<span class='st'>"mo"</span>) <span class='kw'>%>%</span>
|
<span class='fu'><a href='join.html'>left_join_microorganisms</a></span>(<span class='st'>"mo"</span>) <span class='kw'>%>%</span>
|
||||||
<span class='co'># calculate first isolates</span>
|
<span class='co'># calculate first isolates</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/mutate'>mutate</a></span>(<span class='kw'>first_isolate</span> <span class='kw'>=</span> <span class='fu'>first_isolate</span>(<span class='no'>.</span>)) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>first_isolate</span> <span class='kw'>=</span> <span class='fu'><a href='first_isolate.html'>first_isolate</a></span>(<span class='no'>.</span>)) <span class='kw'>%>%</span>
|
||||||
<span class='co'># filter on first E. coli isolates</span>
|
<span class='co'># filter on first E. coli isolates</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>genus</span> <span class='kw'>==</span> <span class='st'>"Escherichia"</span>,
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>genus</span> <span class='kw'>==</span> <span class='st'>"Escherichia"</span>,
|
||||||
<span class='no'>species</span> <span class='kw'>==</span> <span class='st'>"coli"</span>,
|
<span class='no'>species</span> <span class='kw'>==</span> <span class='st'>"coli"</span>,
|
||||||
<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>) <span class='kw'>%>%</span>
|
<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>) <span class='kw'>%>%</span>
|
||||||
<span class='co'># predict resistance of cefotaxime for next years</span>
|
<span class='co'># predict resistance of cefotaxime for next years</span>
|
||||||
@ -279,7 +279,7 @@
|
|||||||
<span class='kw'>if</span> (!<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>require</a></span>(<span class='no'>ggplot2</span>)) {
|
<span class='kw'>if</span> (!<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>require</a></span>(<span class='no'>ggplot2</span>)) {
|
||||||
|
|
||||||
<span class='no'>data</span> <span class='kw'><-</span> <span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
<span class='no'>data</span> <span class='kw'><-</span> <span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>mo</span> <span class='kw'>==</span> <span class='fu'>as.mo</span>(<span class='st'>"E. coli"</span>)) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>mo</span> <span class='kw'>==</span> <span class='fu'><a href='as.mo.html'>as.mo</a></span>(<span class='st'>"E. coli"</span>)) <span class='kw'>%>%</span>
|
||||||
<span class='fu'>resistance_predict</span>(<span class='kw'>col_ab</span> <span class='kw'>=</span> <span class='st'>"amox"</span>,
|
<span class='fu'>resistance_predict</span>(<span class='kw'>col_ab</span> <span class='kw'>=</span> <span class='st'>"amox"</span>,
|
||||||
<span class='kw'>col_date</span> <span class='kw'>=</span> <span class='st'>"date"</span>,
|
<span class='kw'>col_date</span> <span class='kw'>=</span> <span class='st'>"date"</span>,
|
||||||
<span class='kw'>info</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>,
|
<span class='kw'>info</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>,
|
||||||
|
@ -163,7 +163,7 @@
|
|||||||
|
|
||||||
<div class="ref-description">
|
<div class="ref-description">
|
||||||
|
|
||||||
<p>This function is deprecated. Use the <code>portion</code> functions instead.</p>
|
<p>This function is deprecated. Use the <code><a href='portion.html'>portion</a></code> functions instead.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -175,7 +175,7 @@
|
|||||||
<colgroup><col class="name" /><col class="desc" /></colgroup>
|
<colgroup><col class="name" /><col class="desc" /></colgroup>
|
||||||
<tr>
|
<tr>
|
||||||
<th>ab1, ab2</th>
|
<th>ab1, ab2</th>
|
||||||
<td><p>vector (or column) with antibiotic interpretations. It will be transformed internally with <code>as.rsi</code> if needed.</p></td>
|
<td><p>vector (or column) with antibiotic interpretations. It will be transformed internally with <code><a href='as.rsi.html'>as.rsi</a></code> if needed.</p></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>interpretation</th>
|
<th>interpretation</th>
|
||||||
|
@ -180,8 +180,8 @@
|
|||||||
<dt><code>age</code></dt><dd><p>age of the patient</p></dd>
|
<dt><code>age</code></dt><dd><p>age of the patient</p></dd>
|
||||||
<dt><code>gender</code></dt><dd><p>gender of the patient</p></dd>
|
<dt><code>gender</code></dt><dd><p>gender of the patient</p></dd>
|
||||||
<dt><code>patient_id</code></dt><dd><p>ID of the patient, first 10 characters of an SHA hash containing irretrievable information</p></dd>
|
<dt><code>patient_id</code></dt><dd><p>ID of the patient, first 10 characters of an SHA hash containing irretrievable information</p></dd>
|
||||||
<dt><code>mo</code></dt><dd><p>ID of microorganism created with <code>as.mo</code>, see also <code>microorganisms</code></p></dd>
|
<dt><code>mo</code></dt><dd><p>ID of microorganism created with <code><a href='as.mo.html'>as.mo</a></code>, see also <code><a href='microorganisms.html'>microorganisms</a></code></p></dd>
|
||||||
<dt><code>peni:rifa</code></dt><dd><p>40 different antibiotics with class <code>rsi</code> (see <code>as.rsi</code>); these column names occur in <code>antibiotics</code> data set and can be translated with <code>abname</code></p></dd>
|
<dt><code>peni:rifa</code></dt><dd><p>40 different antibiotics with class <code>rsi</code> (see <code><a href='as.rsi.html'>as.rsi</a></code>); these column names occur in <code><a href='antibiotics.html'>antibiotics</a></code> data set and can be translated with <code><a href='abname.html'>abname</a></code></p></dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
@ -199,7 +199,7 @@
|
|||||||
|
|
||||||
<span class='co'># Add first isolates to our data set:</span>
|
<span class='co'># Add first isolates to our data set:</span>
|
||||||
<span class='no'>my_data</span> <span class='kw'><-</span> <span class='no'>my_data</span> <span class='kw'>%>%</span>
|
<span class='no'>my_data</span> <span class='kw'><-</span> <span class='no'>my_data</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/mutate'>mutate</a></span>(<span class='kw'>first_isolates</span> <span class='kw'>=</span> <span class='fu'>first_isolate</span>(<span class='no'>my_data</span>, <span class='st'>"date"</span>, <span class='st'>"patient_id"</span>, <span class='st'>"mo"</span>))
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>first_isolates</span> <span class='kw'>=</span> <span class='fu'><a href='first_isolate.html'>first_isolate</a></span>(<span class='no'>my_data</span>, <span class='st'>"date"</span>, <span class='st'>"patient_id"</span>, <span class='st'>"mo"</span>))
|
||||||
|
|
||||||
<span class='co'># -------- #</span>
|
<span class='co'># -------- #</span>
|
||||||
<span class='co'># ANALYSIS #</span>
|
<span class='co'># ANALYSIS #</span>
|
||||||
@ -209,22 +209,22 @@
|
|||||||
<span class='co'># and numbers (n) of E. coli, divided by hospital:</span>
|
<span class='co'># and numbers (n) of E. coli, divided by hospital:</span>
|
||||||
|
|
||||||
<span class='no'>my_data</span> <span class='kw'>%>%</span>
|
<span class='no'>my_data</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>mo</span> <span class='kw'>==</span> <span class='fu'>guess_mo</span>(<span class='st'>"E. coli"</span>),
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>mo</span> <span class='kw'>==</span> <span class='fu'><a href='as.mo.html'>guess_mo</a></span>(<span class='st'>"E. coli"</span>),
|
||||||
<span class='no'>first_isolates</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>) <span class='kw'>%>%</span>
|
<span class='no'>first_isolates</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>) <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/summarise'>summarise</a></span>(<span class='kw'>n</span> <span class='kw'>=</span> <span class='fu'>n_rsi</span>(<span class='no'>amox</span>),
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/summarise.html'>summarise</a></span>(<span class='kw'>n</span> <span class='kw'>=</span> <span class='fu'><a href='count.html'>n_rsi</a></span>(<span class='no'>amox</span>),
|
||||||
<span class='kw'>p</span> <span class='kw'>=</span> <span class='fu'>portion_IR</span>(<span class='no'>amox</span>))
|
<span class='kw'>p</span> <span class='kw'>=</span> <span class='fu'><a href='portion.html'>portion_IR</a></span>(<span class='no'>amox</span>))
|
||||||
|
|
||||||
|
|
||||||
<span class='co'># 2. Get the amoxicillin/clavulanic acid resistance</span>
|
<span class='co'># 2. Get the amoxicillin/clavulanic acid resistance</span>
|
||||||
<span class='co'># percentages of E. coli, trend over the years:</span>
|
<span class='co'># percentages of E. coli, trend over the years:</span>
|
||||||
|
|
||||||
<span class='no'>my_data</span> <span class='kw'>%>%</span>
|
<span class='no'>my_data</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>mo</span> <span class='kw'>==</span> <span class='fu'>guess_mo</span>(<span class='st'>"E. coli"</span>),
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>mo</span> <span class='kw'>==</span> <span class='fu'><a href='as.mo.html'>guess_mo</a></span>(<span class='st'>"E. coli"</span>),
|
||||||
<span class='no'>first_isolates</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>) <span class='kw'>%>%</span>
|
<span class='no'>first_isolates</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>) <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='kw'>year</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/format'>format</a></span>(<span class='no'>date</span>, <span class='st'>"%Y"</span>)) <span class='kw'>%>%</span>
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='kw'>year</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/format'>format</a></span>(<span class='no'>date</span>, <span class='st'>"%Y"</span>)) <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/summarise'>summarise</a></span>(<span class='kw'>n</span> <span class='kw'>=</span> <span class='fu'>n_rsi</span>(<span class='no'>amcl</span>),
|
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/summarise.html'>summarise</a></span>(<span class='kw'>n</span> <span class='kw'>=</span> <span class='fu'><a href='count.html'>n_rsi</a></span>(<span class='no'>amcl</span>),
|
||||||
<span class='kw'>p</span> <span class='kw'>=</span> <span class='fu'>portion_IR</span>(<span class='no'>amcl</span>, <span class='kw'>minimum</span> <span class='kw'>=</span> <span class='fl'>20</span>))
|
<span class='kw'>p</span> <span class='kw'>=</span> <span class='fu'><a href='portion.html'>portion_IR</a></span>(<span class='no'>amcl</span>, <span class='kw'>minimum</span> <span class='kw'>=</span> <span class='fl'>20</span>))
|
||||||
<span class='co'># }</span></pre>
|
<span class='co'># }</span></pre>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
|
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
|
||||||
|
@ -195,7 +195,7 @@ When negative: the left tail is longer; the mass of the distribution is concentr
|
|||||||
|
|
||||||
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
||||||
|
|
||||||
<div class='dont-index'><p><code>kurtosis</code></p></div>
|
<div class='dont-index'><p><code><a href='kurtosis.html'>kurtosis</a></code></p></div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -163,7 +163,7 @@
|
|||||||
|
|
||||||
<div class="ref-description">
|
<div class="ref-description">
|
||||||
|
|
||||||
<p>These <code>data.tables</code> are transformed from the <code>microorganisms</code> and <code>microorganisms</code> data sets to improve speed of <code>as.mo</code>. They are meant for internal use only, and are only mentioned here for reference.</p>
|
<p>These <code>data.tables</code> are transformed from the <code><a href='microorganisms.html'>microorganisms</a></code> and <code><a href='microorganisms.html'>microorganisms</a></code> data sets to improve speed of <code><a href='as.mo.html'>as.mo</a></code>. They are meant for internal use only, and are only mentioned here for reference.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
41
index.md
41
index.md
@ -56,6 +56,47 @@ It will be downloaded and installed automatically.
|
|||||||
|
|
||||||
To find out how to conduct AMR analysis, please [continue reading here to get started](./articles/AMR.html) or click the button 'Get Started' in the top menu.
|
To find out how to conduct AMR analysis, please [continue reading here to get started](./articles/AMR.html) or click the button 'Get Started' in the top menu.
|
||||||
|
|
||||||
|
### Short introduction
|
||||||
|
|
||||||
|
<img src="man/figures/itis_logo.jpg" height="60px">
|
||||||
|
|
||||||
|
This package contains the **complete microbial taxonomic data** (with all nine taxonomic ranks - from kingdom to subspecies) from the publicly available Integrated Taxonomic Information System (ITIS, https://www.itis.gov).
|
||||||
|
|
||||||
|
All (sub)species from **the taxonomic kingdoms Bacteria, Fungi and Protozoa are included in this package**, as well as all previously accepted names known to ITIS. Furthermore, the responsible authors and year of publication are available. This allows users to use authoritative taxonomic information for their data analysis on any microorganism, not only human pathogens. It also helps to quickly determine the Gram stain of bacteria, since all bacteria are classified into subkingdom Negibacteria or Posibacteria. ITIS is a partnership of U.S., Canadian, and Mexican agencies and taxonomic specialists.
|
||||||
|
|
||||||
|
The `AMR` package basically does four important things:
|
||||||
|
|
||||||
|
1. It **cleanses existing data**, by transforming it to reproducible and profound *classes*, making the most efficient use of R. These functions all use artificial intelligence to guess results that you would expect:
|
||||||
|
|
||||||
|
* Use `as.mo()` to get an ID of a microorganism. The IDs are human readable for the trained eye - the ID of *Klebsiella pneumoniae* is "B_KLBSL_PNE" (B stands for Bacteria) and the ID of *S. aureus* is "B_STPHY_AUR". The function takes almost any text as input that looks like the name or code of a microorganism like "E. coli", "esco" and "esccol". Even `as.mo("MRSA")` will return the ID of *S. aureus*. Moreover, it can group all coagulase negative and positive *Staphylococci*, and can transform *Streptococci* into Lancefield groups. To find bacteria based on your input, it uses Artificial Intelligence to look up values in the included ITIS data, consisting of more than 18,000 microorganisms.
|
||||||
|
* Use `as.rsi()` to transform values to valid antimicrobial results. It produces just S, I or R based on your input and warns about invalid values. Even values like "<=0.002; S" (combined MIC/RSI) will result in "S".
|
||||||
|
* Use `as.mic()` to cleanse your MIC values. It produces a so-called factor (called *ordinal* in SPSS) with valid MIC values as levels. A value like "<=0.002; S" (combined MIC/RSI) will result in "<=0.002".
|
||||||
|
* Use `as.atc()` to get the ATC code of an antibiotic as defined by the WHO. This package contains a database with most LIS codes, official names, DDDs and even trade names of antibiotics. For example, the values "Furabid", "Furadantin", "nitro" all return the ATC code of Nitrofurantoine.
|
||||||
|
|
||||||
|
2. It **enhances existing data** and **adds new data** from data sets included in this package.
|
||||||
|
|
||||||
|
* Use `eucast_rules()` to apply [EUCAST expert rules to isolates](http://www.eucast.org/expert_rules_and_intrinsic_resistance/).
|
||||||
|
* Use `first_isolate()` to identify the first isolates of every patient [using guidelines from the CLSI](https://clsi.org/standards/products/microbiology/documents/m39/) (Clinical and Laboratory Standards Institute).
|
||||||
|
* You can also identify first *weighted* isolates of every patient, an adjusted version of the CLSI guideline. This takes into account key antibiotics of every strain and compares them.
|
||||||
|
* Use `mdro()` (abbreviation of Multi Drug Resistant Organisms) to check your isolates for exceptional resistance with country-specific guidelines or EUCAST rules. Currently, national guidelines for Germany and the Netherlands are supported.
|
||||||
|
* The data set `microorganisms` contains the complete taxonomic tree of more than 18,000 microorganisms (bacteria, fungi/yeasts and protozoa). Furthermore, the colloquial name and Gram stain are available, which enables resistance analysis of e.g. different antibiotics per Gram stain. The package also contains functions to look up values in this data set like `mo_genus()`, `mo_family()`, `mo_gramstain()` or even `mo_phylum()`. As they use `as.mo()` internally, they also use artificial intelligence. For example, `mo_genus("MRSA")` and `mo_genus("S. aureus")` will both return `"Staphylococcus"`. They also come with support for German, Dutch, Spanish, Italian, French and Portuguese. These functions can be used to add new variables to your data.
|
||||||
|
* The data set `antibiotics` contains the ATC code, LIS codes, official name, trivial name and DDD of both oral and parenteral administration. It also contains a total of 298 trade names. Use functions like `ab_name()` and `ab_tradenames()` to look up values. The `ab_*` functions use `as.atc()` internally so they support AI to guess your expected result. For example, `ab_name("Fluclox")`, `ab_name("Floxapen")` and `ab_name("J01CF05")` will all return `"Flucloxacillin"`. These functions can again be used to add new variables to your data.
|
||||||
|
|
||||||
|
3. It **analyses the data** with convenient functions that use well-known methods.
|
||||||
|
|
||||||
|
* Calculate the resistance (and even co-resistance) of microbial isolates with the `portion_R()`, `portion_IR()`, `portion_I()`, `portion_SI()` and `portion_S()` functions. Similarly, the *number* of isolates can be determined with the `count_R()`, `count_IR()`, `count_I()`, `count_SI()` and `count_S()` functions. All these functions can be used [with the `dplyr` package](https://dplyr.tidyverse.org/#usage) (e.g. in conjunction with [`summarise`](https://dplyr.tidyverse.org/reference/summarise.html))
|
||||||
|
* Plot AMR results with `geom_rsi()`, a function made for the `ggplot2` package
|
||||||
|
* Predict antimicrobial resistance for the nextcoming years using logistic regression models with the `resistance_predict()` function
|
||||||
|
* Conduct descriptive statistics to enhance base R: calculate `kurtosis()`, `skewness()` and create frequency tables with `freq()`
|
||||||
|
|
||||||
|
4. It **teaches the user** how to use all the above actions.
|
||||||
|
|
||||||
|
* The package contains extensive help pages with many examples.
|
||||||
|
* It also contains an example data set called `septic_patients`. This data set contains:
|
||||||
|
* 2,000 blood culture isolates from anonymised septic patients between 2001 and 2017 in the Northern Netherlands
|
||||||
|
* Results of 40 antibiotics (each antibiotic in its own column) with a total of 38,414 antimicrobial results
|
||||||
|
* Real and genuine data
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
<a href="https://www.rug.nl"><img src="./logo_rug.png" height="60px"></a>
|
<a href="https://www.rug.nl"><img src="./logo_rug.png" height="60px"></a>
|
||||||
|
@ -28,10 +28,24 @@ pre, code {
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
}
|
}
|
||||||
|
pre {
|
||||||
|
font-size: 90% !important;
|
||||||
|
}
|
||||||
li, p {
|
li, p {
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* slightly smaller blockquote */
|
||||||
|
blockquote {
|
||||||
|
font-size: 98%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 2nd list in navigation should be smaller */
|
||||||
|
#tocnav li li {
|
||||||
|
font-size: 90%;
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
/* new <help> element with dotted underline */
|
/* new <help> element with dotted underline */
|
||||||
help {
|
help {
|
||||||
border-bottom: 1px dotted;
|
border-bottom: 1px dotted;
|
||||||
@ -60,3 +74,18 @@ help {
|
|||||||
#navbar .fas {
|
#navbar .fas {
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* tables */
|
||||||
|
.table {
|
||||||
|
font-size: 90%;
|
||||||
|
}
|
||||||
|
.table td {
|
||||||
|
padding: 4px !important;
|
||||||
|
}
|
||||||
|
thead {
|
||||||
|
border-top: 2px solid black;
|
||||||
|
border-bottom: 2px solid black;
|
||||||
|
}
|
||||||
|
tbody {
|
||||||
|
border-bottom: 2px solid black;
|
||||||
|
}
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
context("first_isolate.R")
|
context("first_isolate.R")
|
||||||
|
|
||||||
test_that("first isolates work", {
|
test_that("first isolates work", {
|
||||||
# septic_patients contains 1315 out of 2000 first isolates
|
# septic_patients contains 1317 out of 2000 first isolates
|
||||||
expect_equal(
|
expect_equal(
|
||||||
sum(
|
sum(
|
||||||
first_isolate(tbl = septic_patients,
|
first_isolate(tbl = septic_patients,
|
||||||
@ -28,9 +28,9 @@ test_that("first isolates work", {
|
|||||||
col_mo = "mo",
|
col_mo = "mo",
|
||||||
info = TRUE),
|
info = TRUE),
|
||||||
na.rm = TRUE),
|
na.rm = TRUE),
|
||||||
1315)
|
1317)
|
||||||
|
|
||||||
# septic_patients contains 1411 out of 2000 first *weighted* isolates
|
# septic_patients contains 1413 out of 2000 first *weighted* isolates
|
||||||
expect_equal(
|
expect_equal(
|
||||||
suppressWarnings(
|
suppressWarnings(
|
||||||
sum(
|
sum(
|
||||||
@ -43,7 +43,7 @@ test_that("first isolates work", {
|
|||||||
type = "keyantibiotics",
|
type = "keyantibiotics",
|
||||||
info = TRUE),
|
info = TRUE),
|
||||||
na.rm = TRUE)),
|
na.rm = TRUE)),
|
||||||
1411)
|
1413)
|
||||||
# should be same for tibbles
|
# should be same for tibbles
|
||||||
expect_equal(
|
expect_equal(
|
||||||
suppressWarnings(
|
suppressWarnings(
|
||||||
@ -57,8 +57,8 @@ test_that("first isolates work", {
|
|||||||
type = "keyantibiotics",
|
type = "keyantibiotics",
|
||||||
info = TRUE),
|
info = TRUE),
|
||||||
na.rm = TRUE)),
|
na.rm = TRUE)),
|
||||||
1411)
|
1413)
|
||||||
# and 1435 when not ignoring I
|
# and 1436 when not ignoring I
|
||||||
expect_equal(
|
expect_equal(
|
||||||
suppressWarnings(
|
suppressWarnings(
|
||||||
sum(
|
sum(
|
||||||
@ -71,8 +71,8 @@ test_that("first isolates work", {
|
|||||||
type = "keyantibiotics",
|
type = "keyantibiotics",
|
||||||
info = TRUE),
|
info = TRUE),
|
||||||
na.rm = TRUE)),
|
na.rm = TRUE)),
|
||||||
1435)
|
1436)
|
||||||
# and 1416 when using points
|
# and 1417 when using points
|
||||||
expect_equal(
|
expect_equal(
|
||||||
suppressWarnings(
|
suppressWarnings(
|
||||||
sum(
|
sum(
|
||||||
@ -84,9 +84,9 @@ test_that("first isolates work", {
|
|||||||
type = "points",
|
type = "points",
|
||||||
info = TRUE),
|
info = TRUE),
|
||||||
na.rm = TRUE)),
|
na.rm = TRUE)),
|
||||||
1416)
|
1417)
|
||||||
|
|
||||||
# septic_patients contains 1161 out of 2000 first non-ICU isolates
|
# septic_patients contains 1163 out of 2000 first non-ICU isolates
|
||||||
expect_equal(
|
expect_equal(
|
||||||
sum(
|
sum(
|
||||||
first_isolate(septic_patients,
|
first_isolate(septic_patients,
|
||||||
@ -97,7 +97,7 @@ test_that("first isolates work", {
|
|||||||
info = TRUE,
|
info = TRUE,
|
||||||
icu_exclude = TRUE),
|
icu_exclude = TRUE),
|
||||||
na.rm = TRUE),
|
na.rm = TRUE),
|
||||||
1161)
|
1163)
|
||||||
|
|
||||||
# set 1500 random observations to be of specimen type 'Urine'
|
# set 1500 random observations to be of specimen type 'Urine'
|
||||||
random_rows <- sample(x = 1:2000, size = 1500, replace = FALSE)
|
random_rows <- sample(x = 1:2000, size = 1500, replace = FALSE)
|
||||||
|
@ -6,8 +6,10 @@ output:
|
|||||||
toc: true
|
toc: true
|
||||||
vignette: >
|
vignette: >
|
||||||
%\VignetteIndexEntry{The AMR package - How to conduct AMR analysis}
|
%\VignetteIndexEntry{The AMR package - How to conduct AMR analysis}
|
||||||
%\VignetteEngine{knitr::rmarkdown}
|
|
||||||
%\VignetteEncoding{UTF-8}
|
%\VignetteEncoding{UTF-8}
|
||||||
|
%\VignetteEngine{knitr::rmarkdown}
|
||||||
|
editor_options:
|
||||||
|
chunk_output_type: console
|
||||||
---
|
---
|
||||||
|
|
||||||
```{r setup, include = FALSE, results = 'markup'}
|
```{r setup, include = FALSE, results = 'markup'}
|
||||||
@ -15,7 +17,253 @@ knitr::opts_chunk$set(
|
|||||||
collapse = TRUE,
|
collapse = TRUE,
|
||||||
comment = "#"
|
comment = "#"
|
||||||
)
|
)
|
||||||
|
# set to original language (English)
|
||||||
|
Sys.setlocale(locale = "C")
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Note:** values on this page will be regenerated with every website update since it is written in [RMarkdown](https://rmarkdown.rstudio.com/), so actual results will change over time. However, the methodology remains unchanged. This page was generated on `r format(Sys.Date(), "%d %B %Y")`.
|
||||||
|
|
||||||
This page will soon be updated.
|
# Introduction
|
||||||
|
(work in progress)
|
||||||
|
|
||||||
|
# Tutorial
|
||||||
|
For this tutorial, we will create fake demonstration data to work with.
|
||||||
|
|
||||||
|
You can skip to [Cleaning the data](#cleaning-the-data) if you already have your own data ready. If you start your analysis, try to make the structure of your data generally look like this:
|
||||||
|
|
||||||
|
```{r example table, echo = FALSE, results = 'asis'}
|
||||||
|
knitr::kable(dplyr::tibble(date = Sys.Date(),
|
||||||
|
patient_id = c("abcd", "abcd", "efgh"),
|
||||||
|
mo = "Escherichia coli",
|
||||||
|
amox = c("S", "S", "R"),
|
||||||
|
cipr = c("S", "R", "S")),
|
||||||
|
align = "c")
|
||||||
|
```
|
||||||
|
|
||||||
|
## Needed R packages
|
||||||
|
As with many uses in R, we need some additional packages for AMR analysis. The most important one is [`dplyr`](https://dplyr.tidyverse.org/), which tremendously improves the way we work with data - it allows for a very natural way of writing syntaxes in R. Another important dependency is [`ggplot2`](https://ggplot2.tidyverse.org/). This package can be used to create beautiful plots in R.
|
||||||
|
|
||||||
|
Our `AMR` package depends on these packages and even extends their use and functions.
|
||||||
|
|
||||||
|
```{r lib packages, message = FALSE}
|
||||||
|
library(dplyr) # the data science package
|
||||||
|
library(AMR) # this package, to simplify and automate AMR analysis
|
||||||
|
library(ggplot2) # for appealing plots
|
||||||
|
```
|
||||||
|
|
||||||
|
## Creation of data
|
||||||
|
We will create some fake example data to use for analysis. For antimicrobial resistance analysis, we need at least: a patients ID, name or code of a microorganism, a date and antimicrobial results (an antibiogram). It could also include a specimen type (e.g. to filter on blood or urine), the ward type (e.g. to filter on ICUs).
|
||||||
|
|
||||||
|
With additional columns (like a hospital name, the patients gender of even [well-defined] clinical properties) you can do a comparative analysis, as this tutorial will demonstrate too.
|
||||||
|
|
||||||
|
#### Patients
|
||||||
|
To start with patients, we need a unique list of patients.
|
||||||
|
|
||||||
|
```{r create patients}
|
||||||
|
patients <- unlist(lapply(LETTERS, paste0, 1:10))
|
||||||
|
```
|
||||||
|
|
||||||
|
The `LETTERS` object is available in R - it's a vector with 26 characters: `A` to `Z`. The `patients` object we just created is now a vector of length `r length(patients)`, with values (patient IDs) varying from ``r patients[1]`` to ``r patients[length(patients)]``.
|
||||||
|
|
||||||
|
#### Dates
|
||||||
|
Let's pretend that our data consists of blood cultures isolates from 1 January 2010 until 1 January 2018.
|
||||||
|
|
||||||
|
```{r create dates}
|
||||||
|
dates <- seq(as.Date("2010-01-01"), as.Date("2018-01-01"), by = "day")
|
||||||
|
```
|
||||||
|
|
||||||
|
This `dates` object now contains all days in our date range.
|
||||||
|
|
||||||
|
#### Microorganisms
|
||||||
|
For this tutorial, we will uses four different microorganisms: *Escherichia coli*, *Staphylococcus aureus*, *Streptococcus pneumoniae*, and *Klebsiella pneumoniae*:
|
||||||
|
|
||||||
|
```{r mo}
|
||||||
|
bacteria <- c("Escherichia coli", "Staphylococcus aureus",
|
||||||
|
"Streptococcus pneumoniae", "Klebsiella pneumoniae")
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Other variables
|
||||||
|
For completeness, we can also add the patients gender, the hospital where the patients was admitted and all valid antibmicrobial results:
|
||||||
|
|
||||||
|
```{r create other}
|
||||||
|
genders <- c("M", "F")
|
||||||
|
hospitals <- c("Hospital A", "Hospital B", "Hospital C", "Hospital D")
|
||||||
|
ab_interpretations <- c("S", "I", "R")
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Put everything together
|
||||||
|
|
||||||
|
Using the `sample()` function, we can randomly select items from all objects we defined earlier. To let our fake data reflect reality a bit, we will also approximately define the probabilities of bacteria and the antibiotic results with the `prob` parameter.
|
||||||
|
|
||||||
|
```{r merge data}
|
||||||
|
data <- data.frame(date = sample(dates, 5000, replace = TRUE),
|
||||||
|
patient_id = sample(patients, 5000, replace = TRUE),
|
||||||
|
# gender - add slightly more men:
|
||||||
|
gender = sample(genders, 5000, replace = TRUE, prob = c(0.55, 0.45)),
|
||||||
|
hospital = sample(hospitals, 5000, replace = TRUE),
|
||||||
|
bacteria = sample(bacteria, 5000, replace = TRUE, prob = c(0.50, 0.25, 0.15, 0.10)),
|
||||||
|
amox = sample(ab_interpretations, 5000, replace = TRUE, prob = c(0.6, 0.05, 0.35)),
|
||||||
|
amcl = sample(ab_interpretations, 5000, replace = TRUE, prob = c(0.75, 0.1, 0.15)),
|
||||||
|
cipr = sample(ab_interpretations, 5000, replace = TRUE, prob = c(0.8, 0, 0.2)),
|
||||||
|
gent = sample(ab_interpretations, 5000, replace = TRUE, prob = c(0.92, 0, 0.07))
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
The resulting data set contains 5,000 blood culture isolates. With the `head()` function we can preview the first 6 values of this data set:
|
||||||
|
```{r preview data set 1, echo = TRUE, results = 'hide'}
|
||||||
|
head(data)
|
||||||
|
```
|
||||||
|
|
||||||
|
```{r preview data set 2, echo = FALSE, results = 'asis'}
|
||||||
|
knitr::kable(head(data), align = "c")
|
||||||
|
```
|
||||||
|
|
||||||
|
Now, let's start the cleaning and the analysis!
|
||||||
|
|
||||||
|
## Cleaning the data
|
||||||
|
Use the frequency table function `freq()` to look specifically for unique values in any variable. For example, for the `gender` variable:
|
||||||
|
|
||||||
|
```{r freq gender 1, echo = TRUE, results = 'hide'}
|
||||||
|
data %>% freq(gender) # this would be the same: freq(data$gender)
|
||||||
|
```
|
||||||
|
|
||||||
|
```{r freq gender 2, echo = FALSE, results = 'markup'}
|
||||||
|
data %>% freq(gender, markdown = FALSE, header = TRUE)
|
||||||
|
```
|
||||||
|
|
||||||
|
So, we can draw at least two conclusions immediately. From a data scientist perspective, the data looks clean: only values `M` and `F`. From a researcher perspective: there are slightly more men. Nothing we didn't already know.
|
||||||
|
|
||||||
|
The data is already quite clean, but we still need to transform some variables. The `bacteria` column now consists of text, and we want to add more variables based on microbial IDs later on. So, we will transform this column to valid IDs. The `mutate` function of the dplyr package makes this really easy:
|
||||||
|
```{r transform mo 1}
|
||||||
|
data <- data %>%
|
||||||
|
mutate(bacteria = as.mo(bacteria))
|
||||||
|
```
|
||||||
|
|
||||||
|
We also want to transform the antibiotics, because in real life data we don't know if they are really clean. The `as.rsi()` function ensures reliability and reproducibility in these kind of variables. The `mutate_at()` will run the `as.rsi()` function on defined variables:
|
||||||
|
|
||||||
|
```{r transform abx}
|
||||||
|
data <- data %>%
|
||||||
|
mutate_at(vars(amox:cipr), as.rsi)
|
||||||
|
```
|
||||||
|
|
||||||
|
Finally, we will apply [EUCAST rules](http://www.eucast.org/expert_rules_and_intrinsic_resistance/) on our antimicrobial results. In Europe, most medical microbiological laboratories already apply these rules. Our package features their latest insights on intrinsic resistance and exceptional phenotypes. Moreover, the `eucast_rules()` function can also apply additional rules, like forcing <help title="ATC: J01CA01">ampicillin</help> = R when <help title="ATC: J01CR02">amoxicillin/clavulanic acid</help> = R.
|
||||||
|
|
||||||
|
Because the amoxicillin (column `amox`) and amoxicillin/clavulanic acid (column `amcl`) in our data were generated randomly, some rows will undoubtedly contain amox = S and amcl = R, which is technically impossible. The `eucast_rules()` fixes this:
|
||||||
|
|
||||||
|
```{r eucast, warning = FALSE, message = FALSE}
|
||||||
|
data <- eucast_rules(data, col_mo = "bacteria")
|
||||||
|
```
|
||||||
|
|
||||||
|
## Adding new variables
|
||||||
|
Now we have the microbial ID, we can add some taxonomic properties:
|
||||||
|
|
||||||
|
```{r new taxo}
|
||||||
|
data <- data %>%
|
||||||
|
mutate(gramstain = mo_gramstain(bacteria),
|
||||||
|
family = mo_family(bacteria))
|
||||||
|
```
|
||||||
|
|
||||||
|
### First isolates
|
||||||
|
We also need to know which isolates we can *actually* use for analysis.
|
||||||
|
|
||||||
|
To conduct an analysis of antimicrobial resistance, you [must only include the first isolate of every patient per episode](https://www.ncbi.nlm.nih.gov/pubmed/17304462). If you would not do this, you could easily get an overestimate or underestimate of the resistance of an antibiotic. Imagine that a patient was admitted with an MRSA and that it was found in 5 different blood cultures the following weeks (yes, some countries like the Netherlands have these blood drawing policies). The resistance percentage of oxacillin of all \emph{S. aureus} isolates would be overestimated, because you included this MRSA more than once. It would clearly be \href{https://en.wikipedia.org/wiki/Selection_bias}{selection bias}.
|
||||||
|
|
||||||
|
The Clinical and Laboratory Standards Institute (CLSI) appoints this as follows:
|
||||||
|
|
||||||
|
> *(...) When preparing a cumulative antibiogram to guide clinical decisions about empirical antimicrobial therapy of initial infections, **only the first isolate of a given species per patient, per analysis period (eg, one year) should be included, irrespective of body site, antimicrobial susceptibility profile, or other phenotypical characteristics (eg, biotype)**. The first isolate is easily identified, and cumulative antimicrobial susceptibility test data prepared using the first isolate are generally comparable to cumulative antimicrobial susceptibility test data calculated by other methods, providing duplicate isolates are excluded.*
|
||||||
|
Chapter 6.4, M39-A4 Analysis and Presentation of Cumulative Antimicrobial Susceptibility Test Data, 4th Edition. CLSI, 2014. https://clsi.org/standards/products/microbiology/documents/m39/
|
||||||
|
|
||||||
|
This `AMR` package includes this methodology with the `first_isolate()` function. It adopts the episode of a year (can be changed by user) and it starts counting days after every selected isolate. This new variable can easily be added to our data:
|
||||||
|
```{r 1st isolate}
|
||||||
|
data <- data %>%
|
||||||
|
mutate(first = first_isolate(.))
|
||||||
|
```
|
||||||
|
|
||||||
|
So only `r AMR:::percent(sum(data$first) / nrow(data))` is suitable for resistance analysis! We can now filter on is with the `filter()` function, also from the `dplyr` package:
|
||||||
|
|
||||||
|
```{r 1st isolate filter}
|
||||||
|
data_1st <- data %>%
|
||||||
|
filter(first == TRUE)
|
||||||
|
```
|
||||||
|
|
||||||
|
For future use, the above two syntaxes can be shortened with the `filter_first_isolate()` function:
|
||||||
|
```{r 1st isolate filter 2, results = 'hide', message = FALSE}
|
||||||
|
data_1st <- data %>%
|
||||||
|
filter_first_isolate()
|
||||||
|
```
|
||||||
|
|
||||||
|
### First *weighted* isolates
|
||||||
|
We made a slight twist to the CLSI algorithm, to take into account antimicrobial results. Imagine this data, sorted on date:
|
||||||
|
|
||||||
|
```{r, echo = FALSE, message = FALSE, warning = FALSE, results = 'asis'}
|
||||||
|
weighted_df <- data %>%
|
||||||
|
filter(bacteria == as.mo("E. coli")) %>%
|
||||||
|
# only most prevalent patient
|
||||||
|
filter(patient_id == top_freq(freq(., patient_id), 1)[1]) %>%
|
||||||
|
arrange(date) %>%
|
||||||
|
select(date, patient_id, bacteria, amox:gent, first) %>%
|
||||||
|
# maximum of 10 rows
|
||||||
|
.[1:min(10, nrow(.)),] %>%
|
||||||
|
mutate(isolate = row_number()) %>%
|
||||||
|
select(isolate, everything())
|
||||||
|
|
||||||
|
weighted_df %>%
|
||||||
|
knitr::kable(align = "c")
|
||||||
|
```
|
||||||
|
|
||||||
|
Only `r sum(weighted_df$first)` isolates are marked as 'first' according to CLSI guideline. But when reviewing the antibiogram, it is obvious that some isolates are absolutely different strains and show be included too. This is why we weigh isolates, based on their antibiogram. The `key_antibiotics()` function adds a vector with 18 key antibiotics: 6 broad spectrum ones, 6 small spectrum for Gram negatives and 6 small spectrum for Gram positives. These can be defined by the user.
|
||||||
|
|
||||||
|
If a column exists with a name like 'key(...)ab' the `first_isolate()` function will automatically use it and determine the first weighted isolates. Mind the NOTEs in below output:
|
||||||
|
|
||||||
|
```{r 1st weighted}
|
||||||
|
data <- data %>%
|
||||||
|
mutate(keyab = key_antibiotics(.)) %>%
|
||||||
|
mutate(first_weighted = first_isolate(.))
|
||||||
|
```
|
||||||
|
|
||||||
|
```{r, echo = FALSE, message = FALSE, warning = FALSE, results = 'asis'}
|
||||||
|
weighted_df2 <- data %>%
|
||||||
|
filter(bacteria == as.mo("E. coli")) %>%
|
||||||
|
# only most prevalent patient
|
||||||
|
filter(patient_id == top_freq(freq(., patient_id), 1)[1]) %>%
|
||||||
|
arrange(date) %>%
|
||||||
|
select(date, patient_id, bacteria, amox:gent, first, first_weighted) %>%
|
||||||
|
# maximum of 10 rows
|
||||||
|
.[1:min(10, nrow(.)),] %>%
|
||||||
|
mutate(isolate = row_number()) %>%
|
||||||
|
select(isolate, everything())
|
||||||
|
|
||||||
|
weighted_df2 %>%
|
||||||
|
knitr::kable(align = "c")
|
||||||
|
```
|
||||||
|
|
||||||
|
Instead of `r sum(weighted_df$first)`, now `r sum(weighted_df2$first_weighted)` isolates are flagged. In total, `r AMR:::percent(sum(data$first_weighted) / nrow(data))` of all isolates are marked 'first weighted' - `r AMR:::percent((sum(data$first_weighted) / nrow(data)) - (sum(data$first) / nrow(data)))` more than when using the CLSI guideline. In real life, this novel algorithm will yield 5-10% more isolates than the classic CLSI guideline.
|
||||||
|
|
||||||
|
As with `filter_first_isolate()`, there's a shortcut for this new algorithm too:
|
||||||
|
```{r 1st isolate filter 3, results = 'hide', message = FALSE, warning = FALSE}
|
||||||
|
data_1st <- data %>%
|
||||||
|
filter_first_weighted_isolate()
|
||||||
|
```
|
||||||
|
|
||||||
|
So we end up with `r format(nrow(data_1st), big.mark = ",")` isolates for analysis.
|
||||||
|
|
||||||
|
We can remove unneeded columns:
|
||||||
|
```{r}
|
||||||
|
data_1st <- data_1st %>%
|
||||||
|
select(-first, -keyab)
|
||||||
|
```
|
||||||
|
|
||||||
|
Now our data looks like:
|
||||||
|
|
||||||
|
```{r preview data set 3, echo = TRUE, results = 'hide'}
|
||||||
|
head(data_1st)
|
||||||
|
```
|
||||||
|
|
||||||
|
```{r preview data set 4, echo = FALSE, results = 'asis'}
|
||||||
|
knitr::kable(head(data_1st), align = "c")
|
||||||
|
```
|
||||||
|
|
||||||
|
Time for the analysis!
|
||||||
|
|
||||||
|
## Analysing the data
|
||||||
|
(work in progress)
|
||||||
|
Loading…
Reference in New Issue
Block a user