diff --git a/DESCRIPTION b/DESCRIPTION index 38f7b2ae..0b343ec4 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: AMR -Version: 0.7.1.9024 +Version: 0.7.1.9026 Date: 2019-08-06 Title: Antimicrobial Resistance Analysis Authors@R: c( diff --git a/NAMESPACE b/NAMESPACE index 16953cd9..0e07b823 100755 --- a/NAMESPACE +++ b/NAMESPACE @@ -272,3 +272,4 @@ importFrom(stats,pchisq) importFrom(stats,predict) importFrom(utils,browseURL) importFrom(utils,installed.packages) +importFrom(utils,menu) diff --git a/NEWS.md b/NEWS.md index 22dd0b6f..6ce82d4d 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# AMR 0.7.1.9024 +# AMR 0.7.1.9026 ### Breaking * Function `freq()` has moved to a new package, [`clean`](https://github.com/msberends/clean) ([CRAN link](https://cran.r-project.org/package=clean)). Creating frequency tables is actually not the scope of this package (never was) and this function has matured a lot over the last two years. Therefore, a new package was created for data cleaning and checking and it perfectly fits the `freq()` function. The [`clean`](https://github.com/msberends/clean) package is available on CRAN and will be installed automatically when updating the `AMR` package, that now imports it. In a later stage, the `skewness()` and `kurtosis()` functions will be moved to the `clean` package too. diff --git a/docs/articles/AMR.html b/docs/articles/AMR.html index bed45232..7a45e304 100644 --- a/docs/articles/AMR.html +++ b/docs/articles/AMR.html @@ -40,7 +40,7 @@
@@ -185,7 +185,7 @@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 29 July 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 06 August 2019.
So, we can draw at least two conclusions immediately. From a data scientists perspective, the data looks clean: only values M
and F
. From a researchers 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 %>%
@@ -437,14 +437,14 @@
# Pasteurella multocida (no new changes)
# Staphylococcus (no new changes)
# Streptococcus groups A, B, C, G (no new changes)
-# Streptococcus pneumoniae (1,485 new changes)
+# Streptococcus pneumoniae (1,439 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 (1,312 new changes)
+# Table 01: Intrinsic resistance in Enterobacteriaceae (1,329 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 (2,746 new changes)
+# Table 04: Intrinsic resistance in Gram-positive bacteria (2,679 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)
@@ -452,24 +452,24 @@
# Table 13: Interpretive rules for quinolones (no new changes)
#
# Other rules
-# Non-EUCAST: amoxicillin/clav acid = S where ampicillin = S (2,284 new changes)
-# Non-EUCAST: ampicillin = R where amoxicillin/clav acid = R (116 new changes)
+# Non-EUCAST: amoxicillin/clav acid = S where ampicillin = S (2,347 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,581 out of 20,000 rows, making a total of 7,943 edits
+# EUCAST rules affected 6,589 out of 20,000 rows, making a total of 7,908 edits
# => added 0 test results
#
-# => changed 7,943 test results
-# - 100 test results changed from S to I
-# - 4,767 test results changed from S to R
-# - 1,140 test results changed from I to S
-# - 315 test results changed from I to R
-# - 1,602 test results changed from R to S
-# - 19 test results changed from R to I
+# => changed 7,908 test results
+# - 110 test results changed from S to I
+# - 4,680 test results changed from S to R
+# - 1,068 test results changed from I to S
+# - 326 test results changed from I to R
+# - 1,711 test results changed from R to S
+# - 13 test results changed from R to I
# --------------------------------------------------------------------------
#
# Use verbose = TRUE (on your original data) to get a data.frame with all specified edits instead.
So only 28.5% is suitable for resistance analysis! We can now filter on it with the filter()
function, also from the dplyr
package:
So only is suitable for resistance analysis! We can now filter on it with the filter()
function, also from the dplyr
package:
For future use, the above two syntaxes can be shortened with the filter_first_isolate()
function:
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 S2, 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 C10, sorted on date:
isolate | @@ -524,8 +524,8 @@||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | -2010-03-05 | -S2 | +2010-07-24 | +C10 | B_ESCHR_COL | S | S | @@ -535,10 +535,10 @@|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
2 | -2010-03-09 | -S2 | +2010-12-03 | +C10 | B_ESCHR_COL | -S | +R | S | S | S | @@ -546,21 +546,21 @@||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
3 | -2010-08-25 | -S2 | +2010-12-19 | +C10 | B_ESCHR_COL | S | S | -R | -R | +S | +S | FALSE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
4 | -2010-09-20 | -S2 | +2011-02-18 | +C10 | B_ESCHR_COL | -S | +R | S | S | S | @@ -568,19 +568,19 @@||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
5 | -2010-10-11 | -S2 | +2011-06-26 | +C10 | B_ESCHR_COL | +S | +S | +R | R | -S | -S | -S | FALSE | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
6 | -2011-02-11 | -S2 | +2011-06-28 | +C10 | B_ESCHR_COL | S | S | @@ -590,43 +590,43 @@|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
7 | -2011-02-24 | -S2 | +2011-06-30 | +C10 | B_ESCHR_COL | S | S | -S | +R | S | FALSE | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
8 | -2011-03-12 | -S2 | +2011-08-29 | +C10 | B_ESCHR_COL | S | S | R | -S | +R | TRUE | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
9 | -2011-04-21 | -S2 | +2011-10-03 | +C10 | B_ESCHR_COL | S | S | -R | +S | S | FALSE | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
10 | -2011-05-04 | -S2 | +2011-12-30 | +C10 | B_ESCHR_COL | -S | +R | S | S | S | @@ -645,7 +645,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,136 first weighted isolates (75.7% of total) +# => Found 15,027 first weighted isolates (75.1% of total)
isolate | @@ -662,8 +662,8 @@||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | -2010-03-05 | -S2 | +2010-07-24 | +C10 | B_ESCHR_COL | S | S | @@ -674,34 +674,34 @@|||||||
2 | -2010-03-09 | -S2 | +2010-12-03 | +C10 | B_ESCHR_COL | -S | +R | S | S | S | FALSE | -FALSE | +TRUE | |
3 | -2010-08-25 | -S2 | +2010-12-19 | +C10 | B_ESCHR_COL | S | S | -R | -R | +S | +S | FALSE | TRUE | |
4 | -2010-09-20 | -S2 | +2011-02-18 | +C10 | B_ESCHR_COL | -S | +R | S | S | S | @@ -710,20 +710,20 @@||||
5 | -2010-10-11 | -S2 | +2011-06-26 | +C10 | B_ESCHR_COL | +S | +S | +R | R | -S | -S | -S | FALSE | TRUE |
6 | -2011-02-11 | -S2 | +2011-06-28 | +C10 | B_ESCHR_COL | S | S | @@ -734,46 +734,46 @@|||||||
7 | -2011-02-24 | -S2 | -B_ESCHR_COL | -S | -S | -S | -S | -FALSE | -FALSE | -|||||
8 | -2011-03-12 | -S2 | +2011-06-30 | +C10 | B_ESCHR_COL | S | S | R | S | +FALSE | +TRUE | +|||
8 | +2011-08-29 | +C10 | +B_ESCHR_COL | +S | +S | +R | +R | TRUE | TRUE | |||||
9 | -2011-04-21 | -S2 | +2011-10-03 | +C10 | B_ESCHR_COL | S | S | -R | +S | S | FALSE | -FALSE | +TRUE | |
10 | -2011-05-04 | -S2 | +2011-12-30 | +C10 | B_ESCHR_COL | -S | +R | S | S | S | @@ -782,11 +782,11 @@
Instead of 2, now 7 isolates are flagged. In total, 75.7% 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.
+Instead of 2, now 10 isolates are flagged. In total, of all isolates are marked ‘first weighted’ - 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:
So we end up with 15,136 isolates for analysis.
+So we end up with 15,027 isolates for analysis.
We can remove unneeded columns:
@@ -811,15 +811,15 @@Frequency table
Class: character
-Length: 15,136 (of which NA: 0 = 0.00%)
+Length: 15,027 (of which NA: 0 = 0.00%)
Unique: 4
Shortest: 16
Longest: 24
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:
Or can be used in conjuction with group_by()
and summarise()
, both from the dplyr
package:
data_1st %>%
group_by(hospital) %>%
@@ -992,19 +992,19 @@ Longest: 24
Hospital A
-0.4701912
+0.4574111
Hospital B
-0.4536024
+0.4789054
Hospital C
-0.4589011
+0.4639895
Hospital D
-0.4714194
+0.4705098
MDR.Rmd
The data set looks like this now:
head(my_TB_data)
# rifampicin isoniazid gatifloxacin ethambutol pyrazinamide moxifloxacin
-# 1 S S S R S S
-# 2 R S R R I R
-# 3 S R R R I R
-# 4 S S R I I R
-# 5 R S R S S R
-# 6 R S R R S R
+# 1 R R S R S S
+# 2 R R S R S S
+# 3 R S R S S R
+# 4 R I S R R R
+# 5 I S S R I S
+# 6 R R R S I S
# kanamycin
# 1 I
# 2 S
-# 3 R
+# 3 I
# 4 S
# 5 S
# 6 S
WHONET.Rmd
Frequency table
Class: factor > ordered > rsi (numeric)
-Length: 481 (of which NA: 19 = 3.95%)
+Length: 500 (of which NA: 19 = 3.80%)
Levels: 3: S < I < R
Unique: 3
%SI: 78.6%
diff --git a/docs/articles/index.html b/docs/articles/index.html index 716bf558..f839a116 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -78,7 +78,7 @@ diff --git a/docs/authors.html b/docs/authors.html index 56ea8d31..44c9d901 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -78,7 +78,7 @@ diff --git a/docs/index.html b/docs/index.html index 2afce086..e5fedb31 100644 --- a/docs/index.html +++ b/docs/index.html @@ -42,7 +42,7 @@ diff --git a/docs/news/index.html b/docs/news/index.html index c155f84f..49872dce 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -78,7 +78,7 @@ @@ -225,9 +225,9 @@ -as.mo(..., allow_uncertain = 3)
Contents