diff --git a/DESCRIPTION b/DESCRIPTION index a74f7569..0e3d47cd 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 0.6.1.9037 -Date: 2019-05-23 +Version: 0.6.1.9040 +Date: 2019-05-28 Title: Antimicrobial Resistance Analysis Authors@R: c( person( diff --git a/NEWS.md b/NEWS.md index 588f0965..855acb63 100755 --- a/NEWS.md +++ b/NEWS.md @@ -28,13 +28,15 @@ * Frequency tables (`freq()`): * speed improvement for microbial IDs * fixed level names in markdown - * * Removed all hardcoded EUCAST rules and replaced them with a new reference file: `./inst/eucast/eucast.tsv` * Added ceftazidim intrinsic resistance to *Streptococci* * Changed default settings for `age_groups()`, to let groups of fives and tens end with 100+ instead of 120+ * Fix for `freq()` for when all values are `NA` * Fix for `first_isolate()` for when dates are missing * Improved speed of `guess_ab_col()` +* Function `as.mo()` now gently interprets any number of whitespace characters (like tabs) as one space +* Small algorithm fix for `as.mo()` +* Removed viruses from data set `microorganisms.codes` and cleaned it up #### Other * Support for R 3.6.0 diff --git a/R/mo.R b/R/mo.R index 4f9e2008..c70b0cc3 100755 --- a/R/mo.R +++ b/R/mo.R @@ -456,10 +456,19 @@ exec_as.mo <- function(x, } else if (!all(x %in% AMR::microorganisms[, property])) { + strip_whitespace <- function(x) { + # all whitespaces (tab, new lines, etc.) should be one space + # and spaces before and after should be omitted + trimws(gsub("[\\s]+", " ", x, perl = TRUE), which = "both") + } + + x <- strip_whitespace(x) x_backup <- x # remove spp and species - x <- trimws(gsub(" +(spp.?|ssp.?|sp.? |ss ?.?|subsp.?|subspecies|biovar |serovar |species)", " ", x_backup, ignore.case = TRUE), which = "both") + x <- gsub(" +(spp.?|ssp.?|sp.? |ss ?.?|subsp.?|subspecies|biovar |serovar |species)", " ", x_backup, ignore.case = TRUE) + x <- strip_whitespace(x) + x_backup_without_spp <- x x_species <- paste(x, "species") # translate to English for supported languages of mo_property @@ -487,8 +496,8 @@ exec_as.mo <- function(x, x <- gsub("e+", "e+", x, ignore.case = TRUE) x <- gsub("o+", "o+", x, ignore.case = TRUE) - # but spaces before and after should be omitted - x <- trimws(x, which = "both") + x <- strip_whitespace(x) + x_trimmed <- x x_trimmed_species <- paste(x_trimmed, "species") x_trimmed_without_group <- gsub(" gro.u.p$", "", x_trimmed, ignore.case = TRUE) @@ -1063,7 +1072,7 @@ exec_as.mo <- function(x, } } } - # (6) try to strip off one element from start and check the remains (only allow 2-part name outcome) ---- + # (6) try to strip off one element from start and check the remains (only allow >= 2-part name outcome) ---- x_strip <- a.x_backup %>% strsplit(" ") %>% unlist() if (length(x_strip) > 1 & nchar(g.x_backup_without_spp) >= 6) { for (i in 2:(length(x_strip))) { @@ -1072,8 +1081,8 @@ exec_as.mo <- function(x, if (!empty_result(found)) { found_result <- found found <- microorganismsDT[mo == found_result[1L], ..property][[1]] - # uncertainty level 2 only if the fullname contains a space (otherwise it will be found with lvl 3) - if (microorganismsDT[mo == found_result[1L], fullname][[1]] %like% " ") { + # uncertainty level 2 only if searched part contains a space (otherwise it will be found with lvl 3) + if (x_strip_collapsed %like% " ") { uncertainties <<- rbind(uncertainties, data.frame(uncertainty = 2, input = a.x_backup, diff --git a/R/mo_property.R b/R/mo_property.R index 40dd5256..206c5345 100755 --- a/R/mo_property.R +++ b/R/mo_property.R @@ -396,7 +396,7 @@ mo_validate <- function(x, property, ...) { tryCatch(x[1L] %in% AMR::microorganisms[1, property], error = function(e) stop(e$message, call. = FALSE)) - if (!all(x %in% AMR::microorganisms[, property]) + if (!all(x %in% pull(AMR::microorganisms, property)) | Becker %in% c(TRUE, "all") | Lancefield %in% c(TRUE, "all")) { exec_as.mo(x, property = property, ...) diff --git a/_pkgdown.yml b/_pkgdown.yml index cf1f13f6..3445ab51 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -177,6 +177,9 @@ authors: Bhanu N. M. Sinha: href: https://www.rug.nl/staff/b.sinha/ +development: + mode: release # improves indexing by search engines + template: assets: pkgdown/logos # use logos in this folder params: diff --git a/data/microorganisms.codes.rda b/data/microorganisms.codes.rda index 85322ea8..8c886e7a 100644 Binary files a/data/microorganisms.codes.rda and b/data/microorganisms.codes.rda differ diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index c91683cf..24593f31 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -78,7 +78,7 @@ AMR (for R) - 0.6.1.9037 + 0.6.1.9040 diff --git a/docs/articles/AMR.html b/docs/articles/AMR.html index 125f9a2e..2519e790 100644 --- a/docs/articles/AMR.html +++ b/docs/articles/AMR.html @@ -40,7 +40,7 @@ AMR (for R) - 0.6.1.9035 + 0.6.1.9037 @@ -199,7 +199,7 @@

How to conduct AMR analysis

Matthijs S. Berends

-

23 May 2019

+

28 May 2019

@@ -208,7 +208,7 @@ -

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 23 May 2019.

+

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 28 May 2019.

Introduction

@@ -224,21 +224,21 @@ -2019-05-23 +2019-05-28 abcd Escherichia coli S S -2019-05-23 +2019-05-28 abcd Escherichia coli S R -2019-05-23 +2019-05-28 efgh Escherichia coli R @@ -334,32 +334,10 @@ -2012-10-26 -T6 -Hospital D -Staphylococcus aureus -R -R -S -S -F - - -2011-10-13 -Y4 +2016-12-11 +T9 Hospital B -Streptococcus pneumoniae -R -S -S -S -F - - -2010-02-09 -O2 -Hospital B -Streptococcus pneumoniae +Escherichia coli R S S @@ -367,37 +345,59 @@ F -2010-09-18 -T5 +2013-02-14 +A3 Hospital B Escherichia coli S S +R +S +M + + +2011-05-14 +W4 +Hospital D +Streptococcus pneumoniae +R +S S S F - -2017-07-26 -J10 -Hospital D -Staphylococcus aureus + +2010-02-09 +G3 +Hospital C +Escherichia coli R S +R +S +M + + +2016-04-24 +B7 +Hospital A +Escherichia coli +S +I S S M -2015-09-19 -P5 -Hospital D -Streptococcus pneumoniae +2010-02-20 +L7 +Hospital C +Escherichia coli +R +R S S -S -S -F +M @@ -418,8 +418,8 @@ # # Item Count Percent Cum. Count Cum. Percent # --- ----- ------- -------- ----------- ------------- -# 1 M 10,310 51.6% 10,310 51.6% -# 2 F 9,690 48.4% 20,000 100.0% +# 1 M 10,367 51.8% 10,367 51.8% +# 2 F 9,633 48.2% 20,000 100.0%

So, we can draw at least two conclusions immediately. From a data scientist perspective, the data looks clean: only values M and F. From a researcher perspective: there are slightly more men. Nothing we didn’t already know.

The data is already quite clean, but we still need to transform some variables. The bacteria column now consists of text, and we want to add more variables based on microbial IDs later on. So, we will transform this column to valid IDs. The mutate() function of the dplyr package makes this really easy:

data <- data %>%
@@ -449,14 +449,14 @@
 # Pasteurella multocida (no new changes)
 # Staphylococcus (no new changes)
 # Streptococcus groups A, B, C, G (no new changes)
-# Streptococcus pneumoniae (1542 new changes)
+# Streptococcus pneumoniae (1390 new changes)
 # Viridans group streptococci (no new changes)
 # 
 # EUCAST Expert Rules, Intrinsic Resistance and Exceptional Phenotypes (v3.1, 2016)
-# Table 01: Intrinsic resistance in Enterobacteriaceae (1286 new changes)
+# Table 01: Intrinsic resistance in Enterobacteriaceae (1264 new changes)
 # Table 02: Intrinsic resistance in non-fermentative Gram-negative bacteria (no new changes)
 # Table 03: Intrinsic resistance in other Gram-negative bacteria (no new changes)
-# Table 04: Intrinsic resistance in Gram-positive bacteria (2788 new changes)
+# Table 04: Intrinsic resistance in Gram-positive bacteria (2725 new changes)
 # Table 08: Interpretive rules for B-lactam agents and Gram-positive cocci (no new changes)
 # Table 09: Interpretive rules for B-lactam agents and Gram-negative rods (no new changes)
 # Table 11: Interpretive rules for macrolides, lincosamides, and streptogramins (no new changes)
@@ -464,24 +464,24 @@
 # Table 13: Interpretive rules for quinolones (no new changes)
 # 
 # Other rules
-# Non-EUCAST: amoxicillin/clav acid = S where ampicillin = S (2231 new changes)
-# Non-EUCAST: ampicillin = R where amoxicillin/clav acid = R (126 new changes)
+# Non-EUCAST: amoxicillin/clav acid = S where ampicillin = S (2301 new changes)
+# Non-EUCAST: ampicillin = R where amoxicillin/clav acid = R (114 new changes)
 # Non-EUCAST: piperacillin = R where piperacillin/tazobactam = R (no new changes)
 # Non-EUCAST: piperacillin/tazobactam = S where piperacillin = S (no new changes)
 # Non-EUCAST: trimethoprim = R where trimethoprim/sulfa = R (no new changes)
 # Non-EUCAST: trimethoprim/sulfa = S where trimethoprim = S (no new changes)
 # 
 # --------------------------------------------------------------------------
-# EUCAST rules affected 6,562 out of 20,000 rows, making a total of 7,973 edits
+# EUCAST rules affected 6,521 out of 20,000 rows, making a total of 7,794 edits
 # => added 0 test results
 # 
-# => changed 7,973 test results
-#    - 114 test results changed from S to I
-#    - 4,779 test results changed from S to R
-#    - 1,118 test results changed from I to S
-#    - 330 test results changed from I to R
-#    - 1,606 test results changed from R to S
-#    - 26 test results changed from R to I
+# => changed 7,794 test results
+#    - 125 test results changed from S to I
+#    - 4,678 test results changed from S to R
+#    - 1,070 test results changed from I to S
+#    - 286 test results changed from I to R
+#    - 1,620 test results changed from R to S
+#    - 15 test results changed from R to I
 # --------------------------------------------------------------------------
 # 
 # Use verbose = TRUE to get a data.frame with all specified edits instead.
@@ -509,8 +509,8 @@ # 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`. -# => Found 5,699 first isolates (28.5% of total)
-

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

+# => Found 5,627 first isolates (28.1% of total) +

So only 28.1% 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:

@@ -536,8 +536,8 @@ 1 -2010-04-13 -S1 +2010-03-09 +J4 B_ESCHR_COL S S @@ -547,10 +547,10 @@ 2 -2010-06-02 -S1 +2010-03-19 +J4 B_ESCHR_COL -S +R S S S @@ -558,10 +558,10 @@ 3 -2010-07-21 -S1 +2010-03-31 +J4 B_ESCHR_COL -I +S S R S @@ -569,52 +569,52 @@ 4 -2010-09-19 -S1 +2010-05-07 +J4 B_ESCHR_COL R S -R +S S FALSE 5 -2010-09-19 -S1 +2010-06-21 +J4 B_ESCHR_COL +I S S S -R FALSE 6 -2010-10-14 -S1 +2010-07-10 +J4 B_ESCHR_COL S S -S +R S FALSE 7 -2010-10-28 -S1 +2010-11-26 +J4 B_ESCHR_COL S S -S +R S FALSE 8 -2010-12-09 -S1 +2010-12-04 +J4 B_ESCHR_COL R S @@ -624,29 +624,29 @@ 9 -2010-12-15 -S1 +2011-03-19 +J4 B_ESCHR_COL S S S S -FALSE +TRUE 10 -2011-01-07 -S1 +2011-05-16 +J4 B_ESCHR_COL -R -I +S +S S S 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(.)) %>% 
@@ -657,7 +657,7 @@
 # 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.
 # [Criterion] Inclusion based on key antibiotics, ignoring I.
-# => Found 15,125 first weighted isolates (75.6% of total)
+# => Found 15,074 first weighted isolates (75.4% of total) @@ -674,8 +674,8 @@ - - + + @@ -686,22 +686,22 @@ - - + + - + - + - - + + - + @@ -710,56 +710,56 @@ - - + + - - - - - - - - - - - - + + + + + + + + + + + + - - + + - + - - + + - + - - + + @@ -770,35 +770,35 @@ - - + + - + - - + + - - + + - +
isolate
12010-04-13S12010-03-09J4 B_ESCHR_COL S S
22010-06-02S12010-03-19J4 B_ESCHR_COLSR S S S FALSEFALSETRUE
32010-07-21S12010-03-31J4 B_ESCHR_COLIS S R S
42010-09-19S12010-05-07J4 B_ESCHR_COL R SRSFALSEFALSE
52010-09-19S1B_ESCHR_COL S SSR FALSE TRUE
52010-06-21J4B_ESCHR_COLISSSFALSEFALSE
62010-10-14S12010-07-10J4 B_ESCHR_COL S SSR S FALSE TRUE
72010-10-28S12010-11-26J4 B_ESCHR_COL S SSR S FALSE FALSE
82010-12-09S12010-12-04J4 B_ESCHR_COL R S
92010-12-15S12011-03-19J4 B_ESCHR_COL S S S SFALSETRUE TRUE
102011-01-07S12011-05-16J4 B_ESCHR_COLRISS S S FALSETRUEFALSE
-

Instead of 1, now 7 isolates are flagged. In total, 75.6% of all isolates are marked ‘first weighted’ - 47.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 2, now 7 isolates are flagged. In total, 75.4% of all isolates are marked ‘first weighted’ - 47.2% 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,125 isolates for analysis.

+

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

We can remove unneeded columns:

data_1st <- data_1st %>% 
   select(-c(first, keyab))
@@ -806,7 +806,6 @@
head(data_1st)
- @@ -823,73 +822,8 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -903,16 +837,75 @@ - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -935,9 +928,9 @@
freq(paste(data_1st$genus, data_1st$species))

Or can be used like the dplyr way, which is easier readable:

data_1st %>% freq(genus, species)
-

Frequency table of genus and species from a data.frame (15,125 x 13)

+

Frequency table of genus and species from a data.frame (15,074 x 13)

Columns: 2
-Length: 15,125 (of which NA: 0 = 0.00%)
+Length: 15,074 (of which NA: 0 = 0.00%)
Unique: 4

Shortest: 16
Longest: 24

@@ -954,33 +947,33 @@ Longest: 24

- - - - + + + + - - - - + + + + - - - - + + + + - - - + + + @@ -991,7 +984,7 @@ Longest: 24

Resistance percentages

The functions portion_S(), portion_SI(), portion_I(), portion_IR() and portion_R() can be used to determine the portion of a specific antimicrobial outcome. As per the EUCAST guideline of 2019, we calculate resistance as the portion of R (portion_R()) and susceptibility as the portion of S and I (portion_SI()). These functions can be used on their own:

data_1st %>% portion_R(AMX)
-# [1] 0.4628099
+# [1] 0.4647738

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

data_1st %>% 
   group_by(hospital) %>% 
@@ -1004,19 +997,19 @@ Longest: 24

- + - + - + - +
date patient_id hospital
12012-10-26T6Hospital DB_STPHY_AURRRSSFGram positiveStaphylococcusaureusTRUE
22011-10-13Y4Hospital BB_STRPT_PNERRSRFGram positiveStreptococcuspneumoniaeTRUE
32010-02-09O2Hospital BB_STRPT_PNERRSRFGram positiveStreptococcuspneumoniaeTRUE
62015-09-19P5Hospital DB_STRPT_PNESSSRFGram positiveStreptococcuspneumoniaeTRUE
72011-05-13X52016-12-11T9 Hospital B B_ESCHR_COL RTRUE
82015-03-07Z7Hospital C2013-02-14A3Hospital B B_ESCHR_COL S S R SMGram negativeEscherichiacoliTRUE
2011-05-14W4Hospital DB_STRPT_PNERRSR FGram positiveStreptococcuspneumoniaeTRUE
2010-02-09G3Hospital CB_ESCHR_COLRSRSMGram negativeEscherichiacoliTRUE
2016-04-24B7Hospital AB_ESCHR_COLSSSSMGram negativeEscherichiacoliTRUE
2010-02-20L7Hospital CB_ESCHR_COLRRSSM Gram negative Escherichia coli
1 Escherichia coli7,48649.5%7,48649.5%7,50449.8%7,50449.8%
2 Staphylococcus aureus3,73124.7%11,21774.2%3,70224.6%11,20674.3%
3 Streptococcus pneumoniae2,36015.6%13,57789.8%2,31315.3%13,51989.7%
4 Klebsiella pneumoniae1,54810.2%15,1251,55510.3%15,074 100.0%
Hospital A0.45563550.4603103
Hospital B0.46615530.4641985
Hospital C0.47596570.4670185
Hospital D0.45773470.4706464
@@ -1034,23 +1027,23 @@ Longest: 24

Hospital A -0.4556355 -4587 +0.4603103 +4447 Hospital B -0.4661553 -5215 +0.4641985 +5321 Hospital C -0.4759657 -2330 +0.4670185 +2274 Hospital D -0.4577347 -2993 +0.4706464 +3032 @@ -1070,27 +1063,27 @@ Longest: 24

Escherichia -0.9226556 -0.8966070 -0.9941224 +0.9235075 +0.8956557 +0.9941365 Klebsiella -0.8113695 -0.9102067 -0.9909561 +0.8135048 +0.8926045 +0.9858521 Staphylococcus -0.9187885 -0.9193246 -0.9949075 +0.9240951 +0.9289573 +0.9972988 Streptococcus -0.6152542 +0.6182447 0.0000000 -0.6152542 +0.6182447 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 9a180f49..b7382182 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 90452215..48275f63 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 49e0a370..5f4f4bfd 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 046f85ef..713cb2ad 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 dbf906e3..e3ed41b0 100644 --- a/docs/articles/EUCAST.html +++ b/docs/articles/EUCAST.html @@ -40,7 +40,7 @@ AMR (for R) - 0.6.1.9035 + 0.6.1.9037 @@ -199,7 +199,7 @@

How to apply EUCAST rules

Matthijs S. Berends

-

23 May 2019

+

28 May 2019

diff --git a/docs/articles/G_test.html b/docs/articles/G_test.html index f4f51f2e..cf9e07bd 100644 --- a/docs/articles/G_test.html +++ b/docs/articles/G_test.html @@ -40,7 +40,7 @@ AMR (for R) - 0.6.1.9035 + 0.6.1.9037 @@ -199,7 +199,7 @@

How to use the G-test

Matthijs S. Berends

-

23 May 2019

+

28 May 2019

diff --git a/docs/articles/MDR.html b/docs/articles/MDR.html index bbcbda36..d1fd8900 100644 --- a/docs/articles/MDR.html +++ b/docs/articles/MDR.html @@ -199,7 +199,7 @@

How to determine multi-drug resistance (MDR)

Matthijs S. Berends

-

23 May 2019

+

28 May 2019

@@ -243,18 +243,18 @@
head(my_TB_data)
 #   rifampicin isoniazid gatifloxacin ethambutol pyrazinamide moxifloxacin
 # 1          S         S            R          S            R            S
-# 2          R         R            S          S            R            S
-# 3          R         S            R          R            S            S
-# 4          S         I            R          S            R            R
-# 5          R         S            R          R            S            S
-# 6          I         I            S          S            R            S
+# 2          R         R            R          S            S            R
+# 3          S         S            S          S            S            S
+# 4          S         S            S          S            S            R
+# 5          R         R            S          S            R            R
+# 6          R         S            S          R            S            S
 #   kanamycin
 # 1         S
-# 2         R
+# 2         S
 # 3         S
 # 4         R
-# 5         S
-# 6         R
+# 5 R +# 6 I

We can now add the interpretation of MDR-TB to our data set:

my_TB_data$mdr <- mdr_tb(my_TB_data)
 # NOTE: No column found as input for `col_mo`, assuming all records contain Mycobacterium tuberculosis.
@@ -285,39 +285,39 @@ Unique: 5

1 Mono-resistance -3,240 -64.8% -3,240 -64.8% +3,249 +65.0% +3,249 +65.0% 2 Negative -641 -12.8% -3,881 -77.6% +647 +12.9% +3,896 +77.9% 3 Multidrug resistance -638 -12.8% -4,519 +625 +12.5% +4,521 90.4% 4 Poly-resistance -279 +281 5.6% -4,798 +4,802 96.0% 5 Extensive drug resistance -202 +198 4.0% 5,000 100.0% diff --git a/docs/articles/SPSS.html b/docs/articles/SPSS.html index f6e40a30..5c2a73d4 100644 --- a/docs/articles/SPSS.html +++ b/docs/articles/SPSS.html @@ -40,7 +40,7 @@ AMR (for R) - 0.6.1.9035 + 0.6.1.9037
@@ -199,7 +199,7 @@

How to import data from SPSS / SAS / Stata

Matthijs S. Berends

-

23 May 2019

+

28 May 2019

@@ -229,7 +229,7 @@
  • R can be easily automated.

    -

    Over the last years, R Markdown has really made an interesting development. With R Markdown, you can very easily reproduce your reports, whether it’s to Word, Powerpoint, a website, a PDF document or just the raw data to Excel. I use this a lot to generate monthly reports automatically. Just write the code once and enjoy the automatically updated reports at any interval you like.

    +

    Over the last years, R Markdown has really made an interesting development. With R Markdown, you can very easily produce reports, whether format has to be Word, PowerPoint, a website, a PDF document or just the raw data to Excel. It even allows the use of a reference file containing the layout style (e.g. fonts and colours) of your organisation. I use this a lot to generate weekly and monthly reports automatically. Just write the code once and enjoy the automatically updated reports at any interval you like.

    For an even more professional environment, you could create Shiny apps: live manipulation of data using a custom made website. The webdesign knowledge needed (JavaScript, CSS, HTML) is almost zero.

  • @@ -238,8 +238,8 @@
  • R understands any data type, including SPSS/SAS/Stata.

    -

    And that’s not vice versa I’m afraid. You can import data from any source into R. From SPSS, SAS and Stata (link), from Minitab, Epi Info and EpiData (link), from Excel (link), from flat files like CSV, TXT or TSV (link), or directly from databases and datawarehouses from anywhere on the world (link). You can even scrape websites to download tables that are live on the internet (link).

    -

    And the best part - you can export from R to most data formats as well. So you can import an SPSS file, do your analysis neatly in R and export the resulting tables to Excel files.

    +

    And that’s not vice versa I’m afraid. You can import data from any source into R. From SPSS, SAS and Stata (link), from Minitab, Epi Info and EpiData (link), from Excel (link), from flat files like CSV, TXT or TSV (link), or directly from databases and datawarehouses from anywhere on the world (link). You can even scrape websites to download tables that are live on the internet (link) or get the results of an API call (link).

    +

    And the best part - you can export from R to most data formats as well. So you can import an SPSS file, do your analysis neatly in R and export the resulting tables to Excel files for sharing.

  • R is completely free and open-source.

    diff --git a/docs/articles/WHONET.html b/docs/articles/WHONET.html index 8a94dba1..4699d3eb 100644 --- a/docs/articles/WHONET.html +++ b/docs/articles/WHONET.html @@ -40,7 +40,7 @@ AMR (for R) - 0.6.1.9035 + 0.6.1.9037 @@ -199,7 +199,7 @@

    How to work with WHONET data

    Matthijs S. Berends

    -

    23 May 2019

    +

    28 May 2019

    @@ -239,7 +239,7 @@

    Frequency table of mo from a data.frame (500 x 54)

    -

    Class: mo (character)
    +

    Class: mo (character)
    Length: 500 (of which NA: 0 = 0.00%)
    Unique: 39

    Families: 10
    @@ -343,9 +343,9 @@ Species: 38

    # amoxicillin/clavulanic acid (J01CR02) as an example data %>% freq(AMC_ND2)

    Frequency table of AMC_ND2 from a data.frame (500 x 54)

    -

    Class: factor > ordered > rsi (numeric)
    +

    Class: factor > ordered > rsi (numeric)
    Length: 500 (of which NA: 19 = 3.80%)
    -Levels: 3: S < I < R
    +Levels: 3: S < I < R
    Unique: 3

    Drug: Amoxicillin/clavulanic acid (AMC, J01CR02)
    Group: Beta-lactams/penicillins
    diff --git a/docs/articles/ab_property.html b/docs/articles/ab_property.html index 37f82f35..45fddb28 100644 --- a/docs/articles/ab_property.html +++ b/docs/articles/ab_property.html @@ -40,7 +40,7 @@ AMR (for R) - 0.6.1.9035 + 0.6.1.9037 @@ -199,7 +199,7 @@

    How to get properties of an antibiotic

    Matthijs S. Berends

    -

    23 May 2019

    +

    28 May 2019

    diff --git a/docs/articles/benchmarks.html b/docs/articles/benchmarks.html index 4e1f3989..cd7763de 100644 --- a/docs/articles/benchmarks.html +++ b/docs/articles/benchmarks.html @@ -40,7 +40,7 @@ AMR (for R) - 0.6.1.9035 + 0.6.1.9037 @@ -199,7 +199,7 @@

    Benchmarks

    Matthijs S. Berends

    -

    23 May 2019

    +

    28 May 2019

    @@ -225,13 +225,13 @@ print(S.aureus, unit = "ms", signif = 2) # Unit: milliseconds # expr min lq mean median uq max neval -# as.mo("sau") 17.0 18 32.0 18 62.0 68.0 10 -# as.mo("stau") 48.0 48 64.0 53 92.0 96.0 10 -# as.mo("staaur") 17.0 18 18.0 18 18.0 19.0 10 -# as.mo("STAAUR") 17.0 17 18.0 18 18.0 20.0 10 -# as.mo("S. aureus") 28.0 28 33.0 29 29.0 73.0 10 -# as.mo("S. aureus") 28.0 28 44.0 28 29.0 140.0 10 -# as.mo("Staphylococcus aureus") 7.9 8 8.1 8 8.2 8.2 10 +# as.mo("sau") 17.0 17 18.0 18 18.0 18.0 10 +# as.mo("stau") 48.0 48 66.0 48 92.0 92.0 10 +# as.mo("staaur") 17.0 17 23.0 18 19.0 62.0 10 +# as.mo("STAAUR") 17.0 18 18.0 18 18.0 19.0 10 +# as.mo("S. aureus") 28.0 28 37.0 28 29.0 73.0 10 +# as.mo("S. aureus") 28.0 28 44.0 28 28.0 140.0 10 +# as.mo("Staphylococcus aureus") 7.9 8 8.2 8 8.1 8.8 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. The second input is the only one that has to be looked up thoroughly. All the others are known codes (the first one is a WHONET code) or common laboratory codes, or common full organism names like the last one. Full organism names are always preferred.

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

    T.islandicus <- microbenchmark(as.mo("theisl"),
    @@ -243,12 +243,12 @@
     print(T.islandicus, unit = "ms", signif = 2)
     # Unit: milliseconds
     #                         expr min  lq mean median  uq max neval
    -#              as.mo("theisl") 470 470  500    500 520 520    10
    -#              as.mo("THEISL") 470 470  510    520 520 530    10
    -#       as.mo("T. islandicus")  73  74   79     74  74 120    10
    -#      as.mo("T.  islandicus")  73  74   84     74  75 130    10
    -#  as.mo("Thermus islandicus")  74  74   94     75 120 140    10
    -

    That takes 8.1 times as much time on average. A value of 100 milliseconds means it can only determine ~10 different input values per second. 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 Thermus islandicus) are almost fast - these are the most probable input from most data sets.

    +# as.mo("theisl") 470 470 500 500 520 530 10 +# as.mo("THEISL") 470 470 500 510 520 520 10 +# as.mo("T. islandicus") 75 75 82 76 76 130 10 +# as.mo("T. islandicus") 74 75 90 75 91 150 10 +# as.mo("Thermus islandicus") 73 74 90 74 120 130 10 +

    That takes 8.3 times as much time on average. A value of 100 milliseconds means it can only determine ~10 different input values per second. 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 Thermus islandicus) are almost fast - these 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 Thermus islandicus (which is very uncommon):

    par(mar = c(5, 16, 4, 2)) # set more space for left margin text (16)
     
    @@ -294,8 +294,8 @@
     print(run_it, unit = "ms", signif = 3)
     # Unit: milliseconds
     #            expr min  lq mean median  uq max neval
    -#  mo_fullname(x) 633 675  747    722 763 933    10
    -

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

    +# mo_fullname(x) 630 675 709 693 765 858 10 +

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

    @@ -307,10 +307,10 @@ times = 10) print(run_it, unit = "ms", signif = 3) # Unit: milliseconds -# expr min lq mean median uq max neval -# A 12.90 13.1 18.0 13.20 14.10 59.1 10 -# B 25.20 25.3 26.2 26.10 27.00 27.4 10 -# C 1.25 1.4 1.6 1.68 1.69 1.9 10

    +# expr min lq mean median uq max neval +# A 13.10 13.20 13.40 13.40 13.50 13.60 10 +# B 25.30 25.60 30.40 26.10 26.40 70.10 10 +# C 1.28 1.42 1.57 1.66 1.67 1.71 10

    So going from mo_fullname("Staphylococcus aureus") to "Staphylococcus aureus" takes 0.0017 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"),
    @@ -324,14 +324,14 @@
     print(run_it, unit = "ms", signif = 3)
     # Unit: milliseconds
     #  expr   min    lq  mean median    uq   max neval
    -#     A 0.357 0.374 0.447  0.435 0.514 0.567    10
    -#     B 0.404 0.507 0.541  0.533 0.575 0.755    10
    -#     C 1.350 1.400 1.700  1.720 1.890 2.150    10
    -#     D 0.416 0.550 0.589  0.603 0.632 0.750    10
    -#     E 0.400 0.480 0.559  0.541 0.667 0.737    10
    -#     F 0.346 0.384 0.493  0.498 0.628 0.643    10
    -#     G 0.393 0.421 0.486  0.430 0.570 0.620    10
    -#     H 0.258 0.280 0.332  0.290 0.377 0.508    10
    +# A 0.422 0.441 0.483 0.452 0.483 0.675 10 +# B 0.434 0.512 0.549 0.562 0.593 0.638 10 +# C 1.340 1.530 1.670 1.680 1.860 2.030 10 +# D 0.443 0.471 0.552 0.580 0.611 0.645 10 +# E 0.358 0.398 0.465 0.473 0.516 0.554 10 +# F 0.366 0.397 0.441 0.436 0.485 0.512 10 +# G 0.348 0.462 0.485 0.484 0.517 0.615 10 +# H 0.194 0.262 0.295 0.288 0.327 0.403 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" too, 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.

    @@ -358,13 +358,13 @@ print(run_it, unit = "ms", signif = 4) # Unit: milliseconds # expr min lq mean median uq max neval -# en 18.10 18.20 18.30 18.25 18.38 18.57 10 -# de 23.06 23.14 32.22 23.21 23.48 68.37 10 -# nl 36.30 36.40 41.09 36.59 36.85 81.13 10 -# es 22.85 23.07 23.24 23.20 23.46 23.72 10 -# it 22.92 22.99 27.72 23.17 23.61 68.07 10 -# fr 23.02 23.14 27.79 23.23 23.58 68.27 10 -# pt 23.00 23.09 23.24 23.19 23.45 23.52 10
    +# en 18.24 18.29 18.60 18.43 18.58 19.88 10 +# de 23.04 23.28 37.00 23.46 68.46 69.60 10 +# nl 36.67 36.75 37.54 37.09 37.17 42.45 10 +# es 23.08 23.19 23.38 23.39 23.58 23.63 10 +# it 22.97 23.30 23.40 23.35 23.54 23.92 10 +# fr 23.28 23.30 23.81 23.46 23.82 26.51 10 +# pt 23.10 23.15 27.87 23.35 23.76 68.33 10

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

    diff --git a/docs/articles/benchmarks_files/figure-html/unnamed-chunk-5-1.png b/docs/articles/benchmarks_files/figure-html/unnamed-chunk-5-1.png index 924101ae..8c759f38 100644 Binary files a/docs/articles/benchmarks_files/figure-html/unnamed-chunk-5-1.png and b/docs/articles/benchmarks_files/figure-html/unnamed-chunk-5-1.png differ diff --git a/docs/articles/freq.html b/docs/articles/freq.html index 42b0863e..e235c3d2 100644 --- a/docs/articles/freq.html +++ b/docs/articles/freq.html @@ -199,7 +199,7 @@

    How to create frequency tables

    Matthijs S. Berends

    -

    23 May 2019

    +

    28 May 2019

    @@ -219,7 +219,7 @@

    To only show and quickly review the content of one variable, you can just select this variable in various ways. Let’s say we want to get the frequencies of the gender variable of the septic_patients dataset:

    septic_patients %>% freq(gender)

    Frequency table of gender from a data.frame (2,000 x 49)

    -

    Class: character (character)
    +

    Class: character
    Length: 2,000 (of which NA: 0 = 0.00%)
    Unique: 2

    Shortest: 1
    @@ -424,7 +424,7 @@ Longest: 34

    distinct(patient_id, .keep_all = TRUE) %>% freq(age, nmax = 5, header = TRUE)

    Frequency table of age from a data.frame (981 x 49)

    -

    Class: numeric (numeric)
    +

    Class: numeric
    Length: 981 (of which NA: 0 = 0.00%)
    Unique: 73

    Mean: 71.08
    @@ -503,9 +503,9 @@ Outliers: 15 (unique count: 12)

    septic_patients %>%
       freq(hospital_id)

    Frequency table of hospital_id from a data.frame (2,000 x 49)

    -

    Class: factor (numeric)
    +

    Class: factor (numeric)
    Length: 2,000 (of which NA: 0 = 0.00%)
    -Levels: 4: A, B, C, D
    +Levels: 4: A, B, C, D
    Unique: 4

    @@ -555,9 +555,9 @@ Unique: 4

    septic_patients %>%
       freq(hospital_id, sort.count = FALSE)

    Frequency table of hospital_id from a data.frame (2,000 x 49)

    -

    Class: factor (numeric)
    +

    Class: factor (numeric)
    Length: 2,000 (of which NA: 0 = 0.00%)
    -Levels: 4: A, B, C, D
    +Levels: 4: A, B, C, D
    Unique: 4

    @@ -607,9 +607,9 @@ Unique: 4

    septic_patients %>%
       freq(AMX, header = TRUE)

    Frequency table of AMX from a data.frame (2,000 x 49)

    -

    Class: factor > ordered > rsi (numeric)
    +

    Class: factor > ordered > rsi (numeric)
    Length: 2,000 (of which NA: 771 = 38.55%)
    -Levels: 3: S < I < R
    +Levels: 3: S < I < R
    Unique: 3

    Drug: Amoxicillin (AMX, J01CA04)
    Group: Beta-lactams/penicillins
    @@ -658,7 +658,7 @@ Group: Beta-lactams/penicillins

    septic_patients %>%
       freq(date, nmax = 5, header = TRUE)

    Frequency table of date from a data.frame (2,000 x 49)

    -

    Class: Date (numeric)
    +

    Class: Date (numeric)
    Length: 2,000 (of which NA: 0 = 0.00%)
    Unique: 1,140

    Oldest: 2 January 2002
    @@ -740,9 +740,9 @@ Median: 31 July 2009 (47.39%)

    septic_patients %>%
       freq(AMX, na.rm = FALSE)

    Frequency table of AMX from a data.frame (2,000 x 49)

    -

    Class: factor > ordered > rsi (numeric)
    +

    Class: factor > ordered > rsi (numeric)
    Length: 2,000 (of which NA: 771 = 38.55%)
    -Levels: 3: S < I < R
    +Levels: 3: S < I < R
    Unique: 4

    Drug: Amoxicillin (AMX, J01CA04)
    Group: Beta-lactams/penicillins
    @@ -794,9 +794,9 @@ Group: Beta-lactams/penicillins

    septic_patients %>%
       freq(AMX, na.rm = FALSE)

    Frequency table of AMX from a data.frame (2,000 x 49)

    -

    Class: factor > ordered > rsi (numeric)
    +

    Class: factor > ordered > rsi (numeric)
    Length: 2,000 (of which NA: 771 = 38.55%)
    -Levels: 3: S < I < R
    +Levels: 3: S < I < R
    Unique: 4

    Drug: Amoxicillin (AMX, J01CA04)
    Group: Beta-lactams/penicillins
    @@ -854,9 +854,9 @@ Group: Beta-lactams/penicillins

    septic_patients %>%
       freq(hospital_id, row.names = FALSE)

    Frequency table of hospital_id from a data.frame (2,000 x 49)

    -

    Class: factor (numeric)
    +

    Class: factor (numeric)
    Length: 2,000 (of which NA: 0 = 0.00%)
    -Levels: 4: A, B, C, D
    +Levels: 4: A, B, C, D
    Unique: 4

    @@ -906,9 +906,9 @@ Unique: 4

    septic_patients %>%
       freq(hospital_id, markdown = TRUE)

    Frequency table of hospital_id from a data.frame (2,000 x 49)

    -

    Class: factor (numeric)
    +

    Class: factor (numeric)
    Length: 2,000 (of which NA: 0 = 0.00%)
    -Levels: 4: A, B, C, D
    +Levels: 4: A, B, C, D
    Unique: 4

    diff --git a/docs/articles/index.html b/docs/articles/index.html index 67c9e645..ce08e4eb 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -78,7 +78,7 @@ AMR (for R) - 0.6.1.9037 + 0.6.1.9040 diff --git a/docs/articles/mo_property.html b/docs/articles/mo_property.html index 03c689bc..7cb6f9b7 100644 --- a/docs/articles/mo_property.html +++ b/docs/articles/mo_property.html @@ -40,7 +40,7 @@ AMR (for R) - 0.6.1.9035 + 0.6.1.9037 @@ -199,7 +199,7 @@

    How to get properties of a microorganism

    Matthijs S. Berends

    -

    23 May 2019

    +

    28 May 2019

    diff --git a/docs/articles/resistance_predict.html b/docs/articles/resistance_predict.html index da34c4a8..164d05a1 100644 --- a/docs/articles/resistance_predict.html +++ b/docs/articles/resistance_predict.html @@ -40,7 +40,7 @@ AMR (for R) - 0.6.1.9035 + 0.6.1.9037 @@ -199,7 +199,7 @@

    How to predict antimicrobial resistance

    Matthijs S. Berends

    -

    23 May 2019

    +

    28 May 2019

    diff --git a/docs/authors.html b/docs/authors.html index 6d21c135..7ed4329f 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -78,7 +78,7 @@ AMR (for R) - 0.6.1.9037 + 0.6.1.9040 diff --git a/docs/extra.css b/docs/extra.css index f6f60742..5c65410b 100644 --- a/docs/extra.css +++ b/docs/extra.css @@ -164,7 +164,7 @@ help { text-align: center; } -/* tables */ +/* tables, make them look like scientific ones */ .table { font-size: 90%; } @@ -209,3 +209,6 @@ table a:not(.btn):hover, .table a:not(.btn):hover { border: 2px #2c3e50 dashed; margin-top: 1%; } +#btn_collapseDisqus { + white-space: normal; +} diff --git a/docs/extra.js b/docs/extra.js index 3026969c..f0b6aada 100644 --- a/docs/extra.js +++ b/docs/extra.js @@ -24,7 +24,8 @@ // Add updated Font Awesome 5.6.3 library $('head').append(''); // Add Disqus -$('head').append(''); // Email template for new GitLab issues //https://stackoverflow.com/a/33190494/4575331 @@ -56,7 +57,7 @@ $( document ).ready(function() { // Add Disqus to all pages var disqus = - '' + '
    ' + diff --git a/docs/index.html b/docs/index.html index 01ed7319..96339e43 100644 --- a/docs/index.html +++ b/docs/index.html @@ -42,7 +42,7 @@ AMR (for R) - 0.6.1.9037 + 0.6.1.9040
    diff --git a/docs/news/index.html b/docs/news/index.html index 24106e2c..245d89c3 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -78,7 +78,7 @@ AMR (for R) - 0.6.1.9037 + 0.6.1.9040 @@ -287,8 +287,6 @@ Please create an issue in one of our repositories if you want additions in this
  • Removed all hardcoded EUCAST rules and replaced them with a new reference file: ./inst/eucast/eucast.tsv @@ -301,6 +299,10 @@ Please create an issue in one of our repositories if you want additions in this
  • Fix for first_isolate() for when dates are missing
  • Improved speed of guess_ab_col()
  • +
  • Function as.mo() now gently interprets any number of whitespace characters (like tabs) as one space
  • +
  • Small algorithm fix for as.mo() +
  • +
  • Removed viruses from data set microorganisms.codes and cleaned it up
  • diff --git a/docs/reference/AMR-deprecated.html b/docs/reference/AMR-deprecated.html index 25ae2a42..ab097097 100644 --- a/docs/reference/AMR-deprecated.html +++ b/docs/reference/AMR-deprecated.html @@ -80,7 +80,7 @@ AMR (for R) - 0.6.1.9033 + 0.6.1.9037
    @@ -116,6 +116,13 @@ Predict antimicrobial resistance +
  • + + + + Determine multi-drug resistance (MDR) + +
  • diff --git a/docs/reference/AMR.html b/docs/reference/AMR.html index eb022f0a..e7bf6967 100644 --- a/docs/reference/AMR.html +++ b/docs/reference/AMR.html @@ -80,7 +80,7 @@ AMR (for R) - 0.6.1.9003 + 0.6.1.9037 @@ -116,6 +116,13 @@ Predict antimicrobial resistance
  • +
  • + + + + Determine multi-drug resistance (MDR) + +
  • diff --git a/docs/reference/WHOCC.html b/docs/reference/WHOCC.html index d89a0be2..a245fc5a 100644 --- a/docs/reference/WHOCC.html +++ b/docs/reference/WHOCC.html @@ -80,7 +80,7 @@ AMR (for R) - 0.6.1.9033 + 0.6.1.9037 @@ -116,6 +116,13 @@ Predict antimicrobial resistance
  • +
  • + + + + Determine multi-drug resistance (MDR) + +
  • diff --git a/docs/reference/WHONET.html b/docs/reference/WHONET.html index 389cc770..836e1651 100644 --- a/docs/reference/WHONET.html +++ b/docs/reference/WHONET.html @@ -80,7 +80,7 @@ AMR (for R) - 0.6.1.9003 + 0.6.1.9037 @@ -116,6 +116,13 @@ Predict antimicrobial resistance
  • +
  • + + + + Determine multi-drug resistance (MDR) + +
  • diff --git a/docs/reference/ab_property.html b/docs/reference/ab_property.html index 3f8089a4..422e208b 100644 --- a/docs/reference/ab_property.html +++ b/docs/reference/ab_property.html @@ -80,7 +80,7 @@ AMR (for R) - 0.6.1.9033 + 0.6.1.9037 @@ -116,6 +116,13 @@ Predict antimicrobial resistance
  • +
  • + + + + Determine multi-drug resistance (MDR) + +
  • diff --git a/docs/reference/age.html b/docs/reference/age.html index ed527a1c..22ecb8c4 100644 --- a/docs/reference/age.html +++ b/docs/reference/age.html @@ -80,7 +80,7 @@ AMR (for R) - 0.6.1.9003 + 0.6.1.9037 @@ -116,6 +116,13 @@ Predict antimicrobial resistance
  • +
  • + + + + Determine multi-drug resistance (MDR) + +
  • diff --git a/docs/reference/age_groups.html b/docs/reference/age_groups.html index 09922532..da33dcd1 100644 --- a/docs/reference/age_groups.html +++ b/docs/reference/age_groups.html @@ -80,7 +80,7 @@ AMR (for R) - 0.6.1.9033 + 0.6.1.9037 @@ -116,6 +116,13 @@ Predict antimicrobial resistance
  • +
  • + + + + Determine multi-drug resistance (MDR) + +
  • diff --git a/docs/reference/as.atc.html b/docs/reference/as.atc.html index 397f3065..e01375e6 100644 --- a/docs/reference/as.atc.html +++ b/docs/reference/as.atc.html @@ -80,7 +80,7 @@ AMR (for R) - 0.6.1.9033 + 0.6.1.9037 @@ -116,6 +116,13 @@ Predict antimicrobial resistance
  • +
  • + + + + Determine multi-drug resistance (MDR) + +
  • diff --git a/docs/reference/as.disk.html b/docs/reference/as.disk.html index ee2662ac..8d8d8ce1 100644 --- a/docs/reference/as.disk.html +++ b/docs/reference/as.disk.html @@ -80,7 +80,7 @@ AMR (for R) - 0.6.1.9033 + 0.6.1.9037 @@ -116,6 +116,13 @@ Predict antimicrobial resistance
  • +
  • + + + + Determine multi-drug resistance (MDR) + +
  • diff --git a/docs/reference/as.mic.html b/docs/reference/as.mic.html index 2a0a58a9..9dff64e2 100644 --- a/docs/reference/as.mic.html +++ b/docs/reference/as.mic.html @@ -80,7 +80,7 @@ AMR (for R) - 0.6.1.9033 + 0.6.1.9037 @@ -116,6 +116,13 @@ Predict antimicrobial resistance
  • +
  • + + + + Determine multi-drug resistance (MDR) + +
  • diff --git a/docs/reference/as.mo.html b/docs/reference/as.mo.html index 511d07d4..e1cfadae 100644 --- a/docs/reference/as.mo.html +++ b/docs/reference/as.mo.html @@ -80,7 +80,7 @@ AMR (for R) - 0.6.1.9034 + 0.6.1.9037 @@ -116,6 +116,13 @@ Predict antimicrobial resistance
  • +
  • + + + + Determine multi-drug resistance (MDR) + +
  • diff --git a/docs/reference/atc_online.html b/docs/reference/atc_online.html index 9d020a33..941c1813 100644 --- a/docs/reference/atc_online.html +++ b/docs/reference/atc_online.html @@ -80,7 +80,7 @@ AMR (for R) - 0.6.1.9003 + 0.6.1.9037 @@ -116,6 +116,13 @@ Predict antimicrobial resistance
  • +
  • + + + + Determine multi-drug resistance (MDR) + +
  • diff --git a/docs/reference/availability.html b/docs/reference/availability.html index 2fdd2163..c6f19be3 100644 --- a/docs/reference/availability.html +++ b/docs/reference/availability.html @@ -80,7 +80,7 @@ AMR (for R) - 0.6.1.9003 + 0.6.1.9037 @@ -116,6 +116,13 @@ Predict antimicrobial resistance
  • +
  • + + + + Determine multi-drug resistance (MDR) + +
  • diff --git a/docs/reference/catalogue_of_life.html b/docs/reference/catalogue_of_life.html index d1299c45..c24c0dc9 100644 --- a/docs/reference/catalogue_of_life.html +++ b/docs/reference/catalogue_of_life.html @@ -80,7 +80,7 @@ AMR (for R) - 0.6.1.9003 + 0.6.1.9037 @@ -116,6 +116,13 @@ Predict antimicrobial resistance
  • +
  • + + + + Determine multi-drug resistance (MDR) + +
  • diff --git a/docs/reference/catalogue_of_life_version.html b/docs/reference/catalogue_of_life_version.html index 747ca0dd..8c7a614f 100644 --- a/docs/reference/catalogue_of_life_version.html +++ b/docs/reference/catalogue_of_life_version.html @@ -80,7 +80,7 @@ AMR (for R) - 0.6.1.9003 + 0.6.1.9037 @@ -116,6 +116,13 @@ Predict antimicrobial resistance
  • +
  • + + + + Determine multi-drug resistance (MDR) + +
  • diff --git a/docs/reference/filter_ab_class.html b/docs/reference/filter_ab_class.html index 6a6b13ea..523ca1c3 100644 --- a/docs/reference/filter_ab_class.html +++ b/docs/reference/filter_ab_class.html @@ -80,7 +80,7 @@ AMR (for R) - 0.6.1.9033 + 0.6.1.9037 @@ -116,6 +116,13 @@ Predict antimicrobial resistance
  • +
  • + + + + Determine multi-drug resistance (MDR) + +
  • diff --git a/docs/reference/first_isolate.html b/docs/reference/first_isolate.html index e62b2e6f..d80d98bb 100644 --- a/docs/reference/first_isolate.html +++ b/docs/reference/first_isolate.html @@ -80,7 +80,7 @@ AMR (for R) - 0.6.1.9033 + 0.6.1.9037 @@ -116,6 +116,13 @@ Predict antimicrobial resistance
  • +
  • + + + + Determine multi-drug resistance (MDR) + +
  • diff --git a/docs/reference/freq.html b/docs/reference/freq.html index a7716bb2..18f28f9c 100644 --- a/docs/reference/freq.html +++ b/docs/reference/freq.html @@ -81,7 +81,7 @@ top_freq can be used to get the top/bottom n items of a frequency table, with co AMR (for R) - 0.6.1.9033 + 0.6.1.9037 @@ -117,6 +117,13 @@ top_freq can be used to get the top/bottom n items of a frequency table, with co Predict antimicrobial resistance
  • +
  • + + + + Determine multi-drug resistance (MDR) + +
  • diff --git a/docs/reference/g.test.html b/docs/reference/g.test.html index d16fc8a1..58170288 100644 --- a/docs/reference/g.test.html +++ b/docs/reference/g.test.html @@ -80,7 +80,7 @@ AMR (for R) - 0.6.1.9003 + 0.6.1.9037 @@ -116,6 +116,13 @@ Predict antimicrobial resistance
  • +
  • + + + + Determine multi-drug resistance (MDR) + +
  • diff --git a/docs/reference/guess_ab_col.html b/docs/reference/guess_ab_col.html index d8a77b07..0d7bdfe7 100644 --- a/docs/reference/guess_ab_col.html +++ b/docs/reference/guess_ab_col.html @@ -80,7 +80,7 @@ AMR (for R) - 0.6.1.9033 + 0.6.1.9037 @@ -116,6 +116,13 @@ Predict antimicrobial resistance
  • +
  • + + + + Determine multi-drug resistance (MDR) + +
  • diff --git a/docs/reference/index.html b/docs/reference/index.html index 13347a52..3c6b6f0a 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -78,7 +78,7 @@ AMR (for R) - 0.6.1.9037 + 0.6.1.9040 diff --git a/docs/reference/join.html b/docs/reference/join.html index ced75a64..e58f4fd1 100644 --- a/docs/reference/join.html +++ b/docs/reference/join.html @@ -80,7 +80,7 @@ AMR (for R) - 0.6.1.9003 + 0.6.1.9037 @@ -116,6 +116,13 @@ Predict antimicrobial resistance
  • +
  • + + + + Determine multi-drug resistance (MDR) + +
  • diff --git a/docs/reference/key_antibiotics.html b/docs/reference/key_antibiotics.html index 38563408..c6ab9213 100644 --- a/docs/reference/key_antibiotics.html +++ b/docs/reference/key_antibiotics.html @@ -80,7 +80,7 @@ AMR (for R) - 0.6.1.9036 + 0.6.1.9037 diff --git a/docs/reference/kurtosis.html b/docs/reference/kurtosis.html index 05cbb8df..693ed9a7 100644 --- a/docs/reference/kurtosis.html +++ b/docs/reference/kurtosis.html @@ -80,7 +80,7 @@ AMR (for R) - 0.6.1.9003 + 0.6.1.9037 @@ -116,6 +116,13 @@ Predict antimicrobial resistance
  • +
  • + + + + Determine multi-drug resistance (MDR) + +
  • diff --git a/docs/reference/like.html b/docs/reference/like.html index 6ed81acf..08012d4c 100644 --- a/docs/reference/like.html +++ b/docs/reference/like.html @@ -80,7 +80,7 @@ AMR (for R) - 0.6.1.9003 + 0.6.1.9037 @@ -116,6 +116,13 @@ Predict antimicrobial resistance
  • +
  • + + + + Determine multi-drug resistance (MDR) + +
  • diff --git a/docs/reference/mdro.html b/docs/reference/mdro.html index d0dabbe0..a1259a37 100644 --- a/docs/reference/mdro.html +++ b/docs/reference/mdro.html @@ -80,7 +80,7 @@ AMR (for R) - 0.6.1.9035 + 0.6.1.9037 diff --git a/docs/reference/microorganisms.codes.html b/docs/reference/microorganisms.codes.html index afe4035e..9b5d5608 100644 --- a/docs/reference/microorganisms.codes.html +++ b/docs/reference/microorganisms.codes.html @@ -80,7 +80,7 @@ AMR (for R) - 0.6.1.9003 + 0.6.1.9037 @@ -116,6 +116,13 @@ Predict antimicrobial resistance
  • +
  • + + + + Determine multi-drug resistance (MDR) + +
  • diff --git a/docs/reference/microorganisms.html b/docs/reference/microorganisms.html index e49b00c3..13040cec 100644 --- a/docs/reference/microorganisms.html +++ b/docs/reference/microorganisms.html @@ -80,7 +80,7 @@ AMR (for R) - 0.6.1.9033 + 0.6.1.9037 @@ -116,6 +116,13 @@ Predict antimicrobial resistance
  • +
  • + + + + Determine multi-drug resistance (MDR) + +
  • diff --git a/docs/reference/microorganisms.old.html b/docs/reference/microorganisms.old.html index 8e2e0977..8a7a0c19 100644 --- a/docs/reference/microorganisms.old.html +++ b/docs/reference/microorganisms.old.html @@ -80,7 +80,7 @@ AMR (for R) - 0.6.1.9003 + 0.6.1.9037 @@ -116,6 +116,13 @@ Predict antimicrobial resistance
  • +
  • + + + + Determine multi-drug resistance (MDR) + +
  • diff --git a/docs/reference/mo_property.html b/docs/reference/mo_property.html index 41e4a655..b0f23e4e 100644 --- a/docs/reference/mo_property.html +++ b/docs/reference/mo_property.html @@ -80,7 +80,7 @@ AMR (for R) - 0.6.1.9003 + 0.6.1.9037 @@ -116,6 +116,13 @@ Predict antimicrobial resistance
  • +
  • + + + + Determine multi-drug resistance (MDR) + +
  • diff --git a/docs/reference/mo_source.html b/docs/reference/mo_source.html index c521e4a5..0964e0b7 100644 --- a/docs/reference/mo_source.html +++ b/docs/reference/mo_source.html @@ -81,7 +81,7 @@ This is the fastest way to have your organisation (or analysis) specific codes p AMR (for R) - 0.6.1.9003 + 0.6.1.9037 @@ -117,6 +117,13 @@ This is the fastest way to have your organisation (or analysis) specific codes p Predict antimicrobial resistance
  • +
  • + + + + Determine multi-drug resistance (MDR) + +
  • diff --git a/docs/reference/p.symbol.html b/docs/reference/p.symbol.html index c8d43e31..1aa8091b 100644 --- a/docs/reference/p.symbol.html +++ b/docs/reference/p.symbol.html @@ -80,7 +80,7 @@ AMR (for R) - 0.6.1.9003 + 0.6.1.9037 @@ -116,6 +116,13 @@ Predict antimicrobial resistance
  • +
  • + + + + Determine multi-drug resistance (MDR) + +
  • diff --git a/docs/reference/portion.html b/docs/reference/portion.html index 093900bd..e885ebd7 100644 --- a/docs/reference/portion.html +++ b/docs/reference/portion.html @@ -81,7 +81,7 @@ portion_R and portion_IR can be used to calculate resistance, portion_S and port AMR (for R) - 0.6.1.9035 + 0.6.1.9037 diff --git a/docs/reference/read.4D.html b/docs/reference/read.4D.html index c36046fe..2dd2cc1e 100644 --- a/docs/reference/read.4D.html +++ b/docs/reference/read.4D.html @@ -80,7 +80,7 @@ AMR (for R) - 0.6.1.9003 + 0.6.1.9037 @@ -116,6 +116,13 @@ Predict antimicrobial resistance
  • +
  • + + + + Determine multi-drug resistance (MDR) + +
  • diff --git a/docs/reference/resistance_predict.html b/docs/reference/resistance_predict.html index dbbaf44c..e39c9fc2 100644 --- a/docs/reference/resistance_predict.html +++ b/docs/reference/resistance_predict.html @@ -80,7 +80,7 @@ AMR (for R) - 0.6.1.9033 + 0.6.1.9037 @@ -116,6 +116,13 @@ Predict antimicrobial resistance
  • +
  • + + + + Determine multi-drug resistance (MDR) + +
  • diff --git a/docs/reference/rsi_translation.html b/docs/reference/rsi_translation.html index c3686354..0af8760c 100644 --- a/docs/reference/rsi_translation.html +++ b/docs/reference/rsi_translation.html @@ -80,7 +80,7 @@ AMR (for R) - 0.6.1.9033 + 0.6.1.9037 @@ -116,6 +116,13 @@ Predict antimicrobial resistance
  • +
  • + + + + Determine multi-drug resistance (MDR) + +
  • diff --git a/docs/reference/septic_patients.html b/docs/reference/septic_patients.html index 77ebdc49..20a9d4e6 100644 --- a/docs/reference/septic_patients.html +++ b/docs/reference/septic_patients.html @@ -80,7 +80,7 @@ AMR (for R) - 0.6.1.9003 + 0.6.1.9037 @@ -116,6 +116,13 @@ Predict antimicrobial resistance
  • +
  • + + + + Determine multi-drug resistance (MDR) + +
  • diff --git a/docs/reference/skewness.html b/docs/reference/skewness.html index 1895e97c..59408ecf 100644 --- a/docs/reference/skewness.html +++ b/docs/reference/skewness.html @@ -81,7 +81,7 @@ When negative: the left tail is longer; the mass of the distribution is concentr AMR (for R) - 0.6.1.9003 + 0.6.1.9037 @@ -117,6 +117,13 @@ When negative: the left tail is longer; the mass of the distribution is concentr Predict antimicrobial resistance
  • +
  • + + + + Determine multi-drug resistance (MDR) + +
  • diff --git a/docs/reference/translate.html b/docs/reference/translate.html index 42f337ce..46c3e605 100644 --- a/docs/reference/translate.html +++ b/docs/reference/translate.html @@ -80,7 +80,7 @@ AMR (for R) - 0.6.1.9033 + 0.6.1.9037 @@ -116,6 +116,13 @@ Predict antimicrobial resistance
  • +
  • + + + + Determine multi-drug resistance (MDR) + +
  • diff --git a/git_premaster.sh b/git_premaster.sh index aba302f6..59c7315a 100755 --- a/git_premaster.sh +++ b/git_premaster.sh @@ -17,9 +17,11 @@ echo "•••••••••••••••••••••••• sed -i -- "s/^Date: .*/Date: $(date '+%Y-%m-%d')/" DESCRIPTION # get latest tags git pull --tags --quiet -# get version number: latest tag + .90 + number of commits (like 0.6.1.9033) -newversion=`git describe --tags | sed 's/-/.90/' | sed 's/-.*//' | sed 's/v//'` -sed -i -- "s/^Version: .*/Version: ${newversion}/" DESCRIPTION +current_tag=`git describe --tags --abbrev=0 | sed 's/v//'` +current_commit=`git describe --tags | sed 's/.*-\(.*\)-.*/\1/'` +# combine tag (e.g. 0.1.0) and commit number (like 40) increased by 9000 to indicate beta version +new_version="$current_tag.$((current_commit + 9000))" # results in 0.1.0.9040 +sed -i -- "s/^Version: .*/Version: ${new_version}/" DESCRIPTION echo "First 3 lines of DESCRIPTION:" head -3 DESCRIPTION echo diff --git a/pkgdown/extra.css b/pkgdown/extra.css index f6f60742..5c65410b 100644 --- a/pkgdown/extra.css +++ b/pkgdown/extra.css @@ -164,7 +164,7 @@ help { text-align: center; } -/* tables */ +/* tables, make them look like scientific ones */ .table { font-size: 90%; } @@ -209,3 +209,6 @@ table a:not(.btn):hover, .table a:not(.btn):hover { border: 2px #2c3e50 dashed; margin-top: 1%; } +#btn_collapseDisqus { + white-space: normal; +} diff --git a/pkgdown/extra.js b/pkgdown/extra.js index 3026969c..f0b6aada 100644 --- a/pkgdown/extra.js +++ b/pkgdown/extra.js @@ -24,7 +24,8 @@ // Add updated Font Awesome 5.6.3 library $('head').append(''); // Add Disqus -$('head').append(''); // Email template for new GitLab issues //https://stackoverflow.com/a/33190494/4575331 @@ -56,7 +57,7 @@ $( document ).ready(function() { // Add Disqus to all pages var disqus = - '' + '
    ' + diff --git a/tests/testthat/test-data.R b/tests/testthat/test-data.R index 2d91810f..7b00c3c2 100644 --- a/tests/testthat/test-data.R +++ b/tests/testthat/test-data.R @@ -26,6 +26,9 @@ test_that("data sets are valid", { expect_identical(nrow(antibiotics), length(unique(antibiotics$ab))) expect_identical(nrow(microorganisms), length(unique(microorganisms$mo))) + # check cross table reference + expect_true(all(microorganisms.codes$mo %in% microorganisms$mo)) + # there should be no diacritics (i.e. non ASCII) characters in the datasets datasets <- data(package = "AMR", envir = asNamespace("AMR"))$results[, "Item"] for (i in 1:length(datasets)) { diff --git a/vignettes/SPSS.Rmd b/vignettes/SPSS.Rmd index c3fd7a78..327d1227 100755 --- a/vignettes/SPSS.Rmd +++ b/vignettes/SPSS.Rmd @@ -43,7 +43,7 @@ As said, SPSS is easier to learn than R. But SPSS, SAS and Stata come with major * **R can be easily automated.** - Over the last years, [R Markdown](https://rmarkdown.rstudio.com/) has really made an interesting development. With R Markdown, you can very easily reproduce your reports, whether it's to Word, Powerpoint, a website, a PDF document or just the raw data to Excel. I use this a lot to generate monthly reports automatically. Just write the code once and enjoy the automatically updated reports at any interval you like. + Over the last years, [R Markdown](https://rmarkdown.rstudio.com/) has really made an interesting development. With R Markdown, you can very easily produce reports, whether format has to be Word, PowerPoint, a website, a PDF document or just the raw data to Excel. It even allows the use of a reference file containing the layout style (e.g. fonts and colours) of your organisation. I use this a lot to generate weekly and monthly reports automatically. Just write the code once and enjoy the automatically updated reports at any interval you like. For an even more professional environment, you could create [Shiny apps](https://shiny.rstudio.com/): live manipulation of data using a custom made website. The webdesign knowledge needed (JavaScript, CSS, HTML) is almost *zero*. @@ -53,9 +53,9 @@ As said, SPSS is easier to learn than R. But SPSS, SAS and Stata come with major * **R understands any data type, including SPSS/SAS/Stata.** - And that's not vice versa I'm afraid. You can import data from any source into R. From SPSS, SAS and Stata ([link](https://haven.tidyverse.org/)), from Minitab, Epi Info and EpiData ([link](https://cran.r-project.org/package=foreign)), from Excel ([link](https://readxl.tidyverse.org/)), from flat files like CSV, TXT or TSV ([link](https://readr.tidyverse.org/)), or directly from databases and datawarehouses from anywhere on the world ([link](https://dbplyr.tidyverse.org/)). You can even scrape websites to download tables that are live on the internet ([link](https://github.com/hadley/rvest)). + And that's not vice versa I'm afraid. You can import data from any source into R. From SPSS, SAS and Stata ([link](https://haven.tidyverse.org/)), from Minitab, Epi Info and EpiData ([link](https://cran.r-project.org/package=foreign)), from Excel ([link](https://readxl.tidyverse.org/)), from flat files like CSV, TXT or TSV ([link](https://readr.tidyverse.org/)), or directly from databases and datawarehouses from anywhere on the world ([link](https://dbplyr.tidyverse.org/)). You can even scrape websites to download tables that are live on the internet ([link](https://github.com/hadley/rvest)) or get the results of an API call ([link](https://github.com/Rdatatable/data.table/wiki/Convenience-features-of-fread)). - And the best part - you can export from R to most data formats as well. So you can import an SPSS file, do your analysis neatly in R and export the resulting tables to Excel files. + And the best part - you can export from R to most data formats as well. So you can import an SPSS file, do your analysis neatly in R and export the resulting tables to Excel files for sharing. * **R is completely free and open-source.**