diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8f840204..234b6383 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -93,7 +93,6 @@ R-release: allow_failure: true script: - Rscript -e 'sessionInfo()' - - Rscript -e 'AMR::eucast_rules(AMR::example_isolates_unclean, info = TRUE)' # install missing and outdated packages - Rscript -e 'source(".gitlab-ci.R"); gl_update_pkg_all(repos = "https://cran.rstudio.com", quiet = TRUE, install_pkgdown = TRUE, install_lintr = TRUE)' # remove vignettes folder and get VignetteBuilder field out of DESCRIPTION file @@ -102,6 +101,8 @@ R-release: # build package - R CMD build . --no-build-vignettes --no-manual - PKG_FILE_NAME=$(ls -1t *.tar.gz | head -n 1) + - Rscript -e 'devtools::install_local("${PKG_FILE_NAME}")' + - Rscript -e 'AMR::eucast_rules(AMR::example_isolates_unclean, info = TRUE)' - Rscript -e 'Sys.setenv(NOT_CRAN = "true")' - R CMD check "${PKG_FILE_NAME}" --no-build-vignettes --no-manual --as-cran artifacts: @@ -121,7 +122,6 @@ R-devel: allow_failure: true script: - Rscriptdevel -e 'sessionInfo()' - - Rscriptdevel -e 'AMR::eucast_rules(AMR::example_isolates_unclean, info = TRUE)' # install missing and outdated packages - Rscriptdevel -e 'source(".gitlab-ci.R"); gl_update_pkg_all(repos = "https://cran.rstudio.com", quiet = TRUE)' # remove vignettes folder and get VignetteBuilder field out of DESCRIPTION file @@ -130,6 +130,8 @@ R-devel: # build package - Rdevel CMD build . --no-build-vignettes --no-manual - PKG_FILE_NAME=$(ls -1t *.tar.gz | head -n 1) + - Rscript -e 'devtools::install_local("${PKG_FILE_NAME}")' + - Rscript -e 'AMR::eucast_rules(AMR::example_isolates_unclean, info = TRUE)' - Rscript -e 'Sys.setenv(NOT_CRAN = "true")' - Rdevel CMD check "${PKG_FILE_NAME}" --no-build-vignettes --no-manual --as-cran artifacts: diff --git a/DESCRIPTION b/DESCRIPTION index 9ec90077..3329ab74 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 1.1.0.9008 -Date: 2020-05-17 +Version: 1.1.0.9009 +Date: 2020-05-18 Title: Antimicrobial Resistance Analysis Authors@R: c( person(role = c("aut", "cre"), diff --git a/NEWS.md b/NEWS.md index 57a65e32..522d7c4a 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,5 @@ -# AMR 1.1.0.9008 -## Last updated: 17-May-2020 +# AMR 1.1.0.9009 +## Last updated: 18-May-2020 ### Breaking * Removed previously deprecated function `p.symbol()` - it was replaced with `p_symbol()` diff --git a/R/atc_online.R b/R/atc_online.R index 0b056755..00330f27 100644 --- a/R/atc_online.R +++ b/R/atc_online.R @@ -132,7 +132,7 @@ atc_online_property <- function(atc_code, for (i in seq_len(length(atc_code))) { - progress$tick()$print() + progress$tick() atc_url <- sub("%s", atc_code[i], url, fixed = TRUE) diff --git a/R/first_isolate.R b/R/first_isolate.R index 3d21899b..1c61cc0c 100755 --- a/R/first_isolate.R +++ b/R/first_isolate.R @@ -46,12 +46,9 @@ #' #' All isolates with a microbial ID of `NA` will be excluded as first isolate. #' -#' The functions [filter_first_isolate()] and [filter_first_weighted_isolate()] are helper functions to quickly filter on first isolates. The function [filter_first_isolate()] is essentially equal to: +#' The functions [filter_first_isolate()] and [filter_first_weighted_isolate()] are helper functions to quickly filter on first isolates. The function [filter_first_isolate()] is essentially equal to one of: #' ``` -#' x %>% -#' mutate(only_firsts = first_isolate(x, ...)) %>% -#' filter(only_firsts == TRUE) %>% -#' select(-only_firsts) +#' x %>% filter(first_isolate(., ...)) #' ``` #' The function [filter_first_weighted_isolate()] is essentially equal to: #' ``` @@ -60,7 +57,7 @@ #' mutate(only_weighted_firsts = first_isolate(x, #' col_keyantibiotics = "keyab", ...)) %>% #' filter(only_weighted_firsts == TRUE) %>% -#' select(-only_weighted_firsts) +#' select(-only_weighted_firsts, -keyab) #' ``` #' @section Key antibiotics: #' There are two ways to determine whether isolates can be included as first *weighted* isolates which will give generally the same results: @@ -451,7 +448,7 @@ filter_first_isolate <- function(x, col_patient_id = NULL, col_mo = NULL, ...) { - filter(x, first_isolate(x = x, + subset(x, first_isolate(x = x, col_date = col_date, col_patient_id = col_patient_id, col_mo = col_mo, @@ -466,15 +463,23 @@ filter_first_weighted_isolate <- function(x, col_mo = NULL, col_keyantibiotics = NULL, ...) { - tbl_keyab <- x %>% - mutate(keyab = suppressMessages(key_antibiotics(., - col_mo = col_mo, - ...))) %>% - mutate(firsts = first_isolate(., - col_date = col_date, - col_patient_id = col_patient_id, - col_mo = col_mo, - col_keyantibiotics = "keyab", - ...)) - x[which(tbl_keyab$firsts == TRUE), ] + y <- x + if (is.null(col_keyantibiotics)) { + # first try to look for it + col_keyantibiotics <- search_type_in_df(x = x, type = "keyantibiotics") + # still NULL? Then create it since we are calling filter_first_WEIGHTED_isolate() + if (is.null(col_keyantibiotics)) { + y$keyab <- suppressMessages(key_antibiotics(x, + col_mo = col_mo, + ...)) + col_keyantibiotics <- "keyab" + } + } + + subset(x, first_isolate(x = y, + col_date = col_date, + col_patient_id = col_patient_id, + col_mo = col_mo, + col_keyantibiotics = col_keyantibiotics, + ...)) } diff --git a/R/key_antibiotics.R b/R/key_antibiotics.R index 9dc7c233..9bfc4770 100755 --- a/R/key_antibiotics.R +++ b/R/key_antibiotics.R @@ -214,11 +214,9 @@ key_antibiotics <- function(x, warning("only using ", length(gram_negative), " different antibiotics as key antibiotics for Gram-negatives. See ?key_antibiotics.", call. = FALSE) } - # join to microorganisms data set - x <- x %>% as.data.frame(stringsAsFactors = FALSE) + x <- as.data.frame(x, stringsAsFactors = FALSE) x[, col_mo] <- as.mo(x[, col_mo, drop = TRUE]) x$gramstain <- mo_gramstain(x[, col_mo, drop = TRUE], language = NULL) - x$key_ab <- NA_character_ # Gram + diff --git a/_pkgdown.yml b/_pkgdown.yml index 37c5c086..7ae14e2d 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -96,7 +96,6 @@ reference: - "`eucast_rules`" - "`guess_ab_col`" - "`mo_source`" - - "`read.4D`" - title: "Enhancing your data" desc: > Functions to add new data to your existing data, such as the determination diff --git a/docs/404.html b/docs/404.html index 34dd5f5b..51e5383b 100644 --- a/docs/404.html +++ b/docs/404.html @@ -81,7 +81,7 @@ AMR (for R) - 1.1.0.9008 + 1.1.0.9009 diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index 410fa440..3e6c41d9 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -81,7 +81,7 @@ AMR (for R) - 1.1.0.9008 + 1.1.0.9009 diff --git a/docs/articles/AMR.html b/docs/articles/AMR.html index 48eb7097..bbc4833d 100644 --- a/docs/articles/AMR.html +++ b/docs/articles/AMR.html @@ -39,7 +39,7 @@ AMR (for R) - 1.1.0 + 1.1.0.9009 @@ -186,7 +186,7 @@

How to conduct AMR analysis

Matthijs S. Berends

-

15 April 2020

+

18 May 2020

Source: vignettes/AMR.Rmd @@ -195,15 +195,15 @@ -

Note: values on this page will change with every website update since they are based on randomly created values and the page was written in R Markdown. However, the methodology remains unchanged. This page was generated on 15 April 2020.

+

Note: values on this page will change with every website update since they are based on randomly created values and the page was written in R Markdown. However, the methodology remains unchanged. This page was generated on 18 May 2020.

Introduction

Conducting antimicrobial resistance analysis unfortunately requires in-depth knowledge from different scientific fields, which makes it hard to do right. At least, it requires:

+# install.packages(c("dplyr", "ggplot2", "AMR"))
@@ -301,24 +301,24 @@

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.

+

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.

sample_size <- 20000
-data <- data.frame(date = sample(dates, size = sample_size, replace = TRUE),
-                   patient_id = sample(patients, size = sample_size, replace = TRUE),
-                   hospital = sample(hospitals, size = sample_size, replace = TRUE,
+data <- data.frame(date = sample(dates, size = sample_size, replace = TRUE),
+                   patient_id = sample(patients, size = sample_size, replace = TRUE),
+                   hospital = sample(hospitals, size = sample_size, replace = TRUE,
                                      prob = c(0.30, 0.35, 0.15, 0.20)),
-                   bacteria = sample(bacteria, size = sample_size, replace = TRUE,
+                   bacteria = sample(bacteria, size = sample_size, replace = TRUE,
                                      prob = c(0.50, 0.25, 0.15, 0.10)),
-                   AMX = sample(ab_interpretations, size = sample_size, replace = TRUE,
+                   AMX = sample(ab_interpretations, size = sample_size, replace = TRUE,
                                  prob = c(0.60, 0.05, 0.35)),
-                   AMC = sample(ab_interpretations, size = sample_size, replace = TRUE,
+                   AMC = sample(ab_interpretations, size = sample_size, replace = TRUE,
                                  prob = c(0.75, 0.10, 0.15)),
-                   CIP = sample(ab_interpretations, size = sample_size, replace = TRUE,
+                   CIP = sample(ab_interpretations, size = sample_size, replace = TRUE,
                                  prob = c(0.80, 0.00, 0.20)),
-                   GEN = sample(ab_interpretations, size = sample_size, replace = TRUE,
+                   GEN = sample(ab_interpretations, size = sample_size, replace = TRUE,
                                  prob = c(0.92, 0.00, 0.08)))
-

Using the left_join() function from the dplyr package, we can ‘map’ the gender to the patient ID using the patients_table object we created earlier:

-
data <- data %>% left_join(patients_table)
+

Using the left_join() function from the dplyr package, we can ‘map’ the gender to the patient ID using the patients_table object we created earlier:

+
data <- data %>% left_join(patients_table)

The resulting data set contains 20,000 blood culture isolates. With the head() function we can preview the first 6 rows of this data set:

head(data)
@@ -335,64 +335,64 @@ - - - - - + + + + + - - - - + + + + - + - - + + - - - - - - - - - - - - - - - - - - - - - - - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + @@ -412,11 +412,12 @@

For example, for the gender variable:

data %>% freq(gender) # this would be the same: freq(data$gender)

Frequency table

-

Class: factor (numeric)
+

Class: character
Length: 20,000
-Levels: 2: F, M
Available: 20,000 (100%, NA: 0 = 0%)
Unique: 2

+

Shortest: 1
+Longest: 1

2015-12-27Y9Hospital AEscherichia coliR2013-06-23V9Hospital CStaphylococcus aureusS R S S F
2014-01-17X10Hospital CStaphylococcus aureus2016-12-25S10Hospital DEscherichia coli R SR SR F
2015-10-31I32011-01-27Z10 Hospital B Escherichia coli RSSSM
2014-10-30D9Hospital AEscherichia coliSSSSM
2011-02-15P6Hospital DEscherichia coliSSR S S F
2011-10-07G2Hospital C2010-09-14N1Hospital BEscherichia coliSSRRM
2017-10-31W1Hospital DKlebsiella pneumoniaeRRRSF
2014-03-29L4Hospital B Staphylococcus aureus S S
@@ -430,16 +431,16 @@ Unique: 2

- - - - + + + + - - + + @@ -476,10 +477,10 @@ Unique: 2

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:

data <- data %>%
   mutate(first = first_isolate(.))
-# NOTE: Using column `bacteria` as input for `col_mo`.
-# NOTE: Using column `date` as input for `col_date`.
-# NOTE: Using column `patient_id` as input for `col_patient_id`.
-

So only 28.3% is suitable for resistance analysis! We can now filter on it with the filter() function, also from the dplyr package:

+# [34mNOTE: Using column `[1mbacteria[22m` as input for `col_mo`.[39m +# [34mNOTE: Using column `[1mdate[22m` as input for `col_date`.[39m +# [34mNOTE: Using column `[1mpatient_id[22m` as input for `col_patient_id`.[39m +

So only 28.6% is suitable for resistance analysis! We can now filter on it with the filter() function, also from the dplyr package:

data_1st <- data %>%
   filter(first == TRUE)

For future use, the above two syntaxes can be shortened with the filter_first_isolate() function:

@@ -489,7 +490,7 @@ Unique: 2

First weighted isolates

-

We made a slight twist to the CLSI algorithm, to take into account the antimicrobial susceptibility profile. Have a look at all isolates of patient R8, sorted on date:

+

We made a slight twist to the CLSI algorithm, to take into account the antimicrobial susceptibility profile. Have a look at all isolates of patient N1, sorted on date:

1 M10,27751.39%10,27751.39%10,29351.47%10,29351.47%
2 F9,72348.62%9,70748.54% 20,000 100.00%
@@ -505,10 +506,10 @@ Unique: 2

- - + + - + @@ -516,8 +517,8 @@ Unique: 2

- - + + @@ -527,8 +528,8 @@ Unique: 2

- - + + @@ -538,10 +539,10 @@ Unique: 2

- - + + - + @@ -549,30 +550,30 @@ Unique: 2

- - + + - - + + - - + + - - + + - - + + @@ -582,19 +583,19 @@ Unique: 2

- - + + - + - - + + @@ -604,27 +605,27 @@ Unique: 2

- - + + - - - - + + + +
isolate
12010-03-01R82010-03-16N1 B_ESCHR_COLIRS S S S
22010-04-16R82010-04-19N1 B_ESCHR_COLI S S
32010-04-18R82010-06-26N1 B_ESCHR_COLI S S
42010-05-08R82010-07-17N1 B_ESCHR_COLIRS S S S
52010-06-06R82010-09-14N1 B_ESCHR_COLI S SSSRR FALSE
62010-06-14R82010-09-23N1 B_ESCHR_COLIRRSS S S FALSE
72010-07-28R82010-12-14N1 B_ESCHR_COLI S S
82010-07-31R82011-07-30N1 B_ESCHR_COLI S S S SFALSETRUE
92010-08-25R82011-08-21N1 B_ESCHR_COLI S S
102010-09-30R82011-09-09N1 B_ESCHR_COLIRRRRSSSS FALSE
-

Only 1 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 should 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.

+

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 should 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:

data <- data %>%
   mutate(keyab = key_antibiotics(.)) %>%
   mutate(first_weighted = first_isolate(.))
-# NOTE: Using column `bacteria` as input for `col_mo`.
-# NOTE: Using column `bacteria` as input for `col_mo`.
-# NOTE: Using column `date` as input for `col_date`.
-# NOTE: Using column `patient_id` as input for `col_patient_id`.
-# NOTE: Using column `keyab` as input for `col_keyantibiotics`. Use col_keyantibiotics = FALSE to prevent this.
+# [34mNOTE: Using column `[1mbacteria[22m` as input for `col_mo`.[39m +# [34mNOTE: Using column `[1mbacteria[22m` as input for `col_mo`.[39m +# [34mNOTE: Using column `[1mdate[22m` as input for `col_date`.[39m +# [34mNOTE: Using column `[1mpatient_id[22m` as input for `col_patient_id`.[39m +# [34mNOTE: Using column `[1mkeyab[22m` as input for `col_keyantibiotics`. Use [1mcol_keyantibiotics = FALSE[22m to prevent this.[39m
@@ -641,10 +642,10 @@ Unique: 2

- - + + - + @@ -653,20 +654,20 @@ Unique: 2

- - + + - + - - + + @@ -677,35 +678,35 @@ Unique: 2

- - + + - + - + - - + + - - + + - - + + - - + + @@ -713,32 +714,32 @@ Unique: 2

- - + + - + - - + + - - + + - - + + @@ -749,23 +750,23 @@ Unique: 2

- - + + - - - - + + + + + -
isolate
12010-03-01R82010-03-16N1 B_ESCHR_COLIRS S S S
22010-04-16R82010-04-19N1 B_ESCHR_COLI S S S S FALSETRUEFALSE
32010-04-18R82010-06-26N1 B_ESCHR_COLI S S
42010-05-08R82010-07-17N1 B_ESCHR_COLIRS S S S FALSETRUEFALSE
52010-06-06R82010-09-14N1 B_ESCHR_COLI S SSSRR FALSE TRUE
62010-06-14R82010-09-23N1 B_ESCHR_COLIRRSS S S FALSE
72010-07-28R82010-12-14N1 B_ESCHR_COLI S S S S FALSETRUEFALSE
82010-07-31R82011-07-30N1 B_ESCHR_COLI S S S SFALSEFALSETRUETRUE
92010-08-25R82011-08-21N1 B_ESCHR_COLI S S
102010-09-30R82011-09-09N1 B_ESCHR_COLIRRRRSSSSFALSE FALSETRUE
-

Instead of 1, now 7 isolates are flagged. In total, 75.2% of all isolates are marked ‘first weighted’ - 46.9% more than when using the CLSI guideline. In real life, this novel algorithm will yield 5-10% more isolates than the classic CLSI guideline.

+

Instead of 2, now 4 isolates are flagged. In total, 75.4% of all isolates are marked ‘first weighted’ - 46.8% 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:

data_1st <- data %>%
   filter_first_weighted_isolate()
-

So we end up with 15,034 isolates for analysis.

+

So we end up with 15,085 isolates for analysis.

We can remove unneeded columns:

data_1st <- data_1st %>%
   select(-c(first, keyab))
@@ -773,6 +774,7 @@ Unique: 2

head(data_1st)
+ @@ -789,28 +791,14 @@ Unique: 2

- - - - - - - - - - - - - - - - - + + + - - + + @@ -818,43 +806,30 @@ Unique: 2

+ + + + + + + + + + + + + + + + - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -864,18 +839,51 @@ Unique: 2

- - - - - - + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -897,8 +905,8 @@ Unique: 2

data_1st %>% freq(genus, species)

Frequency table

Class: character
-Length: 15,034
-Available: 15,034 (100%, NA: 0 = 0%)
+Length: 15,085
+Available: 15,085 (100%, NA: 0 = 0%)
Unique: 4

Shortest: 16
Longest: 24

@@ -915,33 +923,33 @@ Longest: 24

- - - - + + + + - - - - + + + + - - - - + + + + - - - + + + @@ -953,7 +961,7 @@ Longest: 24

The functions resistance() and susceptibility() can be used to calculate antimicrobial resistance or susceptibility. For more specific analyses, the functions proportion_S(), proportion_SI(), proportion_I(), proportion_IR() and proportion_R() can be used to determine the proportion of a specific antimicrobial outcome.

As per the EUCAST guideline of 2019, we calculate resistance as the proportion of R (proportion_R(), equal to resistance()) and susceptibility as the proportion of S and I (proportion_SI(), equal to susceptibility()). These functions can be used on their own:

data_1st %>% resistance(AMX)
-# [1] 0.4703339
+# [1] 0.4658933

Or can be used in conjuction with group_by() and summarise(), both from the dplyr package:

data_1st %>%
   group_by(hospital) %>%
@@ -966,19 +974,19 @@ Longest: 24

- + - + - + - +
date patient_id hospital
2015-12-27Y9Hospital AB_ESCHR_COLIRRSSFGram-negativeEscherichiacoliTRUE
2014-01-17X1012013-06-23V9 Hospital C B_STPHY_AURSR SRSS S F Gram-positive aureus TRUE
22016-12-25S10Hospital DB_ESCHR_COLIRSSRFGram-negativeEscherichiacoliTRUE
2015-10-31I332011-01-27Z10 Hospital B B_ESCHR_COLI RSSSMGram-negativeEscherichiacoliTRUE
2014-10-30D9Hospital AB_ESCHR_COLISSSSMGram-negativeEscherichiacoliTRUE
2011-02-15P6Hospital DB_ESCHR_COLISSR S S F TRUE
2011-10-07G2Hospital CB_STPHY_AURSSS42010-09-14N1Hospital BB_ESCHR_COLI S SRR MGram-positiveStaphylococcusaureusGram-negativeEscherichiacoliTRUE
52017-10-31W1Hospital DB_KLBSL_PNMNRRRSFGram-negativeKlebsiellapneumoniaeTRUE
72010-03-02W2Hospital BB_ESCHR_COLISSSSFGram-negativeEscherichiacoli TRUE
1 Escherichia coli7,48649.79%7,48649.79%7,41849.17%7,41849.17%
2 Staphylococcus aureus3,72724.79%11,21374.58%3,71624.63%11,13473.81%
3 Streptococcus pneumoniae2,27315.12%13,48689.70%2,40415.94%13,53889.74%
4 Klebsiella pneumoniae1,54810.30%15,0341,54710.26%15,085 100.00%
Hospital A0.47609560.4701310
Hospital B0.47114090.4702970
Hospital C0.47009670.4575579
Hospital D0.46052200.4574359
@@ -996,23 +1004,23 @@ Longest: 24

Hospital A -0.4760956 -4518 +0.4701310 +4503 Hospital B -0.4711409 -5215 +0.4702970 +5454 Hospital C -0.4700967 -2274 +0.4575579 +2203 Hospital D -0.4605220 -3027 +0.4574359 +2925 @@ -1032,27 +1040,27 @@ Longest: 24

Escherichia -0.9181138 -0.8947368 -0.9927865 +0.9207334 +0.8959288 +0.9936641 Klebsiella -0.9153747 -0.8959948 -0.9948320 +0.9198449 +0.9004525 +0.9974144 Staphylococcus -0.9246042 -0.9203112 -0.9946338 +0.9203445 +0.9233046 +0.9938105 Streptococcus -0.6159261 +0.6110649 0.0000000 -0.6159261 +0.6110649 @@ -1180,7 +1188,7 @@ Longest: 24

-

Site built with pkgdown 1.5.0.

+

Site built with pkgdown 1.5.1.

diff --git a/docs/articles/AMR_files/figure-html/plot 1-1.png b/docs/articles/AMR_files/figure-html/plot 1-1.png index 5298c6f7..d405d2ae 100644 Binary files a/docs/articles/AMR_files/figure-html/plot 1-1.png and b/docs/articles/AMR_files/figure-html/plot 1-1.png differ diff --git a/docs/articles/AMR_files/figure-html/plot 3-1.png b/docs/articles/AMR_files/figure-html/plot 3-1.png index 5ad3aab9..0add7c50 100644 Binary files a/docs/articles/AMR_files/figure-html/plot 3-1.png and b/docs/articles/AMR_files/figure-html/plot 3-1.png differ diff --git a/docs/articles/AMR_files/figure-html/plot 4-1.png b/docs/articles/AMR_files/figure-html/plot 4-1.png index 5bf6110d..12e57e0d 100644 Binary files a/docs/articles/AMR_files/figure-html/plot 4-1.png and b/docs/articles/AMR_files/figure-html/plot 4-1.png differ diff --git a/docs/articles/AMR_files/figure-html/plot 5-1.png b/docs/articles/AMR_files/figure-html/plot 5-1.png index b8180a53..6f0e0fe8 100644 Binary files a/docs/articles/AMR_files/figure-html/plot 5-1.png and b/docs/articles/AMR_files/figure-html/plot 5-1.png differ diff --git a/docs/articles/benchmarks.html b/docs/articles/benchmarks.html index 4073a6e9..b6ffc3e1 100644 --- a/docs/articles/benchmarks.html +++ b/docs/articles/benchmarks.html @@ -39,7 +39,7 @@ AMR (for R) - 1.1.0 + 1.1.0.9009 @@ -186,7 +186,7 @@

Benchmarks

Matthijs S. Berends

-

15 April 2020

+

18 May 2020

Source: vignettes/benchmarks.Rmd @@ -196,13 +196,14 @@

One of the most important features of this package is the complete microbial taxonomic database, supplied by the Catalogue of Life. We created a function as.mo() that transforms any user input value to a valid microbial ID by using intelligent rules combined with the taxonomic tree of Catalogue of Life.

-

Using the microbenchmark package, we can review the calculation performance of this function. Its function microbenchmark() runs different input expressions independently of each other and measures their time-to-result.

-
library(microbenchmark)
-library(AMR)
+

Using the microbenchmark package, we can review the calculation performance of this function. Its function microbenchmark() runs different input expressions independently of each other and measures their time-to-result.

+
microbenchmark <- microbenchmark::microbenchmark
+library(AMR)
+library(dplyr)

In the next test, we try to ‘coerce’ different input values into the microbial code of Staphylococcus aureus. Coercion is a computational process of forcing output based on an input. For microorganism names, coercing user input to taxonomically valid microorganism names is crucial to ensure correct interpretation and to enable grouping based on taxonomic properties.

The actual result is the same every time: it returns its microorganism code B_STPHY_AURS (B stands for Bacteria, the taxonomic kingdom).

But the calculation time differs a lot:

-
S.aureus <- microbenchmark(
+
S.aureus <- microbenchmark(
   as.mo("sau"), # WHONET code
   as.mo("stau"),
   as.mo("STAU"),
@@ -220,25 +221,40 @@
   times = 10)
 print(S.aureus, unit = "ms", signif = 2)
 # Unit: milliseconds
-#                                   expr   min    lq mean median    uq max neval
-#                           as.mo("sau")  10.0  11.0   11   11.0  11.0  11    10
-#                          as.mo("stau")  39.0  43.0   54   44.0  70.0  72    10
-#                          as.mo("STAU")  43.0  44.0   52   47.0  68.0  71    10
-#                        as.mo("staaur")   9.6   9.8   11   11.0  12.0  13    10
-#                        as.mo("STAAUR")   9.6  11.0   17   11.0  11.0  45    10
-#                     as.mo("S. aureus")  15.0  17.0   26   18.0  43.0  50    10
-#                      as.mo("S aureus")  16.0  17.0   23   18.0  21.0  44    10
-#         as.mo("Staphylococcus aureus")   6.0   6.0   12    6.9   7.2  40    10
-#  as.mo("Staphylococcus aureus (MRSA)") 660.0 740.0  780  780.0 810.0 870    10
-#       as.mo("Sthafilokkockus aaureuz") 370.0 430.0  470  450.0 460.0 760    10
-#                          as.mo("MRSA")   9.5   9.6   13   11.0  11.0  35    10
-#                          as.mo("VISA")  25.0  26.0   38   30.0  50.0  58    10
-#                          as.mo("VRSA")  25.0  29.0   55   55.0  56.0 150    10
-#                        as.mo(22242419) 130.0 150.0  160  160.0 170.0 170    10
+# expr min lq mean median uq max +# as.mo("sau") 7.5 9.0 21.0 11.0 37.0 43.0 +# as.mo("stau") 130.0 130.0 170.0 170.0 180.0 280.0 +# as.mo("STAU") 130.0 140.0 150.0 150.0 170.0 180.0 +# as.mo("staaur") 7.3 9.7 13.0 11.0 11.0 37.0 +# as.mo("STAAUR") 7.3 9.2 13.0 9.8 10.0 45.0 +# as.mo("S. aureus") 10.0 11.0 23.0 12.0 12.0 120.0 +# as.mo("S aureus") 9.9 12.0 23.0 13.0 40.0 43.0 +# as.mo("Staphylococcus aureus") 5.7 6.4 7.4 7.2 8.8 9.5 +# as.mo("Staphylococcus aureus (MRSA)") 850.0 860.0 870.0 870.0 880.0 910.0 +# as.mo("Sthafilokkockus aaureuz") 330.0 350.0 360.0 360.0 370.0 390.0 +# as.mo("MRSA") 7.7 9.2 12.0 9.7 11.0 39.0 +# as.mo("VISA") 19.0 21.0 25.0 22.0 24.0 55.0 +# as.mo("VRSA") 18.0 22.0 30.0 25.0 26.0 57.0 +# as.mo(22242419) 140.0 150.0 170.0 150.0 190.0 210.0 +# neval +# 10 +# 10 +# 10 +# 10 +# 10 +# 10 +# 10 +# 10 +# 10 +# 10 +# 10 +# 10 +# 10 +# 10

In the table above, all measurements are shown in milliseconds (thousands of seconds). A value of 5 milliseconds means it can determine 200 input values per second. It case of 100 milliseconds, this is only 10 input values per second.

To achieve this speed, the as.mo function also takes into account the prevalence of human pathogenic microorganisms. The downside of this is of course that less prevalent microorganisms will be determined less fast. See this example for the ID of Methanosarcina semesiae (B_MTHNSR_SEMS), a bug probably never found before in humans:

-
M.semesiae <- microbenchmark(as.mo("metsem"),
+
M.semesiae <- microbenchmark(as.mo("metsem"),
                              as.mo("METSEM"),
                              as.mo("M. semesiae"),
                              as.mo("M.  semesiae"),
@@ -246,37 +262,37 @@
                              times = 10)
 print(M.semesiae, unit = "ms", signif = 4)
 # Unit: milliseconds
-#                              expr      min       lq     mean   median       uq
-#                   as.mo("metsem") 1629.000 1648.000 1694.000 1681.000 1734.000
-#                   as.mo("METSEM") 1577.000 1604.000 1675.000 1685.000 1700.000
-#              as.mo("M. semesiae")   17.390   17.470   26.150   18.020   43.560
-#             as.mo("M.  semesiae")   17.390   17.880   27.570   18.310   45.910
-#  as.mo("Methanosarcina semesiae")    6.988    7.067    7.443    7.262    7.733
-#       max neval
-#  1825.000    10
-#  1793.000    10
-#    48.390    10
-#    50.960    10
-#     8.381    10
-

That takes 5.6 times as much time on average. We can conclude that looking up arbitrary codes of less prevalent microorganisms is the worst way to go, in terms of calculation performance. Full names (like Methanosarcina semesiae) are always very fast and only take some thousands of seconds to coerce - they are the most probable input from most data sets.

+# expr min lq mean median uq +# as.mo("metsem") 146.500 150.900 173.300 183.300 191.800 +# as.mo("METSEM") 145.700 153.400 169.300 172.300 185.300 +# as.mo("M. semesiae") 8.586 8.790 9.909 10.140 10.250 +# as.mo("M. semesiae") 8.613 8.719 12.350 9.756 10.210 +# as.mo("Methanosarcina semesiae") 6.153 6.357 9.325 6.729 7.826 +# max neval +# 193.60 10 +# 187.40 10 +# 12.52 10 +# 38.46 10 +# 31.48 10
+

Looking up arbitrary codes of less prevalent microorganisms costs the most time. Full names (like Methanosarcina semesiae) are always very fast and only take some thousands of seconds to coerce - they are the most probable input from most data sets.

In the figure below, we compare Escherichia coli (which is very common) with Prevotella brevis (which is moderately common) and with Methanosarcina semesiae (which is uncommon):

-

Uncommon microorganisms take a lot more time than common microorganisms. To relieve this pitfall and further improve performance, two important calculations take almost no time at all: repetitive results and already precalculated results.

+

Uncommon microorganisms take some more time than common microorganisms. To further improve performance, two important calculations take almost no time at all: repetitive results and already precalculated results.

Repetitive results

Repetitive results are unique values that are present more than once. Unique values will only be calculated once by as.mo(). We will use mo_name() for this test - a helper function that returns the full microbial name (genus, species and possibly subspecies) which uses as.mo() internally.

-
library(dplyr)
-# take all MO codes from the example_isolates data set
+
library(dplyr)
+
# take all MO codes from the example_isolates data set
 x <- example_isolates$mo %>%
   # keep only the unique ones
   unique() %>%
   # pick 50 of them at random
-  sample(50) %>%
+  sample(50) %>%
   # paste that 10,000 times
   rep(10000) %>%
   # scramble it
-  sample()
+  sample()
 
 # got indeed 50 times 10,000 = half a million?
 length(x)
@@ -287,30 +303,30 @@
 # [1] 50
 
 # now let's see:
-run_it <- microbenchmark(mo_name(x),
-                         times = 100)
+run_it <- microbenchmark(mo_name(x),
+                         times = 10)
 print(run_it, unit = "ms", signif = 3)
 # Unit: milliseconds
 #        expr  min   lq mean median   uq  max neval
-#  mo_name(x) 1730 1790 1830   1810 1860 2030   100
-

So transforming 500,000 values (!!) of 50 unique values only takes 1.81 seconds (1814 ms). You only lose time on your unique input values.

+# mo_name(x) 1660 1700 1760 1750 1810 1910 10
+

So transforming 500,000 values (!!) of 50 unique values only takes 1.75 seconds. You only lose time on your unique input values.

Precalculated results

What about precalculated results? If the input is an already precalculated result of a helper function like mo_name(), it almost doesn’t take any time at all (see ‘C’ below):

-
run_it <- microbenchmark(A = mo_name("B_STPHY_AURS"),
+
run_it <- microbenchmark(A = mo_name("B_STPHY_AURS"),
                          B = mo_name("S. aureus"),
                          C = mo_name("Staphylococcus aureus"),
                          times = 10)
 print(run_it, unit = "ms", signif = 3)
 # Unit: milliseconds
-#  expr   min     lq   mean median     uq    max neval
-#     A  7.26  7.390  8.020  7.450  7.500 11.100    10
-#     B 15.30 15.700 20.500 15.800 17.000 56.300    10
-#     C  0.58  0.718  0.735  0.726  0.747  0.927    10
-

So going from mo_name("Staphylococcus aureus") to "Staphylococcus aureus" takes 0.0007 seconds - it doesn’t even start calculating if the result would be the same as the expected resulting value. That goes for all helper functions:

-
run_it <- microbenchmark(A = mo_species("aureus"),
+#  expr   min    lq  mean median     uq    max neval
+#     A 5.650 6.030  6.36  6.430  6.660  7.130    10
+#     B 9.860 9.890 14.20 10.900 11.200 46.300    10
+#     C 0.232 0.237  0.30  0.302  0.355  0.369    10
+

So going from mo_name("Staphylococcus aureus") to "Staphylococcus aureus" takes 0.0003 seconds - it doesn’t even start calculating if the result would be the same as the expected resulting value. That goes for all helper functions:

+
run_it <- microbenchmark(A = mo_species("aureus"),
                          B = mo_genus("Staphylococcus"),
                          C = mo_name("Staphylococcus aureus"),
                          D = mo_family("Staphylococcaceae"),
@@ -322,21 +338,21 @@
 print(run_it, unit = "ms", signif = 3)
 # Unit: milliseconds
 #  expr   min    lq  mean median    uq   max neval
-#     A 0.380 0.386 0.397  0.394 0.397 0.434    10
-#     B 0.413 0.417 0.444  0.424 0.430 0.627    10
-#     C 0.574 0.680 0.707  0.730 0.735 0.776    10
-#     D 0.407 0.419 0.430  0.430 0.435 0.470    10
-#     E 0.374 0.381 0.401  0.397 0.424 0.438    10
-#     F 0.366 0.380 0.389  0.387 0.395 0.422    10
-#     G 0.367 0.377 0.388  0.383 0.392 0.420    10
-#     H 0.368 0.374 0.386  0.382 0.390 0.430    10
+# A 0.209 0.214 0.229 0.221 0.229 0.299 10 +# B 0.199 0.206 0.225 0.209 0.214 0.373 10 +# C 0.201 0.207 0.217 0.213 0.222 0.247 10 +# D 0.200 0.203 0.214 0.206 0.222 0.266 10 +# E 0.200 0.200 0.213 0.209 0.216 0.264 10 +# F 0.195 0.205 0.216 0.207 0.217 0.284 10 +# G 0.191 0.194 0.206 0.203 0.206 0.261 10 +# H 0.190 0.195 0.205 0.198 0.209 0.256 10

Of course, when running mo_phylum("Firmicutes") the function has zero knowledge about the actual microorganism, namely S. aureus. But since the result would be "Firmicutes" anyway, there is no point in calculating the result. And because this package ‘knows’ all phyla of all known bacteria (according to the Catalogue of Life), it can just return the initial value immediately.

Results in other languages

When the system language is non-English and supported by this AMR package, some functions will have a translated result. This almost does’t take extra time:

-
mo_name("CoNS", language = "en") # or just mo_name("CoNS") on an English system
+
mo_name("CoNS", language = "en") # or just mo_name("CoNS") on an English system
 # [1] "Coagulase-negative Staphylococcus (CoNS)"
 
 mo_name("CoNS", language = "es") # or just mo_name("CoNS") on a Spanish system
@@ -345,7 +361,7 @@
 mo_name("CoNS", language = "nl") # or just mo_name("CoNS") on a Dutch system
 # [1] "Coagulase-negatieve Staphylococcus (CNS)"
 
-run_it <- microbenchmark(en = mo_name("CoNS", language = "en"),
+run_it <- microbenchmark(en = mo_name("CoNS", language = "en"),
                          de = mo_name("CoNS", language = "de"),
                          nl = mo_name("CoNS", language = "nl"),
                          es = mo_name("CoNS", language = "es"),
@@ -356,13 +372,13 @@
 print(run_it, unit = "ms", signif = 4)
 # Unit: milliseconds
 #  expr   min    lq  mean median    uq    max neval
-#    en 26.72 28.52 32.86  29.31 30.18  69.18   100
-#    de 27.86 30.67 40.23  31.44 46.42 170.40   100
-#    nl 34.45 36.94 44.89  37.95 40.54  76.41   100
-#    es 27.89 30.51 38.46  31.33 32.89 170.10   100
-#    it 29.15 30.37 35.85  31.04 32.39  65.33   100
-#    fr 28.18 30.37 35.80  31.11 32.25  78.14   100
-#    pt 28.23 30.55 36.89  31.32 32.77  67.79   100
+# en 20.58 21.00 24.57 21.31 21.81 65.96 100 +# de 21.28 21.81 25.34 22.15 22.73 62.52 100 +# nl 25.15 25.68 32.14 26.03 27.25 167.40 100 +# es 21.35 21.78 27.39 22.14 23.29 67.97 100 +# it 21.42 21.83 26.19 22.31 22.84 71.71 100 +# fr 21.43 21.82 27.43 22.25 23.39 69.29 100 +# pt 21.42 21.92 28.71 22.23 22.89 187.40 100

Currently supported are German, Dutch, Spanish, Italian, French and Portuguese.

@@ -380,7 +396,7 @@
-

Site built with pkgdown 1.5.0.

+

Site built with pkgdown 1.5.1.

diff --git a/docs/articles/benchmarks_files/figure-html/unnamed-chunk-4-1.png b/docs/articles/benchmarks_files/figure-html/unnamed-chunk-4-1.png index b5ad771d..0cc40cb2 100644 Binary files a/docs/articles/benchmarks_files/figure-html/unnamed-chunk-4-1.png and b/docs/articles/benchmarks_files/figure-html/unnamed-chunk-4-1.png differ diff --git a/docs/articles/benchmarks_files/figure-html/unnamed-chunk-6-1.png b/docs/articles/benchmarks_files/figure-html/unnamed-chunk-6-1.png index 79fffe0b..f7c50996 100644 Binary files a/docs/articles/benchmarks_files/figure-html/unnamed-chunk-6-1.png and b/docs/articles/benchmarks_files/figure-html/unnamed-chunk-6-1.png differ diff --git a/docs/articles/index.html b/docs/articles/index.html index 1128d471..77e4bc0c 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.1.0.9008 + 1.1.0.9009 diff --git a/docs/authors.html b/docs/authors.html index 0f730c88..035c6214 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -81,7 +81,7 @@ AMR (for R) - 1.1.0.9008 + 1.1.0.9009 diff --git a/docs/index.html b/docs/index.html index 9a0757ad..fa6f87f6 100644 --- a/docs/index.html +++ b/docs/index.html @@ -43,7 +43,7 @@ AMR (for R) - 1.1.0.9008 + 1.1.0.9009 diff --git a/docs/news/index.html b/docs/news/index.html index b28dece7..c9f7e405 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.1.0.9006 + 1.1.0.9009 @@ -229,13 +229,13 @@ Source: NEWS.md -
-

-AMR 1.1.0.9006 Unreleased +
+

+AMR 1.1.0.9009 Unreleased

-
+

-Last updated: 16-May-2020 +Last updated: 18-May-2020

diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index c46a3056..17cb6404 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -10,7 +10,7 @@ articles: WHONET: WHONET.html benchmarks: benchmarks.html resistance_predict: resistance_predict.html -last_built: 2020-05-17T09:54Z +last_built: 2020-05-18T08:29Z urls: reference: https://msberends.gitlab.io/AMR/reference article: https://msberends.gitlab.io/AMR/articles diff --git a/docs/reference/first_isolate.html b/docs/reference/first_isolate.html index 1721fb2c..5b019f91 100644 --- a/docs/reference/first_isolate.html +++ b/docs/reference/first_isolate.html @@ -82,7 +82,7 @@ AMR (for R) - 1.1.0.9004 + 1.1.0.9009

@@ -362,17 +362,14 @@

WHY THIS IS SO IMPORTANT
To conduct an analysis of antimicrobial resistance, you should only include the first isolate of every patient per episode (ref). 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 week. The resistance percentage of oxacillin of all S. aureus isolates would be overestimated, because you included this MRSA more than once. It would be selection bias.

All isolates with a microbial ID of NA will be excluded as first isolate.

-

The functions filter_first_isolate() and filter_first_weighted_isolate() are helper functions to quickly filter on first isolates. The function filter_first_isolate() is essentially equal to:

 x %&gt;%
-   mutate(only_firsts = first_isolate(x, ...)) %&gt;%
-   filter(only_firsts == TRUE) %&gt;%
-   select(-only_firsts)
+

The functions filter_first_isolate() and filter_first_weighted_isolate() are helper functions to quickly filter on first isolates. The function filter_first_isolate() is essentially equal to one of:

 x %&gt;% filter(first_isolate(., ...))

The function filter_first_weighted_isolate() is essentially equal to:

 x %&gt;%
    mutate(keyab = key_antibiotics(.)) %&gt;%
    mutate(only_weighted_firsts = first_isolate(x,
                                                col_keyantibiotics = "keyab", ...)) %&gt;%
    filter(only_weighted_firsts == TRUE) %&gt;%
-   select(-only_weighted_firsts)
+ select(-only_weighted_firsts, -keyab)

Key antibiotics

diff --git a/docs/reference/index.html b/docs/reference/index.html index 299c6400..c5ef9bb9 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.1.0.9008 + 1.1.0.9009
diff --git a/man/first_isolate.Rd b/man/first_isolate.Rd index d6eab0d2..01a8334a 100755 --- a/man/first_isolate.Rd +++ b/man/first_isolate.Rd @@ -98,10 +98,7 @@ To conduct an analysis of antimicrobial resistance, you should only include the All isolates with a microbial ID of \code{NA} will be excluded as first isolate. -The functions \code{\link[=filter_first_isolate]{filter_first_isolate()}} and \code{\link[=filter_first_weighted_isolate]{filter_first_weighted_isolate()}} are helper functions to quickly filter on first isolates. The function \code{\link[=filter_first_isolate]{filter_first_isolate()}} is essentially equal to:\preformatted{ x \%>\% - mutate(only_firsts = first_isolate(x, ...)) \%>\% - filter(only_firsts == TRUE) \%>\% - select(-only_firsts) +The functions \code{\link[=filter_first_isolate]{filter_first_isolate()}} and \code{\link[=filter_first_weighted_isolate]{filter_first_weighted_isolate()}} are helper functions to quickly filter on first isolates. The function \code{\link[=filter_first_isolate]{filter_first_isolate()}} is essentially equal to one of:\preformatted{ x \%>\% filter(first_isolate(., ...)) } The function \code{\link[=filter_first_weighted_isolate]{filter_first_weighted_isolate()}} is essentially equal to:\preformatted{ x \%>\% @@ -109,7 +106,7 @@ The function \code{\link[=filter_first_weighted_isolate]{filter_first_weighted_i mutate(only_weighted_firsts = first_isolate(x, col_keyantibiotics = "keyab", ...)) \%>\% filter(only_weighted_firsts == TRUE) \%>\% - select(-only_weighted_firsts) + select(-only_weighted_firsts, -keyab) } } \section{Key antibiotics}{ diff --git a/tests/appveyor/appveyor_tool.ps1 b/tests/appveyor/appveyor_tool.ps1 index 6912c0f4..7badcc07 100644 --- a/tests/appveyor/appveyor_tool.ps1 +++ b/tests/appveyor/appveyor_tool.ps1 @@ -191,7 +191,7 @@ Function Bootstrap { } Progress "Downloading and installing travis-tool.sh" - cp "tests\appveyor\travis_tool.sh" "..\travis_tool.sh" + cp "tests\appveyor\travis_tool.sh" "..\travis-tool.sh" # Invoke-WebRequest https://raw.githubusercontent.com/krlmlr/r-appveyor/master/r-travis/scripts/travis-tool.sh -OutFile "..\travis-tool.sh" echo '@bash.exe ../travis-tool.sh %*' | Out-File -Encoding ASCII .\travis-tool.sh.cmd cat .\travis-tool.sh.cmd diff --git a/tests/testthat/test-first_isolate.R b/tests/testthat/test-first_isolate.R index eff0ff19..edb67752 100755 --- a/tests/testthat/test-first_isolate.R +++ b/tests/testthat/test-first_isolate.R @@ -188,5 +188,13 @@ test_that("first isolates work", { test_unknown$mo <- ifelse(test_unknown$mo == "UNKNOWN", NA, test_unknown$mo) expect_equal(sum(first_isolate(test_unknown)), 1062) - + + # shortcuts + expect_identical(filter_first_isolate(example_isolates), + subset(example_isolates, first_isolate(example_isolates))) + ex <- example_isolates + ex$keyab <- key_antibiotics(ex) + expect_identical(filter_first_weighted_isolate(example_isolates), + subset(example_isolates, first_isolate(ex))) + }) diff --git a/vignettes/AMR.Rmd b/vignettes/AMR.Rmd index 48a26dbb..0b30566e 100755 --- a/vignettes/AMR.Rmd +++ b/vignettes/AMR.Rmd @@ -30,7 +30,7 @@ knitr::opts_chunk$set( Conducting antimicrobial resistance analysis unfortunately requires in-depth knowledge from different scientific fields, which makes it hard to do right. At least, it requires: -* Good questions (always start with these!) +* Good questions (always start with those!) * A thorough understanding of (clinical) epidemiology, to understand the clinical and epidemiological relevance and possible bias of results * A thorough understanding of (clinical) microbiology/infectious diseases, to understand which microorganisms are causal to which infections and the implications of pharmaceutical treatment, as well as understanding intrinsic and acquired microbial resistance * Experience with data analysis with microbiological tests and their results, to understand the determination and limitations of MIC values and their interpretations to RSI values diff --git a/vignettes/benchmarks.Rmd b/vignettes/benchmarks.Rmd index f9f3c5d2..3c157085 100755 --- a/vignettes/benchmarks.Rmd +++ b/vignettes/benchmarks.Rmd @@ -54,6 +54,7 @@ ggplot.bm <- function(df, title = NULL) { ```{r, message = FALSE} microbenchmark <- microbenchmark::microbenchmark library(AMR) +library(dplyr) ``` In the next test, we try to 'coerce' different input values into the microbial code of *Staphylococcus aureus*. Coercion is a computational process of forcing output based on an input. For microorganism names, coercing user input to taxonomically valid microorganism names is crucial to ensure correct interpretation and to enable grouping based on taxonomic properties.