diff --git a/.github/workflows/codecovr.yaml b/.github/workflows/codecovr.yaml
index 9871c13b..64d95475 100644
--- a/.github/workflows/codecovr.yaml
+++ b/.github/workflows/codecovr.yaml
@@ -91,5 +91,3 @@ jobs:
library(tinytest)
covr::codecov(line_exclusions = list("R/atc_online.R", "R/mo_source.R", "R/translate.R", "R/resistance_predict.R", "R/aa_helper_functions.R", "R/aa_helper_pm_functions.R", "R/zzz.R"))
shell: Rscript {0}
-
-
diff --git a/README.md b/README.md
index 86da63ad..3cd7e5cf 100755
--- a/README.md
+++ b/README.md
@@ -2,8 +2,6 @@
# `AMR` (for R)
-[![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)
@@ -25,7 +23,7 @@ This is the development source of the `AMR` package for R. Not a developer? Then
### How to get this package
Please see [our website](https://msberends.github.io/AMR/#get-this-package).
-Bottom line: `install.packages("AMR")`
+Bottom line: `install.packages("AMR", repos = "https://msberends.r-universe.dev")`
### Copyright
diff --git a/data-raw/AMR_latest.tar.gz b/data-raw/AMR_latest.tar.gz
index 4d1b5d59..870548b1 100644
Binary files a/data-raw/AMR_latest.tar.gz and b/data-raw/AMR_latest.tar.gz differ
diff --git a/data-raw/_install_deps.R b/data-raw/_install_deps.R
index 42aac100..ecb1d7ad 100644
--- a/data-raw/_install_deps.R
+++ b/data-raw/_install_deps.R
@@ -26,6 +26,7 @@
# some old R instances have trouble installing tinytest, so we ship it too
install.packages("data-raw/tinytest_1.2.4.10.tar.gz")
install.packages("data-raw/AMR_latest.tar.gz", dependencies = FALSE)
+install.packages("covr")
pkg_suggests <- gsub("[^a-zA-Z0-9]+", "", unlist(strsplit(packageDescription("AMR", fields = "Suggests"), ", ?")))
cat("Packages listed in Suggests:", paste(pkg_suggests, collapse = ", "), "\n")
diff --git a/docs/articles/AMR.html b/docs/articles/AMR.html
index 092cb056..eb643e82 100644
--- a/docs/articles/AMR.html
+++ b/docs/articles/AMR.html
@@ -344,30 +344,52 @@
-2013-01-28 |
-G4 |
+2013-04-02 |
+X1 |
Hospital D |
Escherichia coli |
S |
+R |
+S |
+S |
+F |
+
+
+2015-07-17 |
+X6 |
+Hospital A |
+Staphylococcus aureus |
+R |
+R |
+S |
+S |
+F |
+
+
+2012-09-03 |
+C4 |
+Hospital C |
+Staphylococcus aureus |
+I |
+I |
+S |
+S |
+M |
+
+
+2010-02-11 |
+D2 |
+Hospital B |
+Escherichia coli |
+S |
S |
S |
S |
M |
-
-2014-08-13 |
-O10 |
-Hospital D |
-Escherichia coli |
-R |
-I |
-R |
-S |
-F |
-
-2011-10-06 |
-N1 |
+2012-12-14 |
+L5 |
Hospital B |
Escherichia coli |
S |
@@ -377,36 +399,14 @@
M |
-2016-08-07 |
-J6 |
-Hospital A |
-Streptococcus pneumoniae |
-S |
-R |
-S |
-S |
-M |
-
-
-2010-06-21 |
-Q4 |
+2016-01-30 |
+S3 |
Hospital D |
-Staphylococcus aureus |
+Klebsiella pneumoniae |
S |
-S |
-S |
-S |
-F |
-
-
-2016-04-25 |
-R4 |
-Hospital A |
-Escherichia coli |
R |
S |
S |
-S |
F |
@@ -441,16 +441,16 @@ Longest: 1
1 |
M |
-10,403 |
-52.02% |
-10,403 |
-52.02% |
+10,375 |
+51.88% |
+10,375 |
+51.88% |
2 |
F |
-9,597 |
-47.99% |
+9,625 |
+48.13% |
20,000 |
100.00% |
@@ -505,9 +505,9 @@ Longest: 1
# ℹ Using column 'patient_id' as input for `col_patient_id`.
# Basing inclusion on all antimicrobial results, using a points threshold of
# 2
-# => Found 10,682 first weighted isolates (phenotype-based, 53.4% of total
+# => Found 10,550 first weighted isolates (phenotype-based, 52.8% of total
# where a microbial ID was available)
-So only 53.4% is suitable for resistance analysis! We can now filter on it with the filter()
function, also from the dplyr
package:
+So only 52.8% 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)
@@ -515,7 +515,7 @@ Longest: 1
-So we end up with 10,682 isolates for analysis. Now our data looks like:
+So we end up with 10,550 isolates for analysis. Now our data looks like:
@@ -531,7 +531,7 @@ Longest: 1
-
+
@@ -553,93 +553,93 @@ Longest: 1
-4 |
-2016-08-07 |
-J6 |
-Hospital A |
-B_STRPT_PNMN |
+1 |
+2013-04-02 |
+X1 |
+Hospital D |
+B_ESCHR_COLI |
R |
R |
S |
+S |
+F |
+Gram-negative |
+Escherichia |
+coli |
+TRUE |
+
+
+2 |
+2015-07-17 |
+X6 |
+Hospital A |
+B_STPHY_AURS |
R |
-M |
+R |
+S |
+S |
+F |
Gram-positive |
-Streptococcus |
-pneumoniae |
+Staphylococcus |
+aureus |
+TRUE |
+
+
+4 |
+2010-02-11 |
+D2 |
+Hospital B |
+B_ESCHR_COLI |
+S |
+S |
+S |
+S |
+M |
+Gram-negative |
+Escherichia |
+coli |
TRUE |
6 |
-2016-04-25 |
-R4 |
-Hospital A |
-B_ESCHR_COLI |
-R |
-S |
-S |
-S |
-F |
-Gram-negative |
-Escherichia |
-coli |
-TRUE |
-
-
-10 |
-2016-01-17 |
-R3 |
+2016-01-30 |
+S3 |
Hospital D |
-B_STRPT_PNMN |
-S |
-S |
-S |
-R |
-F |
-Gram-positive |
-Streptococcus |
-pneumoniae |
-TRUE |
-
-
-11 |
-2013-01-18 |
-S1 |
-Hospital B |
-B_ESCHR_COLI |
+B_KLBSL_PNMN |
R |
R |
S |
S |
F |
Gram-negative |
-Escherichia |
-coli |
-TRUE |
-
-
-16 |
-2017-07-05 |
-X9 |
-Hospital D |
-B_STRPT_PNMN |
-S |
-S |
-S |
-R |
-F |
-Gram-positive |
-Streptococcus |
+Klebsiella |
pneumoniae |
TRUE |
-
-19 |
-2013-10-30 |
-D4 |
+
+7 |
+2012-10-20 |
+D10 |
Hospital B |
+B_STPHY_AURS |
+R |
+R |
+R |
+S |
+M |
+Gram-positive |
+Staphylococcus |
+aureus |
+TRUE |
+
+
+8 |
+2016-03-28 |
+K7 |
+Hospital C |
B_STRPT_PNMN |
-R |
-R |
+S |
+S |
S |
R |
M |
@@ -669,8 +669,8 @@ Longest: 1
data_1st %>% freq(genus, species)
Frequency table
Class: character
-Length: 10,682
-Available: 10,682 (100.0%, NA: 0 = 0.0%)
+Length: 10,550
+Available: 10,550 (100.0%, NA: 0 = 0.0%)
Unique: 4
Shortest: 16
Longest: 24
@@ -687,33 +687,33 @@ Longest: 24
1 |
Escherichia coli |
-4,559 |
-42.68% |
-4,559 |
-42.68% |
+4,566 |
+43.28% |
+4,566 |
+43.28% |
2 |
Staphylococcus aureus |
-2,844 |
-26.62% |
-7,403 |
-69.30% |
+2,786 |
+26.41% |
+7,352 |
+69.69% |
3 |
Streptococcus pneumoniae |
-2,082 |
-19.49% |
-9,485 |
-88.79% |
+2,025 |
+19.19% |
+9,377 |
+88.88% |
4 |
Klebsiella pneumoniae |
-1,197 |
-11.21% |
-10,682 |
+1,173 |
+11.12% |
+10,550 |
100.00% |
@@ -760,8 +760,23 @@ Longest: 24
-2016-08-07 |
-J6 |
+2016-03-28 |
+K7 |
+Hospital C |
+B_STRPT_PNMN |
+S |
+S |
+S |
+R |
+M |
+Gram-positive |
+Streptococcus |
+pneumoniae |
+TRUE |
+
+
+2010-01-30 |
+A1 |
Hospital A |
B_STRPT_PNMN |
R |
@@ -774,58 +789,13 @@ Longest: 24
pneumoniae |
TRUE |
-
-2016-01-17 |
-R3 |
-Hospital D |
-B_STRPT_PNMN |
-S |
-S |
-S |
-R |
-F |
-Gram-positive |
-Streptococcus |
-pneumoniae |
-TRUE |
-
-2017-07-05 |
-X9 |
-Hospital D |
-B_STRPT_PNMN |
-S |
-S |
-S |
-R |
-F |
-Gram-positive |
-Streptococcus |
-pneumoniae |
-TRUE |
-
-
-2013-10-30 |
-D4 |
-Hospital B |
-B_STRPT_PNMN |
-R |
-R |
-S |
-R |
-M |
-Gram-positive |
-Streptococcus |
-pneumoniae |
-TRUE |
-
-
-2012-02-20 |
+2012-12-10 |
M7 |
-Hospital B |
+Hospital A |
B_ESCHR_COLI |
R |
-S |
+I |
S |
R |
M |
@@ -835,13 +805,43 @@ Longest: 24
TRUE |
-2010-02-18 |
-F5 |
-Hospital C |
+2012-08-04 |
+Y7 |
+Hospital B |
+B_ESCHR_COLI |
+S |
+S |
+S |
+R |
+F |
+Gram-negative |
+Escherichia |
+coli |
+TRUE |
+
+
+2016-08-05 |
+I4 |
+Hospital A |
+B_ESCHR_COLI |
+R |
+R |
+R |
+R |
+M |
+Gram-negative |
+Escherichia |
+coli |
+TRUE |
+
+
+2011-05-15 |
+H2 |
+Hospital A |
B_STRPT_PNMN |
R |
R |
-S |
+R |
R |
M |
Gram-positive |
@@ -870,50 +870,50 @@ Longest: 24
E. coli |
AMX |
-2129 |
-151 |
-2279 |
-4559 |
+2148 |
+153 |
+2265 |
+4566 |
E. coli |
AMC |
-3355 |
-151 |
-1053 |
-4559 |
+3344 |
+157 |
+1065 |
+4566 |
E. coli |
CIP |
-3320 |
+3356 |
0 |
-1239 |
-4559 |
+1210 |
+4566 |
E. coli |
GEN |
-3995 |
+3983 |
0 |
-564 |
-4559 |
+583 |
+4566 |
K. pneumoniae |
AMX |
0 |
0 |
-1197 |
-1197 |
+1173 |
+1173 |
K. pneumoniae |
AMC |
-949 |
-46 |
-202 |
-1197 |
+930 |
+43 |
+200 |
+1173 |
@@ -936,34 +936,34 @@ Longest: 24
E. coli |
GEN |
-3995 |
+3983 |
0 |
-564 |
-4559 |
+583 |
+4566 |
K. pneumoniae |
GEN |
-1077 |
+1063 |
0 |
-120 |
-1197 |
+110 |
+1173 |
S. aureus |
GEN |
-2523 |
+2490 |
0 |
-321 |
-2844 |
+296 |
+2786 |
S. pneumoniae |
GEN |
0 |
0 |
-2082 |
-2082 |
+2025 |
+2025 |
@@ -977,7 +977,7 @@ Longest: 24
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:
+# [1] 0.5443602
Or can be used in conjunction with group_by()
and summarise()
, both from the dplyr
package:
data_1st %>%
@@ -991,19 +991,19 @@ Longest: 24
Hospital A |
-0.5437286 |
+0.5542598 |
Hospital B |
-0.5478284 |
+0.5400160 |
Hospital C |
-0.5407268 |
+0.5508217 |
Hospital D |
-0.5448113 |
+0.5322972 |
@@ -1022,23 +1022,23 @@ Longest: 24
Hospital A |
-0.5437286 |
-3213 |
+0.5542598 |
+3087 |
Hospital B |
-0.5478284 |
-3753 |
+0.5400160 |
+3761 |
Hospital C |
-0.5407268 |
-1596 |
+0.5508217 |
+1643 |
Hospital D |
-0.5448113 |
-2120 |
+0.5322972 |
+2059 |
@@ -1059,27 +1059,27 @@ Longest: 24
Escherichia |
-0.7690283 |
-0.8762887 |
-0.9782847 |
+0.7667543 |
+0.8723171 |
+0.9770039 |
Klebsiella |
-0.8312448 |
-0.8997494 |
-0.9874687 |
+0.8294970 |
+0.9062234 |
+0.9795396 |
Staphylococcus |
-0.7960619 |
-0.8871308 |
-0.9820675 |
+0.7910983 |
+0.8937545 |
+0.9852836 |
Streptococcus |
-0.5249760 |
+0.5387654 |
0.0000000 |
-0.5249760 |
+0.5387654 |
@@ -1163,19 +1163,16 @@ Longest: 24
mic_values <- random_mic(size = 100)
mic_values
# Class <mic>
-# [1] 4 <=0.0625 64 0.5 0.5 0.125 128 128
-# [9] 0.5 <=0.0625 4 32 256 0.25 64 8
-# [17] 32 64 4 2 1 4 16 128
-# [25] 128 32 <=0.0625 32 2 4 16 0.125
-# [33] 0.25 0.5 32 128 64 128 0.125 256
-# [41] 1 <=0.0625 64 1 0.25 0.5 <=0.0625 64
-# [49] 8 1 4 2 32 <=0.0625 <=0.0625 4
-# [57] 128 4 32 128 128 32 0.25 64
-# [65] 16 0.5 4 0.5 0.25 4 <=0.0625 2
-# [73] 0.125 0.5 256 <=0.0625 0.5 1 256 0.25
-# [81] 64 64 8 256 16 256 64 16
-# [89] 128 0.125 8 <=0.0625 4 16 128 128
-# [97] 16 128 0.5 1
+# [1] 2 2 16 4 0.125 0.5 64 16 128 32
+# [11] 4 32 1 0.125 128 2 8 64 64 2
+# [21] 8 0.125 0.25 1 16 64 0.25 0.5 0.25 4
+# [31] 16 32 0.25 1 0.5 8 64 2 0.25 0.0625
+# [41] 128 1 2 2 0.0625 0.125 64 8 8 8
+# [51] 4 8 0.125 1 128 1 128 2 2 0.5
+# [61] 32 64 16 32 32 16 4 1 16 2
+# [71] 1 0.125 2 4 0.125 32 2 0.125 8 0.25
+# [81] 0.0625 4 0.5 16 128 8 128 0.125 0.0625 1
+# [91] 1 0.25 0.0625 128 128 8 0.0625 32 128 0.25
# base R:
plot(mic_values)
@@ -1204,10 +1201,10 @@ Longest: 24
# to review it.
disk_values
# Class <disk>
-# [1] 22 19 28 26 29 31 30 27 29 17 20 21 19 28 28 24 30 31 17 26 19 30 31 29 24
-# [26] 18 22 25 26 25 26 21 25 25 21 29 29 22 30 25 30 28 29 29 21 20 22 18 20 25
-# [51] 25 21 27 31 26 17 23 28 21 22 24 25 30 18 26 24 22 22 18 31 20 21 25 22 26
-# [76] 31 30 23 18 31 20 24 21 28 31 18 24 27 28 30 28 29 29 22 28 30 30 25 24 31
+# [1] 31 27 25 19 19 17 23 24 30 28 22 26 18 29 25 24 22 30 17 20 23 24 26 24 27
+# [26] 22 27 22 17 26 22 31 27 31 31 25 21 18 26 22 21 25 21 26 22 21 20 20 24 19
+# [51] 25 17 29 26 28 30 30 29 30 28 19 28 22 21 26 25 24 23 21 18 27 20 17 29 30
+# [76] 17 25 19 30 22 26 22 31 18 19 26 20 18 23 17 30 30 22 21 25 21 17 30 30 24
# base R:
plot(disk_values, mo = "E. coli", ab = "cipro")
diff --git a/docs/articles/AMR_files/figure-html/disk_plots-1.png b/docs/articles/AMR_files/figure-html/disk_plots-1.png
index 305aa845..b4d0099a 100644
Binary files a/docs/articles/AMR_files/figure-html/disk_plots-1.png and b/docs/articles/AMR_files/figure-html/disk_plots-1.png differ
diff --git a/docs/articles/AMR_files/figure-html/disk_plots_mo_ab-1.png b/docs/articles/AMR_files/figure-html/disk_plots_mo_ab-1.png
index 20bd42b8..e99caa78 100644
Binary files a/docs/articles/AMR_files/figure-html/disk_plots_mo_ab-1.png and b/docs/articles/AMR_files/figure-html/disk_plots_mo_ab-1.png differ
diff --git a/docs/articles/AMR_files/figure-html/mic_plots-1.png b/docs/articles/AMR_files/figure-html/mic_plots-1.png
index 0c18739b..420b984e 100644
Binary files a/docs/articles/AMR_files/figure-html/mic_plots-1.png and b/docs/articles/AMR_files/figure-html/mic_plots-1.png differ
diff --git a/docs/articles/AMR_files/figure-html/mic_plots-2.png b/docs/articles/AMR_files/figure-html/mic_plots-2.png
index c884bce7..57da3311 100644
Binary files a/docs/articles/AMR_files/figure-html/mic_plots-2.png and b/docs/articles/AMR_files/figure-html/mic_plots-2.png differ
diff --git a/docs/articles/AMR_files/figure-html/mic_plots_mo_ab-1.png b/docs/articles/AMR_files/figure-html/mic_plots_mo_ab-1.png
index 543631cb..4d2d6182 100644
Binary files a/docs/articles/AMR_files/figure-html/mic_plots_mo_ab-1.png and b/docs/articles/AMR_files/figure-html/mic_plots_mo_ab-1.png differ
diff --git a/docs/articles/AMR_files/figure-html/mic_plots_mo_ab-2.png b/docs/articles/AMR_files/figure-html/mic_plots_mo_ab-2.png
index f8259603..bd0d36ba 100644
Binary files a/docs/articles/AMR_files/figure-html/mic_plots_mo_ab-2.png and b/docs/articles/AMR_files/figure-html/mic_plots_mo_ab-2.png differ
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 e7e3ff50..557200b9 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 b700bd62..bfec0e50 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 c16b6933..69633ef6 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 52c8b629..8f3b62a4 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/MDR.html b/docs/articles/MDR.html
index 1d720f89..8f56006e 100644
--- a/docs/articles/MDR.html
+++ b/docs/articles/MDR.html
@@ -339,17 +339,17 @@ Unique: 2
head(my_TB_data)
# rifampicin isoniazid gatifloxacin ethambutol pyrazinamide moxifloxacin
-# 1 R I I I S R
-# 2 R R S R S S
-# 3 I R S S S R
-# 4 I I I R S I
-# 5 I R R I R S
-# 6 R R R R I S
+# 1 I I I I S S
+# 2 R I S I I I
+# 3 S R R R R I
+# 4 S R S S R S
+# 5 R S I R S R
+# 6 R R R R I I
# kanamycin
-# 1 S
+# 1 I
# 2 I
-# 3 R
-# 4 S
+# 3 S
+# 4 R
# 5 I
# 6 I
We can now add the interpretation of MDR-TB to our data set. You can use:
@@ -367,7 +367,7 @@ Unique: 2
Class: factor > ordered (numeric)
Length: 5,000
Levels: 5: Negative < Mono-resistant < Poly-resistant < Multi-drug-resistant <…
-Available: 5,000 (100%, NA: 0 = 0%)
+Available: 5,000 (100.0%, NA: 0 = 0.0%)
Unique: 5
1 |
Mono-resistant |
-3200 |
-64.00% |
-3200 |
-64.00% |
+3271 |
+65.42% |
+3271 |
+65.42% |
2 |
Negative |
-1014 |
-20.28% |
-4214 |
-84.28% |
+949 |
+18.98% |
+4220 |
+84.40% |
3 |
Multi-drug-resistant |
-455 |
-9.10% |
+449 |
+8.98% |
4669 |
93.38% |
4 |
Poly-resistant |
-252 |
-5.04% |
-4921 |
-98.42% |
+240 |
+4.80% |
+4909 |
+98.18% |
5 |
Extensively drug-resistant |
-79 |
-1.58% |
+91 |
+1.82% |
5000 |
100.00% |
diff --git a/docs/articles/SPSS.html b/docs/articles/SPSS.html
index 5b981be5..3632b125 100644
--- a/docs/articles/SPSS.html
+++ b/docs/articles/SPSS.html
@@ -193,7 +193,7 @@
How to import data from SPSS / SAS / Stata
Matthijs S. Berends
- 24 May 2021
+ 26 May 2021
Source: vignettes/SPSS.Rmd
SPSS.Rmd
diff --git a/docs/articles/WHONET.html b/docs/articles/WHONET.html
index 8b2bcae1..6f757c12 100644
--- a/docs/articles/WHONET.html
+++ b/docs/articles/WHONET.html
@@ -240,7 +240,7 @@
Frequency table
Class: character
Length: 500
-Available: 500 (100%, NA: 0 = 0%)
+Available: 500 (100.0%, NA: 0 = 0.0%)
Unique: 37
Shortest: 11
Longest: 40
diff --git a/docs/articles/benchmarks.html b/docs/articles/benchmarks.html
index ff5ea797..00de2e4b 100644
--- a/docs/articles/benchmarks.html
+++ b/docs/articles/benchmarks.html
@@ -226,32 +226,19 @@
times = 25)
print(S.aureus, unit = "ms", signif = 2)
# Unit: milliseconds
-# expr min lq mean median uq max
-# as.mo("sau") 10.0 11.0 14.0 12.0 13.0 47.0
-# as.mo("stau") 53.0 56.0 78.0 58.0 94.0 220.0
-# as.mo("STAU") 53.0 54.0 69.0 58.0 92.0 99.0
-# as.mo("staaur") 10.0 11.0 15.0 11.0 12.0 47.0
-# as.mo("STAAUR") 9.4 11.0 14.0 11.0 12.0 64.0
-# as.mo("S. aureus") 24.0 26.0 44.0 33.0 63.0 69.0
-# as.mo("S aureus") 24.0 27.0 40.0 30.0 61.0 70.0
-# as.mo("Staphylococcus aureus") 2.6 3.1 3.2 3.2 3.3 3.8
-# as.mo("Staphylococcus aureus (MRSA)") 230.0 250.0 250.0 250.0 250.0 280.0
-# as.mo("Sthafilokkockus aaureuz") 180.0 190.0 200.0 190.0 200.0 330.0
-# as.mo("MRSA") 10.0 11.0 16.0 12.0 13.0 47.0
-# as.mo("VISA") 17.0 19.0 22.0 19.0 22.0 63.0
-# neval
-# 25
-# 25
-# 25
-# 25
-# 25
-# 25
-# 25
-# 25
-# 25
-# 25
-# 25
-# 25
+# expr min lq mean median uq max neval
+# as.mo("sau") 10.0 11.0 16.0 11.0 13.0 50 25
+# as.mo("stau") 54.0 58.0 72.0 61.0 89.0 99 25
+# as.mo("STAU") 53.0 55.0 67.0 56.0 91.0 95 25
+# as.mo("staaur") 10.0 11.0 16.0 11.0 13.0 47 25
+# as.mo("STAAUR") 10.0 11.0 17.0 12.0 13.0 58 25
+# as.mo("S. aureus") 26.0 27.0 36.0 31.0 33.0 70 25
+# as.mo("S aureus") 26.0 27.0 40.0 29.0 61.0 68 25
+# as.mo("Staphylococcus aureus") 2.6 3.2 6.5 3.5 3.8 42 25
+# as.mo("Staphylococcus aureus (MRSA)") 240.0 250.0 260.0 260.0 270.0 290 25
+# as.mo("Sthafilokkockus aaureuz") 190.0 190.0 200.0 200.0 210.0 300 25
+# as.mo("MRSA") 10.0 11.0 13.0 12.0 13.0 40 25
+# as.mo("VISA") 18.0 19.0 32.0 20.0 24.0 130 25
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 200 milliseconds, this is only 5 input values per second. It is clear that accepted taxonomic names are extremely fast, but some variations are up to 200 times slower to determine.
To improve performance, we implemented two important algorithms to save unnecessary calculations: repetitive results and already precalculated results.
@@ -273,8 +260,8 @@
# what do these values look like? They are of class <mo>:
head(x)
# Class <mo>
-# [1] B_STRPT_PNMN B_STPHY_CONS B_ESCHR_COLI B_STRPT_PNMN B_ESCHR_COLI
-# [6] B_ENTRC_FCLS
+# [1] B_STPHY_EPDR B_STRPT_GRPA B_STPHY_AURS B_BCTRD_FRGL B_STPHY_HMNS
+# [6] B_STPHY_CONS
# as the example_isolates data set has 2,000 rows, we should have 2 million items
length(x)
@@ -290,8 +277,8 @@
print(run_it, unit = "ms", signif = 3)
# Unit: milliseconds
# expr min lq mean median uq max neval
-# mo_name(x) 180 186 215 221 222 281 10
-So getting official taxonomic names of 2,000,000 (!!) items consisting of 90 unique values only takes 0.221 seconds. That is 110 nanoseconds on average. You only lose time on your unique input values.
+# mo_name(x) 187 223 233 226 229 318 10
+So getting official taxonomic names of 2,000,000 (!!) items consisting of 90 unique values only takes 0.226 seconds. That is 113 nanoseconds on average. You only lose time on your unique input values.
@@ -305,10 +292,10 @@
print(run_it, unit = "ms", signif = 3)
# Unit: milliseconds
# expr min lq mean median uq max neval
-# A 7.45 7.68 8.13 8.23 8.39 8.95 10
-# B 22.70 22.90 31.30 23.90 26.50 62.00 10
-# C 1.51 1.58 1.79 1.84 1.97 1.99 10
-So going from mo_name("Staphylococcus aureus")
to "Staphylococcus aureus"
takes 0.0018 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:
+# A 7.28 7.59 8.01 8.03 8.45 8.66 10
+# B 23.00 24.10 30.30 25.50 27.30 75.30 10
+# C 1.55 1.74 7.31 1.95 2.01 56.10 10
+So going from mo_name("Staphylococcus aureus")
to "Staphylococcus aureus"
takes 0.0019 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"),
@@ -322,14 +309,14 @@
print(run_it, unit = "ms", signif = 3)
# Unit: milliseconds
# expr min lq mean median uq max neval
-# A 1.44 1.44 1.51 1.46 1.56 1.68 10
-# B 1.37 1.40 1.53 1.48 1.67 1.81 10
-# C 1.42 1.47 1.61 1.59 1.68 1.84 10
-# D 1.39 1.43 1.52 1.46 1.53 1.92 10
-# E 1.41 1.46 1.58 1.50 1.70 1.91 10
-# F 1.36 1.44 1.49 1.46 1.57 1.64 10
-# G 1.37 1.44 1.64 1.48 1.82 2.40 10
-# H 1.41 1.43 1.52 1.48 1.54 1.87 10
+# A 1.42 1.45 1.56 1.50 1.57 2.00 10
+# B 1.43 1.46 1.49 1.47 1.55 1.59 10
+# C 1.41 1.43 1.58 1.49 1.57 2.19 10
+# D 1.41 1.48 1.61 1.54 1.63 2.33 10
+# E 1.41 1.45 1.64 1.51 1.56 2.68 10
+# F 1.42 1.52 1.63 1.57 1.71 1.99 10
+# G 1.41 1.46 1.65 1.56 1.90 1.98 10
+# H 1.42 1.46 1.59 1.55 1.70 1.88 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 contains all phyla of all known bacteria, it can just return the initial value immediately.
@@ -357,13 +344,13 @@
print(run_it, unit
= "ms", signif
= 4)
# Unit: milliseconds
# expr min lq mean median uq max neval
-
# en 17.63 17.96 22.55 18.30 18.78 68.16 100
-
# de 28.48 28.93 33.83 29.18 29.85 76.90 100
-
# nl 32.10 33.11 43.48 33.70 35.84 202.50 100
-
# es 32.17 32.67 43.51 33.33 66.07 78.29 100
-
# it 21.95 22.29 26.55 22.59 23.13 70.41 100
-
# fr 21.59 21.94 25.36 22.31 22.88 63.46 100
-
# pt 21.75 22.15 28.50 22.48 23.01 68.10 100
+# en 17.81 18.24 21.93 18.78 19.44 60.56 100
+# de 28.82 29.53 37.92 30.33 32.62 81.75 100
+# nl 32.65 33.61 44.22 34.43 37.44 193.90 100
+# es 32.51 32.95 41.88 33.70 36.39 80.63 100
+# it 22.00 22.57 27.98 23.15 25.14 67.04 100
+# fr 21.71 22.22 27.20 22.83 24.41 66.08 100
+# pt 21.71 22.54 26.97 23.06 23.94 67.41 100
Currently supported non-English languages 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 3132d70a..85aab75d 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/index.html b/docs/index.html
index 55f2aebf..7010f2ea 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -376,7 +376,7 @@
Latest released version
-
This package is available on the rOpenSci R-universe platform, as CRAN does not allow frequent updates of large packages. With CRAN, we cannot update this package frequently enough to implement the latest EUCAST/CLSI guidelines or the latest microbial taxonomy.
+
This package is available here on the rOpenSci R-universe platform, as CRAN does not allow frequent updates of large packages (though the AMR
package is only 7-9 MB). With CRAN, we apparently cannot update this package frequently enough to implement the latest EUCAST/CLSI guidelines or the latest microbial taxonomy.
Install this package in R by using the command:
@@ -386,11 +386,11 @@
diff --git a/docs/news/index.html b/docs/news/index.html
index 1f24ff51..80311c50 100644
--- a/docs/news/index.html
+++ b/docs/news/index.html
@@ -456,7 +456,7 @@
is.rsi.eligible()
now detects if the column name resembles an antibiotic name or code and now returns TRUE
immediately if the input contains any of the values “R”, “S” or “I”. This drastically improves speed, also for a lot of other functions that rely on automatic determination of antibiotic columns.
Functions get_episode()
and is_new_episode()
now support less than a day as value for argument episode_days
(e.g., to include one patient/test per hour)
Argument ampc_cephalosporin_resistance
in eucast_rules()
now also applies to value “I” (not only “S”)
-Functions print()
and summary()
on a Principal Components Analysis object (pca()
) now print additional group info if the original data was grouped using dplyr::group_by()
+Functions print()
and summary()
on a Principal Components Analysis object (pca()
) now print additional group info if the original data was grouped using dplyr::group_by()
Improved speed and reliability of guess_ab_col()
. As this also internally improves the reliability of first_isolate()
and mdro()
, this might have a slight impact on the results of those functions.
Fix for mo_name()
when used in other languages than English
diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml
index a9b6e974..0bc295f2 100644
--- a/docs/pkgdown.yml
+++ b/docs/pkgdown.yml
@@ -12,7 +12,7 @@ articles:
datasets: datasets.html
resistance_predict: resistance_predict.html
welcome_to_AMR: welcome_to_AMR.html
-last_built: 2021-05-26T09:09Z
+last_built: 2021-05-26T12:00Z
urls:
reference: https://msberends.github.io/AMR//reference
article: https://msberends.github.io/AMR//articles
diff --git a/docs/reference/resistance_predict.html b/docs/reference/resistance_predict.html
index b262b55f..c4bcd997 100644
--- a/docs/reference/resistance_predict.html
+++ b/docs/reference/resistance_predict.html
@@ -276,7 +276,7 @@
plot(x, main = paste("Resistance Prediction of", x_name), ...)
# S3 method for resistance_predict
-ggplot(x, main = paste("Resistance Prediction of", x_name), ribbon = TRUE, ...)
+ggplot(x, main = paste("Resistance Prediction of", x_name), ribbon = TRUE, ...)
ggplot_rsi_predict(
x,
diff --git a/index.md b/index.md
index 087d88f8..ec1386e2 100644
--- a/index.md
+++ b/index.md
@@ -98,7 +98,7 @@ This package can be used for:
#### Latest released version
-This package is available on the [rOpenSci R-universe platform](https://ropensci.org/r-universe/), as CRAN does not allow frequent updates of large packages. With CRAN, we cannot update this package frequently enough to implement the latest EUCAST/CLSI guidelines or the latest microbial taxonomy.
+This package is [available here](https://msberends.r-universe.dev) on the [rOpenSci R-universe platform](https://ropensci.org/r-universe/), as CRAN does not allow frequent updates of large packages (though the `AMR` package is only 7-9 MB). With CRAN, we apparently cannot update this package frequently enough to implement the latest EUCAST/CLSI guidelines or the latest microbial taxonomy.
Install this package in R by using the command:
@@ -111,9 +111,6 @@ It will be downloaded and installed automatically.
**Note:** Not all functions on this website may be available in this latest release. To use all functions and data sets mentioned on this website, install the latest development version.
#### Latest development version
-![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)
The latest and unpublished development version can be installed from GitHub using:
@@ -122,6 +119,10 @@ install.packages("remotes") # if you haven't already
remotes::install_github("msberends/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)
+
You can also download the latest build from our repository:
### Get started
diff --git a/inst/tinytest/test-zzz.R b/inst/tinytest/test-zzz.R
index 64fa0e29..2ecb7720 100644
--- a/inst/tinytest/test-zzz.R
+++ b/inst/tinytest/test-zzz.R
@@ -102,7 +102,7 @@ for (i in seq_len(length(import_functions))) {
fn <- names(import_functions)[i]
pkg <- unname(import_functions[i])
# function should exist in foreign pkg namespace
- if (pkg %in% rownames(installed.packages())) {
+ if (AMR:::pkg_is_available(pkg, also_load = FALSE)) {
tst <- !is.null(AMR:::import_fn(name = fn, pkg = pkg, error_on_fail = FALSE))
expect_true(tst,
info = ifelse(tst,