From 8de0495008f1ffbd46dfc705822bfcbc0d079b11 Mon Sep 17 00:00:00 2001
From: "Matthijs S. Berends" 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 31 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 01 June 2019. So, we can draw at least two conclusions immediately. From a data scientist perspective, the data looks clean: only values The data is already quite clean, but we still need to transform some variables. The So only 28.4% is suitable for resistance analysis! We can now filter on it with the So only 28.5% is suitable for resistance analysis! We can now filter on it with the For future use, the above two syntaxes can be shortened with the Instead of 1, now 9 isolates are flagged. In total, 75.8% of all isolates are marked ‘first weighted’ - 47.4% more than when using the CLSI guideline. In real life, this novel algorithm will yield 5-10% more isolates than the classic CLSI guideline. Instead of 1, now 9 isolates are flagged. In total, 75.9% of all isolates are marked ‘first weighted’ - 47.4% 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 So we end up with 15,152 isolates for analysis. So we end up with 15,183 isolates for analysis. We can remove unneeded columns: Or can be used like the Frequency table of Frequency table of Columns: 2 Shortest: 16 The functions Or can be used in conjuction with How to conduct AMR analysis
Matthijs S. Berends
- 31 May 2019
+ 01 June 2019
AMR.Rmd
Introduction
@@ -224,21 +224,21 @@
-
2019-05-31
+2019-06-01
abcd
Escherichia coli
S
S
-
2019-05-31
+2019-06-01
abcd
Escherichia coli
S
R
-
2019-05-31
+2019-06-01
efgh
Escherichia coli
R
@@ -334,8 +334,8 @@
-
2015-03-08
-Q4
+2011-01-05
+W4
Hospital B
Escherichia coli
S
@@ -345,19 +345,8 @@
F
-
-2015-12-18
-J6
-Hospital B
-Escherichia coli
-S
-S
-S
-S
-M
-
-
-2016-07-07
-W7
+2013-05-10
+W2
Hospital A
Staphylococcus aureus
R
@@ -366,9 +355,9 @@
S
F
- 2011-12-08
-G9
+
+
-2011-07-24
+L6
Hospital C
Staphylococcus aureus
S
@@ -377,27 +366,38 @@
S
M
- 2012-09-08
-Y8
+
+
+2017-12-18
+P2
Hospital B
Escherichia coli
S
S
-S
+R
S
F
+
2017-03-27
+I8
+Hospital D
+Klebsiella pneumoniae
+S
+S
+R
+S
+M
+
-
@@ -418,8 +418,8 @@
#
# Item Count Percent Cum. Count Cum. Percent
# --- ----- ------- -------- ----------- -------------
-# 1 M 10,387 51.9% 10,387 51.9%
-# 2 F 9,613 48.1% 20,000 100.0%
+# 1 M 10,472 52.4% 10,472 52.4%
+# 2 F 9,528 47.6% 20,000 100.0%
2017-05-04
-X10
-Hospital C
-Escherichia coli
+2013-05-25
+L4
+Hospital A
+Staphylococcus aureus
R
S
S
-R
-F
+S
+M
M
and F
. From a researcher perspective: there are slightly more men. Nothing we didn’t already know.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 (1533 new changes)
+# Streptococcus pneumoniae (1519 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 (1285 new changes)
+# Table 01: Intrinsic resistance in Enterobacteriaceae (1280 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 (2841 new changes)
+# Table 04: Intrinsic resistance in Gram-positive bacteria (2810 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 (2277 new changes)
-# Non-EUCAST: ampicillin = R where amoxicillin/clav acid = R (127 new changes)
+# Non-EUCAST: amoxicillin/clav acid = S where ampicillin = S (2266 new changes)
+# Non-EUCAST: ampicillin = R where amoxicillin/clav acid = R (95 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,664 out of 20,000 rows, making a total of 8,063 edits
+# EUCAST rules affected 6,560 out of 20,000 rows, making a total of 7,970 edits
# => added 0 test results
#
-# => changed 8,063 test results
-# - 121 test results changed from S to I
-# - 4,826 test results changed from S to R
-# - 1,112 test results changed from I to S
-# - 355 test results changed from I to R
-# - 1,622 test results changed from R to S
-# - 27 test results changed from R to I
+# => changed 7,970 test results
+# - 118 test results changed from S to I
+# - 4,807 test results changed from S to R
+# - 1,119 test results changed from I to S
+# - 318 test results changed from I to R
+# - 1,590 test results changed from R to S
+# - 18 test results changed from R to I
# --------------------------------------------------------------------------
#
# Use verbose = TRUE to get a data.frame with all specified edits instead.
filter()
function, also from the dplyr
package:filter()
function, also from the dplyr
package:filter_first_isolate()
function:
1
-2010-01-20
-P7
+2010-01-23
+H6
B_ESCHR_COL
S
S
@@ -547,8 +547,8 @@
2
-2010-02-28
-P7
+2010-03-03
+H6
B_ESCHR_COL
R
S
@@ -558,41 +558,41 @@
3
-2010-04-09
-P7
+2010-03-26
+H6
B_ESCHR_COL
-R
S
S
R
+S
FALSE
4
-2010-04-23
-P7
+2010-04-21
+H6
B_ESCHR_COL
R
-R
+S
S
S
FALSE
5
-2010-05-07
-P7
+2010-07-15
+H6
B_ESCHR_COL
-R
-R
+S
+S
S
S
FALSE
6
-2010-05-15
-P7
+2010-08-13
+H6
B_ESCHR_COL
S
S
@@ -602,10 +602,10 @@
7
-2010-07-16
-P7
+2010-09-29
+H6
B_ESCHR_COL
-R
+S
S
R
S
@@ -613,8 +613,8 @@
8
-2010-07-31
-P7
+2010-10-10
+H6
B_ESCHR_COL
R
S
@@ -624,24 +624,24 @@
9
-2010-09-10
-P7
+2010-12-09
+H6
B_ESCHR_COL
-S
-S
+R
+R
S
S
FALSE
@@ -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,152 first weighted isolates (75.8% of total)
+# => Found 15,183 first weighted isolates (75.9% of total)
10
-2010-11-09
-P7
+2010-12-11
+H6
B_ESCHR_COL
-S
-S
R
S
+S
+S
FALSE
-
isolate
@@ -674,8 +674,8 @@
1
-2010-01-20
-P7
+2010-01-23
+H6
B_ESCHR_COL
S
S
@@ -686,8 +686,8 @@
2
-2010-02-28
-P7
+2010-03-03
+H6
B_ESCHR_COL
R
S
@@ -698,23 +698,23 @@
3
-2010-04-09
-P7
+2010-03-26
+H6
B_ESCHR_COL
-R
S
S
R
+S
FALSE
TRUE
4
-2010-04-23
-P7
+2010-04-21
+H6
B_ESCHR_COL
R
-R
+S
S
S
FALSE
@@ -722,20 +722,8 @@
-5
-2010-05-07
-P7
-B_ESCHR_COL
-R
-R
-S
-S
-FALSE
-FALSE
-
-
+6
-2010-05-15
-P7
+2010-07-15
+H6
B_ESCHR_COL
S
S
@@ -744,12 +732,24 @@
FALSE
TRUE
+
6
+2010-08-13
+H6
+B_ESCHR_COL
+S
+S
+S
+S
+FALSE
+FALSE
+
7
-2010-07-16
-P7
+2010-09-29
+H6
B_ESCHR_COL
-R
+S
S
R
S
@@ -758,8 +758,8 @@
8
-2010-07-31
-P7
+2010-10-10
+H6
B_ESCHR_COL
R
S
@@ -770,11 +770,11 @@
9
-2010-09-10
-P7
+2010-12-09
+H6
B_ESCHR_COL
-S
-S
+R
+R
S
S
FALSE
@@ -782,23 +782,23 @@
10
-2010-11-09
-P7
+2010-12-11
+H6
B_ESCHR_COL
-S
-S
R
S
+S
+S
FALSE
TRUE
filter_first_isolate()
, there’s a shortcut for this new algorithm too:
@@ -1027,23 +1034,23 @@ Longest: 24
+
date
patient_id
hospital
@@ -822,8 +823,9 @@
-
2015-03-08
-Q4
+1
+2011-01-05
+W4
Hospital B
B_ESCHR_COL
S
@@ -837,23 +839,9 @@
TRUE
-
-2015-12-18
-J6
-Hospital B
-B_ESCHR_COL
-S
-S
-S
-S
-M
-Gram negative
-Escherichia
-coli
-TRUE
-
-
-2016-07-07
-W7
+2
+2013-05-10
+W2
Hospital A
B_STPHY_AUR
R
@@ -866,13 +854,30 @@
aureus
TRUE
- 2011-12-08
-G9
-Hospital C
-B_STPHY_AUR
+
+
+4
+2017-12-18
+P2
+Hospital B
+B_ESCHR_COL
S
S
+R
+S
+F
+Gram negative
+Escherichia
+coli
+TRUE
+
+
6
+2013-05-25
+L4
+Hospital A
+B_STPHY_AUR
+R
+S
S
S
M
@@ -882,30 +887,32 @@
TRUE
-
+2012-09-08
-Y8
+7
+2016-09-17
+F3
+Hospital D
+B_KLBSL_PNE
+R
+S
+S
+S
+M
+Gram negative
+Klebsiella
+pneumoniae
+TRUE
+
+
-8
+2010-06-30
+L8
Hospital B
B_ESCHR_COL
S
S
S
S
-F
-Gram negative
-Escherichia
-coli
-TRUE
-
- 2017-05-04
-X10
-Hospital C
-B_ESCHR_COL
-R
-S
-S
-R
-F
+M
Gram negative
Escherichia
coli
@@ -928,9 +935,9 @@
dplyr
way, which is easier readable:genus
and species
from a data.frame
(15,152 x 13)genus
and species
from a data.frame
(15,183 x 13)
-Length: 15,152 (of which NA: 0 = 0.00%)
+Length: 15,183 (of which NA: 0 = 0.00%)
Unique: 4
Longest: 24
1
Escherichia coli
-7,455
-49.2%
-7,455
-49.2%
+7,416
+48.8%
+7,416
+48.8%
2
Staphylococcus aureus
-3,759
-24.8%
-11,214
-74.0%
+3,781
+24.9%
+11,197
+73.7%
3
Streptococcus pneumoniae
-2,398
-15.8%
-13,612
-89.8%
+2,391
+15.7%
+13,588
+89.5%
@@ -984,7 +991,7 @@ Longest: 24
Resistance percentages
4
Klebsiella pneumoniae
-1,540
-10.2%
-15,152
+1,595
+10.5%
+15,183
100.0%
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:group_by()
and summarise()
, both from the dplyr
package:data_1st %>%
group_by(hospital) %>%
@@ -997,19 +1004,19 @@ Longest: 24
Hospital A
-0.4577496
+0.4789879
Hospital B
-0.4703985
+0.4752328
Hospital C
-0.4736842
+0.4525453
Hospital D
-0.4736322
+0.4688136
)*WtL1yW?LZ 9ePejoX+*z>&tCl9UPsldH3H4pwqr-c}{QQ0qf@
z(4BDnz$5z##y?STcWyXoZf<_&j1vAnd^H~BU`7J(AhGrK@%e+3Q%Xw8`z;e?Edv9y&N0;^MqXZzQ5`QY
zFTYRzdvr=n-Q3W;&&IVdmpJ~mfpd^k7HwoW@f~Wg(4{E
z?(T^X%w`f{(TKjLmR4?lKBo#|f}8sp^2XY;ctiOB{tgPW1iB-hgQ~hZ?AV_|D-1*z
zDfsD51$
vbf7l`X+=C_Z(&Ry5Zx3N_?Rt;Cab^5;yCm!rcT#@dMAKS=
zZRX3$G#-URUAqJYX*h
>>*eeK5)6RQTW6xkhkv0ZfcQk(#