diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 94a609b1..8c023b03 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -56,16 +56,18 @@ jobs: - {os: windows-latest, r: 'devel', allowfail: false} - {os: windows-latest, r: 'release', allowfail: false} - {os: windows-latest, r: 'oldrel', allowfail: false} - - {os: ubuntu-16.04, r: 'devel', allowfail: true, rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} + - {os: ubuntu-16.04, r: 'devel', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} - {os: ubuntu-16.04, r: 'release', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} - - {os: ubuntu-16.04, r: 'oldrel', allowfail: true, rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} + - {os: ubuntu-16.04, r: 'oldrel', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} - {os: ubuntu-16.04, r: '4.0', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} - {os: ubuntu-16.04, r: '3.6', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} - {os: ubuntu-16.04, r: '3.5', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} - - {os: ubuntu-16.04, r: '3.4', allowfail: true, rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} - - {os: ubuntu-16.04, r: '3.3', allowfail: true, rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} - # - {os: ubuntu-16.04, r: '3.2', allowfail: true, rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} - # older R versions cannot be tested, since tidyverse only supports last 4 R x.x versions + - {os: ubuntu-16.04, r: '3.4', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} + - {os: ubuntu-16.04, r: '3.3', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} + - {os: ubuntu-16.04, r: '3.2', allowfail: true, rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} + - {os: ubuntu-16.04, r: '3.1', allowfail: true, rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} + - {os: ubuntu-16.04, r: '3.0', allowfail: true, rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} + env: R_REMOTES_NO_ERRORS_FROM_WARNINGS: true RSPM: ${{ matrix.config.rspm }} @@ -80,13 +82,14 @@ jobs: - uses: r-lib/actions/setup-pandoc@master - name: Query dependencies + if: matrix.config.r != '3.0' && matrix.config.r != '3.1' && matrix.config.r != '3.2' run: | install.packages('remotes') saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) shell: Rscript {0} - name: Cache R packages - if: runner.os != 'Windows' + if: runner.os != 'Windows' && matrix.config.r != '3.0' && matrix.config.r != '3.1' && matrix.config.r != '3.2' uses: actions/cache@v1 with: path: ${{ env.R_LIBS_USER }} @@ -94,7 +97,7 @@ jobs: restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}-3- - name: Install Linux dependencies - if: runner.os == 'Linux' + if: runner.os == 'Linux' && matrix.config.r != '3.0' && matrix.config.r != '3.1' && matrix.config.r != '3.2' env: RHUB_PLATFORM: linux-x86_64-ubuntu-gcc run: | @@ -108,6 +111,7 @@ jobs: brew install mariadb-connector-c - name: Install dependencies + if: matrix.config.r != '3.0' && matrix.config.r != '3.1' && matrix.config.r != '3.2' run: | remotes::install_deps(dependencies = TRUE) remotes::install_cran("rcmdcheck") @@ -116,15 +120,25 @@ jobs: - name: Session info run: | options(width = 100) - pkgs <- installed.packages()[, "Package"] - sessioninfo::session_info(pkgs, include_base = TRUE) + utils::sessionInfo() + as.data.frame(utils::installed.packages())[, "Version", drop = FALSE] shell: Rscript {0} - name: Run R CMD check + if: matrix.config.r != '3.0' && matrix.config.r != '3.1' && matrix.config.r != '3.2' env: _R_CHECK_CRAN_INCOMING_: false run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") shell: Rscript {0} + + - name: Run R CMD check on older R versions + if: matrix.config.r == '3.0' || matrix.config.r == '3.1' || matrix.config.r == '3.2' + env: + _R_CHECK_CRAN_INCOMING_: false + _R_CHECK_FORCE_SUGGESTS_: false + run: | + ls -lh + R CMD check data-raw/AMR_*.tar.gz - name: Show testthat output if: always() diff --git a/DESCRIPTION b/DESCRIPTION index e40deb16..982cbec9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 1.4.0.9052 -Date: 2020-12-28 +Version: 1.4.0.9053 +Date: 2020-12-29 Title: Antimicrobial Resistance Analysis Authors@R: c( person(role = c("aut", "cre"), diff --git a/NEWS.md b/NEWS.md index 3adf7533..0c10e5a8 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,5 @@ -# AMR 1.4.0.9052 -## Last updated: 28 December 2020 +# AMR 1.4.0.9053 +## Last updated: 29 December 2020 ### New * Functions `get_episode()` and `is_new_episode()` to determine (patient) episodes which are not necessarily based on microorganisms. The `get_episode()` function returns the index number of the episode per group, while the `is_new_episode()` function returns values `TRUE`/`FALSE` to indicate whether an item in a vector is the start of a new episode. They also support `dplyr`s grouping (i.e. using `group_by()`): diff --git a/R/ab_from_text.R b/R/ab_from_text.R index 948922da..813472e8 100644 --- a/R/ab_from_text.R +++ b/R/ab_from_text.R @@ -33,7 +33,7 @@ #' @param translate_ab if `type = "drug"`: a column name of the [antibiotics] data set to translate the antibiotic abbreviations to, using [ab_property()]. Defaults to `FALSE`. Using `TRUE` is equal to using "name". #' @param thorough_search logical to indicate whether the input must be extensively searched for misspelling and other faulty input values. Setting this to `TRUE` will take considerably more time than when using `FALSE`. At default, it will turn `TRUE` when all input elements contain a maximum of three words. #' @param ... arguments passed on to [as.ab()] -#' @details This function is also internally used by [as.ab()], although it then only searches for the first drug name and will throw a note if more drug names could have been returned. +#' @details This function is also internally used by [as.ab()], although it then only searches for the first drug name and will throw a note if more drug names could have been returned. Note: the [as.ab()] function may use very long regular expression to match brand names of antimicrobial agents. This may fail on some systems. #' #' ## Argument `type` #' At default, the function will search for antimicrobial drug names. All text elements will be searched for official names, ATC codes and brand names. As it uses [as.ab()] internally, it will correct for misspelling. diff --git a/R/mo.R b/R/mo.R index b90954a0..4aeaf127 100755 --- a/R/mo.R +++ b/R/mo.R @@ -2006,5 +2006,3 @@ repair_reference_df <- function(reference_df) { reference_df[, "mo"] <- as.mo(reference_df[, "mo", drop = TRUE]) reference_df } - -pkg_env <- new.env(hash = FALSE) diff --git a/R/mo_property.R b/R/mo_property.R index 6599ca3d..9ddbb4dd 100755 --- a/R/mo_property.R +++ b/R/mo_property.R @@ -433,12 +433,11 @@ mo_is_intrinsic_resistant <- function(x, ab, language = get_locale(), ...) { stop_("length of `x` and `ab` must be equal, or one of them must be of length 1.") } - # show used version number once per session - if (is.null(getOption("AMR_intrinsic_resistance_note", NULL))) { + # show used version number once + if (message_not_thrown_before("intrinsic_resistant_version")) { message_("Determining intrinsic resistance based on ", - format_eucast_version_nr(3.2, FALSE), ". ", - font_bold("This note is shown only once per session.")) - options(AMR_intrinsic_resistance_note = "shown") + format_eucast_version_nr(3.2, markdown = FALSE), ".") + remember_thrown_message("intrinsic_resistant_version") } # runs against internal vector: INTRINSIC_R (see zzz.R) diff --git a/R/zzz.R b/R/zzz.R index ef6fd486..4f75c05f 100755 --- a/R/zzz.R +++ b/R/zzz.R @@ -23,6 +23,9 @@ # how to conduct AMR analysis: https://msberends.github.io/AMR/ # # ==================================================================== # +# set up package environment, used by numerous AMR functions +pkg_env <- new.env(hash = FALSE) + .onLoad <- function(libname, pkgname) { assign(x = "AB_lookup", diff --git a/README.md b/README.md index efeca949..9357c481 100755 --- a/README.md +++ b/README.md @@ -2,8 +2,11 @@ # `AMR` (for R) -[![CRAN_Badge](https://www.r-pkg.org/badges/version-ago/AMR)](https://cran.R-project.org/package=AMR) [![CRAN_Downloads](https://cranlogs.r-pkg.org/badges/grand-total/AMR)](https://cran.R-project.org/package=AMR) -[![CodeCov](https://codecov.io/gh/msberends/AMR/branch/master/graph/badge.svg)](https://codecov.io/gh/msberends/AMR/branch/master) +[![CRAN](https://www.r-pkg.org/badges/version-ago/AMR)](https://cran.r-project.org/package=AMR) +[![CRANlogs](https://cranlogs.r-pkg.org/badges/grand-total/AMR)](https://cran.r-project.org/package=AMR) +![R-code-check](https://github.com/msberends/AMR/workflows/R-code-check/badge.svg?branch=master) +[![CodeFactor](https://www.codefactor.io/repository/github/msberends/amr/badge)](https://www.codefactor.io/repository/github/msberends/amr) +[![Codecov](https://codecov.io/gh/msberends/AMR/branch/master/graph/badge.svg)](https://codecov.io/gh/msberends/AMR?branch=master) diff --git a/data-raw/AMR_1.4.0.9053.tar.gz b/data-raw/AMR_1.4.0.9053.tar.gz new file mode 100644 index 00000000..c6ed62df Binary files /dev/null and b/data-raw/AMR_1.4.0.9053.tar.gz differ diff --git a/docs/404.html b/docs/404.html index e87d8651..98cbe37e 100644 --- a/docs/404.html +++ b/docs/404.html @@ -81,7 +81,7 @@
diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index c139382d..bc166182 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -81,7 +81,7 @@ diff --git a/docs/articles/AMR.html b/docs/articles/AMR.html index 1b29aeb1..2386ed8a 100644 --- a/docs/articles/AMR.html +++ b/docs/articles/AMR.html @@ -39,7 +39,7 @@ @@ -193,7 +193,7 @@vignettes/AMR.Rmd
AMR.Rmd
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 26 December 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 29 December 2020.
So only 28.4% is suitable for resistance analysis! We can now filter on it with the filter()
function, also from the dplyr
package:
So only 28.3% 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)
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 F3, 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 Z4, sorted on date:
isolate | @@ -531,43 +531,43 @@ Longest: 1|||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | -2010-01-17 | -F3 | +2010-07-01 | +Z4 | B_ESCHR_COLI | S | S | -R | -R | +S | +S | TRUE | |
2 | -2010-03-13 | -F3 | +2010-08-01 | +Z4 | B_ESCHR_COLI | +I | S | -S | -S | +R | S | FALSE | |
3 | -2010-04-21 | -F3 | +2010-08-18 | +Z4 | B_ESCHR_COLI | R | -S | +I | R | S | FALSE | ||
4 | -2010-06-24 | -F3 | +2010-10-16 | +Z4 | B_ESCHR_COLI | -S | +R | S | S | S | @@ -575,19 +575,19 @@ Longest: 1|||
5 | -2010-08-02 | -F3 | +2010-12-23 | +Z4 | B_ESCHR_COLI | +R | S | S | -S | -S | +R | FALSE | |
6 | -2010-08-14 | -F3 | +2010-12-25 | +Z4 | B_ESCHR_COLI | S | S | @@ -597,51 +597,51 @@ Longest: 1||||||
7 | -2010-10-06 | -F3 | +2011-01-07 | +Z4 | B_ESCHR_COLI | -S | -S | -S | +R | +R | +R | S | FALSE |
8 | -2010-10-17 | -F3 | +2011-01-30 | +Z4 | B_ESCHR_COLI | R | -R | +S | S | S | FALSE | ||
9 | -2010-11-17 | -F3 | +2011-05-19 | +Z4 | B_ESCHR_COLI | -R | -I | S | S | +R | +S | FALSE | |
10 | -2011-02-21 | -F3 | +2011-06-21 | +Z4 | B_ESCHR_COLI | -R | -R | +S | S | R | -TRUE | +S | +FALSE |
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.
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.
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 %>%
@@ -665,46 +665,46 @@ Longest: 1
1
-2010-01-17
-F3
+2010-07-01
+Z4
B_ESCHR_COLI
S
S
-R
-R
+S
+S
TRUE
TRUE
2
-2010-03-13
-F3
+2010-08-01
+Z4
B_ESCHR_COLI
+I
S
-S
-S
+R
S
FALSE
TRUE
3
-2010-04-21
-F3
+2010-08-18
+Z4
B_ESCHR_COLI
R
-S
+I
R
S
FALSE
-TRUE
+FALSE
4
-2010-06-24
-F3
+2010-10-16
+Z4
B_ESCHR_COLI
-S
+R
S
S
S
@@ -713,47 +713,47 @@ Longest: 1
5
-2010-08-02
-F3
+2010-12-23
+Z4
B_ESCHR_COLI
+R
S
S
-S
-S
-FALSE
+R
FALSE
+TRUE
6
-2010-08-14
-F3
+2010-12-25
+Z4
B_ESCHR_COLI
S
S
S
S
FALSE
-FALSE
+TRUE
7
-2010-10-06
-F3
+2011-01-07
+Z4
B_ESCHR_COLI
-S
-S
-S
+R
+R
+R
S
FALSE
-FALSE
+TRUE
8
-2010-10-17
-F3
+2011-01-30
+Z4
B_ESCHR_COLI
R
-R
+S
S
S
FALSE
@@ -761,36 +761,36 @@ Longest: 1
9
-2010-11-17
-F3
+2011-05-19
+Z4
B_ESCHR_COLI
+S
+S
R
-I
-S
S
FALSE
-FALSE
+TRUE
10
-2011-02-21
-F3
+2011-06-21
+Z4
B_ESCHR_COLI
-R
-R
+S
S
R
-TRUE
-TRUE
+S
+FALSE
+FALSE
-Instead of 2, now 6 isolates are flagged. In total, 78.5% of all isolates are marked ‘first weighted’ - 50.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.
+Instead of 1, now 8 isolates are flagged. In total, 79.0% of all isolates are marked ‘first weighted’ - 50.7% 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,695 isolates for analysis.
+So we end up with 15,805 isolates for analysis.
We can remove unneeded columns:
data_1st <- data_1st %>%
@@ -800,7 +800,6 @@ Longest: 1
head(data_1st)
-
@@ -816,7 +815,6 @@ Longest: 1
-
date
patient_id
hospital
@@ -833,10 +831,9 @@ Longest: 1
-1
-2011-10-28
-I1
-Hospital A
+2014-02-24
+H4
+Hospital D
B_STPHY_AURS
R
S
@@ -849,9 +846,38 @@ Longest: 1
TRUE
-2
-2011-06-05
-G5
+2017-04-27
+Q3
+Hospital B
+B_STPHY_AURS
+R
+R
+R
+S
+F
+Gram-positive
+Staphylococcus
+aureus
+TRUE
+
+
+2013-03-12
+Q4
+Hospital B
+B_ESCHR_COLI
+S
+S
+R
+S
+F
+Gram-negative
+Escherichia
+coli
+TRUE
+
+
+2013-03-24
+H9
Hospital A
B_ESCHR_COLI
R
@@ -865,67 +891,33 @@ Longest: 1
TRUE
-3
-2014-05-12
-X7
-Hospital D
+2017-03-11
+M1
+Hospital A
B_STRPT_PNMN
-S
-S
R
R
-F
+S
+R
+M
Gram-positive
Streptococcus
pneumoniae
TRUE
-4
-2011-02-23
-K5
+2011-12-21
+M5
Hospital A
-B_STPHY_AURS
+B_STRPT_PNMN
S
S
S
-S
-M
-Gram-positive
-Staphylococcus
-aureus
-TRUE
-
-
-5
-2017-09-20
-T5
-Hospital B
-B_ESCHR_COLI
-S
-S
R
-S
-F
-Gram-negative
-Escherichia
-coli
-TRUE
-
-
-7
-2017-12-17
-Z3
-Hospital B
-B_ESCHR_COLI
-S
-S
-S
-S
-F
-Gram-negative
-Escherichia
-coli
+M
+Gram-positive
+Streptococcus
+pneumoniae
TRUE
@@ -949,8 +941,8 @@ Longest: 1
data_1st %>% freq(genus, species)
Frequency table
Class: character
-Length: 15,695
-Available: 15,695 (100%, NA: 0 = 0%)
+Length: 15,805
+Available: 15,805 (100%, NA: 0 = 0%)
Unique: 4
Shortest: 16
Longest: 24
@@ -968,32 +960,32 @@ Longest: 24
1
Escherichia coli
7,828
-49.88%
+49.53%
7,828
-49.88%
+49.53%
2
Staphylococcus aureus
-3,977
-25.34%
-11,805
-75.22%
+3,963
+25.07%
+11,791
+74.60%
3
Streptococcus pneumoniae
-2,320
-14.78%
-14,125
-90.00%
+2,392
+15.13%
+14,183
+89.74%
4
Klebsiella pneumoniae
-1,570
-10.00%
-15,695
+1,622
+10.26%
+15,805
100.00%
@@ -1020,33 +1012,33 @@ Longest: 24
E. coli
AMX
-3731
-275
-3822
+3777
+245
+3806
7828
E. coli
AMC
-6146
-297
-1385
+6159
+278
+1391
7828
E. coli
CIP
-5918
+5997
0
-1910
+1831
7828
E. coli
GEN
-7087
+6984
0
-741
+844
7828
@@ -1054,16 +1046,16 @@ Longest: 24
AMX
0
0
-1570
-1570
+1622
+1622
K. pneumoniae
AMC
-1231
-57
-282
-1570
+1271
+63
+288
+1622
@@ -1072,7 +1064,7 @@ Longest: 24
data_1st %>%
select(bacteria, fluoroquinolones()) %>%
bug_drug_combinations()
# Selecting fluoroquinolones: 'CIP' (ciprofloxacin)
+# Selecting fluoroquinolones: column 'CIP' (ciprofloxacin)
mo | @@ -1086,34 +1078,34 @@ Longest: 24||||||||
---|---|---|---|---|---|---|---|---|
E. coli | CIP | -5918 | +5997 | 0 | -1910 | +1831 | 7828 | |
K. pneumoniae | CIP | -1191 | +1266 | 0 | -379 | -1570 | +356 | +1622 |
S. aureus | CIP | -3045 | +3017 | 0 | -932 | -3977 | +946 | +3963 |
S. pneumoniae | CIP | -1785 | +1844 | 0 | -535 | -2320 | +548 | +2392 |
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.536604
Or can be used in conjuction with group_by()
and summarise()
, both from the dplyr
package:
data_1st %>%
@@ -1141,19 +1133,19 @@ Longest: 24
Hospital A
-0.5429950
+0.5273258
Hospital B
-0.5429998
+0.5421512
Hospital C
-0.5283993
+0.5394139
Hospital D
-0.5222153
+0.5350195
@@ -1173,23 +1165,23 @@ Longest: 24
Hospital A
-0.5429950
-4768
+0.5273258
+4794
Hospital B
-0.5429998
-5407
+0.5421512
+5504
Hospital C
-0.5283993
-2324
+0.5394139
+2423
Hospital D
-0.5222153
-3196
+0.5350195
+3084
@@ -1211,27 +1203,27 @@ Longest: 24
Escherichia
-0.8230710
-0.9053398
-0.9872253
+0.8223045
+0.8921819
+0.9842872
Klebsiella
-0.8203822
-0.9076433
-0.9847134
+0.8224414
+0.8927250
+0.9833539
Staphylococcus
-0.8287654
-0.9192859
-0.9894393
+0.8268988
+0.9192531
+0.9861216
Streptococcus
-0.5379310
+0.5447324
0.0000000
-0.5379310
+0.5447324
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 74c7a605..d9d509e2 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 38c86180..2ff7ab8f 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 537e4ec2..8b71ff58 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 1d36ff57..8d6a1c40 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/EUCAST.html b/docs/articles/EUCAST.html
index 83aad23a..ce5e1e90 100644
--- a/docs/articles/EUCAST.html
+++ b/docs/articles/EUCAST.html
@@ -39,7 +39,7 @@
head(my_TB_data)
# rifampicin isoniazid gatifloxacin ethambutol pyrazinamide moxifloxacin
-# 1 R I R S I S
-# 2 I S I S S R
-# 3 I I I R I R
-# 4 S S I S R I
-# 5 I R S R S R
-# 6 I I I R S I
+# 1 S R S S I R
+# 2 R I S I S I
+# 3 I I R S I S
+# 4 R S R I R S
+# 5 I R I I I R
+# 6 I R I R S R
# kanamycin
-# 1 S
+# 1 R
# 2 I
# 3 I
-# 4 S
-# 5 I
-# 6 R
We can now add the interpretation of MDR-TB to our data set. You can use:
mdro(my_TB_data, guideline = "TB")
vignettes/SPSS.Rmd
SPSS.Rmd
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. It is clear that accepted taxonomic names are extremely fast, but some variations can take up to 500-1000 times as much time.
To improve performance, two important calculations take almost no time at all: repetitive results and already precalculated results.
@@ -270,8 +284,8 @@ print(run_it, unit = "ms", signif = 3) # Unit: milliseconds # expr min lq mean median uq max neval -# mo_name(x) 136 169 210 198 247 317 10 -So getting official taxonomic names of 2,000,000 (!!) items consisting of 90 unique values only takes 0.198 seconds. You only lose time on your unique input values.
+# mo_name(x) 141 180 218 207 245 312 10 +So getting official taxonomic names of 2,000,000 (!!) items consisting of 90 unique values only takes 0.207 seconds. You only lose time on your unique input values.
So going from mo_name("Staphylococcus aureus")
to "Staphylococcus aureus"
takes 0.0021 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:
So going from mo_name("Staphylococcus aureus")
to "Staphylococcus aureus"
takes 0.0025 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"),
@@ -302,14 +316,14 @@
print(run_it, unit = "ms", signif = 3)
# Unit: milliseconds
# expr min lq mean median uq max neval
-# A 1.34 1.59 1.66 1.65 1.74 2.18 10
-# B 1.34 1.63 1.73 1.72 1.85 2.31 10
-# C 1.41 1.61 1.65 1.65 1.72 1.83 10
-# D 1.59 1.63 1.77 1.77 1.89 2.03 10
-# E 1.33 1.60 1.68 1.65 1.73 2.08 10
-# F 1.31 1.34 1.56 1.52 1.71 2.11 10
-# G 1.34 1.60 1.75 1.64 1.76 2.74 10
-# H 1.32 1.38 1.57 1.63 1.71 1.78 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.
Currently supported are German, Dutch, Spanish, Italian, French and Portuguese.
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 19a9dea9..431f27bf 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/datasets.html b/docs/articles/datasets.html index a8e6ad88..d2bddbd9 100644 --- a/docs/articles/datasets.html +++ b/docs/articles/datasets.html @@ -39,7 +39,7 @@ diff --git a/docs/articles/index.html b/docs/articles/index.html index ee482346..2c8fb79f 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -81,7 +81,7 @@ diff --git a/docs/articles/resistance_predict.html b/docs/articles/resistance_predict.html index 79bf768c..e6b545a3 100644 --- a/docs/articles/resistance_predict.html +++ b/docs/articles/resistance_predict.html @@ -39,7 +39,7 @@ diff --git a/docs/articles/welcome_to_AMR.html b/docs/articles/welcome_to_AMR.html index 7e649944..40898fcb 100644 --- a/docs/articles/welcome_to_AMR.html +++ b/docs/articles/welcome_to_AMR.html @@ -39,7 +39,7 @@ diff --git a/docs/authors.html b/docs/authors.html index bcd08a4b..55f84d28 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -81,7 +81,7 @@ diff --git a/docs/index.html b/docs/index.html index 513736a6..179b38c9 100644 --- a/docs/index.html +++ b/docs/index.html @@ -43,7 +43,7 @@ diff --git a/docs/news/index.html b/docs/news/index.html index 2c955b9f..f8c2edc2 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -81,7 +81,7 @@ @@ -236,13 +236,13 @@ Source:NEWS.md
- A list, or a character if collapse
is not NULL
This function is also internally used by as.ab()
, although it then only searches for the first drug name and will throw a note if more drug names could have been returned.
type
This function is also internally used by as.ab()
, although it then only searches for the first drug name and will throw a note if more drug names could have been returned. Note: the as.ab()
function may use very long regular expression to match brand names of antimicrobial agents. This may fail on some systems.
type
At default, the function will search for antimicrobial drug names. All text elements will be searched for official names, ATC codes and brand names. As it uses as.ab()
internally, it will correct for misspelling.
a character value that should be applied for AmpC de-repressed cephalosporin-resistant mutants, defaults to NA
. Currently only works when version_expertrules
is 3.2
; 'EUCAST Expert Rules v3.2 on Enterobacterales' states that susceptible (S) results of cefotaxime, ceftriaxone and ceftazidime should be reported with a note, or results should be suppressed (emptied) for these agents. A value of NA
for this argument will remove results for these agents, while e.g. a value of "R"
will make the results for these agents resistant. Use NULL
to not alter the results for AmpC de-repressed cephalosporin-resistant mutants.
For EUCAST Expert Rules v3.2, this rule applies to: Enterobacter, Klebsiella aerogenes, Citrobacter freundii, Hafnia alvei, Serratia, Morganella morganii, Providencia.
a character value that should be applied for AmpC de-repressed cephalosporin-resistant mutants, defaults to NA
. Currently only works when version_expertrules
is 3.2
; 'EUCAST Expert Rules v3.2 on Enterobacterales' states that susceptible (S) results of cefotaxime, ceftriaxone and ceftazidime should be reported with a note, or results should be suppressed (emptied) for these agents. A value of NA
for this argument will remove results for these agents, while e.g. a value of "R"
will make the results for these agents resistant. Use NULL
to not alter the results for AmpC de-repressed cephalosporin-resistant mutants.
For EUCAST Expert Rules v3.2, this rule applies to: Enterobacter, Klebsiella aerogenes, Citrobacter braakii, freundii, gillenii, murliniae, rodenticum, sedlakii, werkmanii, youngae, Hafnia alvei, Serratia, Morganella morganii, Providencia.