diff --git a/DESCRIPTION b/DESCRIPTION index 1c5d092e..b547216b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 0.7.0.9010 -Date: 2019-06-16 +Version: 0.7.0.9012 +Date: 2019-06-18 Title: Antimicrobial Resistance Analysis Authors@R: c( person( diff --git a/NAMESPACE b/NAMESPACE index 42610ec1..c1329d57 100755 --- a/NAMESPACE +++ b/NAMESPACE @@ -301,6 +301,7 @@ importFrom(graphics,axis) importFrom(graphics,barplot) importFrom(graphics,boxplot) importFrom(graphics,hist) +importFrom(graphics,par) importFrom(graphics,plot) importFrom(graphics,points) importFrom(graphics,text) diff --git a/NEWS.md b/NEWS.md index 57ef0325..7143a761 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# AMR 0.7.0.9010 +# AMR 0.7.0.9012 #### New * Function `rsi_df()` to transform a `data.frame` to a data set containing only the microbial interpretation (S, I, R), the antibiotic, the percentage of S/I/R and the number of available isolates. This is a convenient combination of the existing functions `count_df()` and `portion_df()` to immediately show resistance percentages and number of available isolates: diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index 49765907..0f0f5d87 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -78,7 +78,7 @@ AMR (for R) - 0.7.0.9010 + 0.7.0.9012 diff --git a/docs/articles/AMR.html b/docs/articles/AMR.html index 139af9fb..9543f9ee 100644 --- a/docs/articles/AMR.html +++ b/docs/articles/AMR.html @@ -40,7 +40,7 @@ AMR (for R) - 0.7.0.9009 + 0.7.0.9012 @@ -192,7 +192,7 @@

How to conduct AMR analysis

Matthijs S. Berends

-

15 June 2019

+

18 June 2019

@@ -201,7 +201,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 15 June 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 18 June 2019.

Introduction

@@ -217,21 +217,21 @@ -2019-06-15 +2019-06-18 abcd Escherichia coli S S -2019-06-15 +2019-06-18 abcd Escherichia coli S R -2019-06-15 +2019-06-18 efgh Escherichia coli R @@ -327,71 +327,71 @@ -2010-06-23 -R10 -Hospital A -Streptococcus pneumoniae +2012-05-24 +H8 +Hospital B +Escherichia coli +R S S S -S -F +M -2016-04-09 -R1 -Hospital D -Klebsiella pneumoniae -S +2013-01-14 +S5 +Hospital B +Escherichia coli S +I S S F -2017-01-27 -U10 -Hospital A -Streptococcus pneumoniae -R +2011-04-02 +G2 +Hospital B +Escherichia coli +S S R S -F +M -2017-05-23 -C4 -Hospital B -Klebsiella pneumoniae +2011-09-22 +B3 +Hospital C +Escherichia coli R S -R +S S M -2015-03-27 -W3 -Hospital B -Escherichia coli -S -S -S -S -F - - -2014-06-14 -L5 +2015-07-30 +G10 Hospital A -Escherichia coli -S +Klebsiella pneumoniae +R S S S M + +2017-10-07 +X3 +Hospital A +Escherichia coli +R +S +S +S +F +

Now, let’s start the cleaning and the analysis!

@@ -411,8 +411,8 @@ # # Item Count Percent Cum. Count Cum. Percent # --- ----- ------- -------- ----------- ------------- -# 1 M 10,341 51.7% 10,341 51.7% -# 2 F 9,659 48.3% 20,000 100.0% +# 1 M 10,332 51.7% 10,332 51.7% +# 2 F 9,668 48.3% 20,000 100.0%

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 %>%
@@ -442,14 +442,14 @@
 # Pasteurella multocida (no new changes)
 # Staphylococcus (no new changes)
 # Streptococcus groups A, B, C, G (no new changes)
-# Streptococcus pneumoniae (1,478 new changes)
+# Streptococcus pneumoniae (1,428 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,340 new changes)
+# Table 01: Intrinsic resistance in Enterobacteriaceae (1,339 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,785 new changes)
+# Table 04: Intrinsic resistance in Gram-positive bacteria (2,671 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)
@@ -457,24 +457,24 @@
 # Table 13: Interpretive rules for quinolones (no new changes)
 # 
 # Other rules
-# Non-EUCAST: amoxicillin/clav acid = S where ampicillin = S (2,164 new changes)
-# Non-EUCAST: ampicillin = R where amoxicillin/clav acid = R (105 new changes)
+# Non-EUCAST: amoxicillin/clav acid = S where ampicillin = S (2,233 new changes)
+# Non-EUCAST: ampicillin = R where amoxicillin/clav acid = R (92 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,519 out of 20,000 rows, making a total of 7,872 edits
+# EUCAST rules affected 6,456 out of 20,000 rows, making a total of 7,763 edits
 # => added 0 test results
 # 
-# => changed 7,872 test results
-#    - 122 test results changed from S to I
-#    - 4,775 test results changed from S to R
-#    - 1,060 test results changed from I to S
-#    - 316 test results changed from I to R
-#    - 1,581 test results changed from R to S
-#    - 18 test results changed from R to I
+# => changed 7,763 test results
+#    - 95 test results changed from S to I
+#    - 4,674 test results changed from S to R
+#    - 1,070 test results changed from I to S
+#    - 305 test results changed from I to R
+#    - 1,596 test results changed from R to S
+#    - 23 test results changed from R to I
 # --------------------------------------------------------------------------
 # 
 # Use verbose = TRUE to get a data.frame with all specified edits instead.
@@ -502,8 +502,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,652 first isolates (28.3% of total)
-

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

+# => Found 5,673 first isolates (28.4% of total) +

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

@@ -513,7 +513,7 @@

First weighted isolates

-

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 V3, 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 W10, sorted on date:

@@ -529,21 +529,21 @@ - - + + - + - - + + - + @@ -551,32 +551,32 @@ - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + - + @@ -584,41 +584,41 @@ - - + + - + - - + + - - + + - - + + - + - - + + @@ -628,18 +628,18 @@ - - + + - - - + + +
isolate
12010-01-06V32010-01-10W10 B_ESCHR_COL S S SRS TRUE
22010-07-24V32010-04-21W10 B_ESCHR_COLRS S S S
32010-07-26V32010-05-14W10 B_ESCHR_COLSSS RFALSE
42010-05-21W10B_ESCHR_COLS S S S FALSE
42011-05-06V3B_ESCHR_COLRSSSTRUE
52011-06-04V32010-06-09W10 B_ESCHR_COLSR S S S
62011-07-22V32010-06-19W10 B_ESCHR_COL S SSR S FALSE
72011-08-15V32010-07-07W10 B_ESCHR_COLIIS S RS FALSE
82011-09-20V32010-07-10W10 B_ESCHR_COL R SRS S FALSE
92012-03-26V32010-08-12W10 B_ESCHR_COL S S
102012-06-01V32010-10-15W10 B_ESCHR_COLRI S STRUESSFALSE
-

Only 3 isolates are marked as ‘first’ according to CLSI guideline. But when reviewing the antibiogram, it is obvious that some isolates are absolutely different strains and should be included too. This is why we weigh isolates, based on their antibiogram. The key_antibiotics() function adds a vector with 18 key antibiotics: 6 broad spectrum ones, 6 small spectrum for Gram negatives and 6 small spectrum for Gram positives. These can be defined by the user.

+

Only 1 isolates are marked as ‘first’ according to CLSI guideline. But when reviewing the antibiogram, it is obvious that some isolates are absolutely different strains and should be included too. This is why we weigh isolates, based on their antibiogram. The key_antibiotics() function adds a vector with 18 key antibiotics: 6 broad spectrum ones, 6 small spectrum for Gram negatives and 6 small spectrum for Gram positives. These can be defined by the user.

If a column exists with a name like ‘key(…)ab’ the first_isolate() function will automatically use it and determine the first weighted isolates. Mind the NOTEs in below output:

data <- data %>% 
   mutate(keyab = key_antibiotics(.)) %>% 
@@ -650,7 +650,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,202 first weighted isolates (76.0% of total)
+# => Found 15,099 first weighted isolates (75.5% of total)
@@ -667,58 +667,58 @@ - - + + - + - - + + - + - + - - + + + + + - - - - + - - + + - - + + - - + + - + @@ -727,44 +727,44 @@ - - + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - + + - + - - + + @@ -775,23 +775,23 @@ - - + + - - - - + + + +
isolate
12010-01-06V32010-01-10W10 B_ESCHR_COL S S SRS TRUE TRUE
22010-07-24V32010-04-21W10 B_ESCHR_COLRS S S S FALSETRUEFALSE
32010-07-26V32010-05-14W10 B_ESCHR_COLSSS RSSSFALSE FALSETRUE
42011-05-06V32010-05-21W10 B_ESCHR_COLR S S STRUESFALSE TRUE
52011-06-04V32010-06-09W10 B_ESCHR_COLSR S S S
62011-07-22V32010-06-19W10 B_ESCHR_COL S SSSFALSEFALSE
72011-08-15V3B_ESCHR_COLIIS RS FALSE TRUE
72010-07-07W10B_ESCHR_COLSSRSFALSEFALSE
82011-09-20V32010-07-10W10 B_ESCHR_COL R SRS S FALSE TRUE
92012-03-26V32010-08-12W10 B_ESCHR_COL S S
102012-06-01V32010-10-15W10 B_ESCHR_COLRI S STRUETRUESSFALSEFALSE
-

Instead of 3, now 8 isolates are flagged. In total, 76% of all isolates are marked ‘first weighted’ - 47.7% more than when using the CLSI guideline. In real life, this novel algorithm will yield 5-10% more isolates than the classic CLSI guideline.

+

Instead of 1, now 7 isolates are flagged. In total, 75.5% 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.

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,202 isolates for analysis.

+

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

We can remove unneeded columns:

data_1st <- data_1st %>% 
   select(-c(first, keyab))
@@ -799,6 +799,7 @@
head(data_1st)
+ @@ -815,68 +816,9 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + @@ -890,12 +832,29 @@ - - - + + + + + + + + + + + + + + + + + + + + @@ -904,6 +863,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
date patient_id hospital
2010-06-23R10Hospital AB_STRPT_PNESSSRFGram-positiveStreptococcuspneumoniaeTRUE
2016-04-09R1Hospital DB_KLBSL_PNERSSSFGram-negativeKlebsiellapneumoniaeTRUE
2017-01-27U10Hospital AB_STRPT_PNERRRRFGram-positiveStreptococcuspneumoniaeTRUE
2017-05-23C4Hospital BB_KLBSL_PNERSRSMGram-negativeKlebsiellapneumoniaeTRUE
2015-03-27W322013-01-14S5 Hospital B B_ESCHR_COL STRUE
2014-06-14L5Hospital A32011-04-02G2Hospital B B_ESCHR_COL S SRSMGram-negativeEscherichiacoliTRUE
42011-09-22B3Hospital CB_ESCHR_COLRS S S Mcoli TRUE
52015-07-30G10Hospital AB_KLBSL_PNERSSSMGram-negativeKlebsiellapneumoniaeTRUE
62017-10-07X3Hospital AB_ESCHR_COLRSSSFGram-negativeEscherichiacoliTRUE
72015-11-01O1Hospital BB_ESCHR_COLRSSSFGram-negativeEscherichiacoliTRUE

Time for the analysis!

@@ -921,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 data_1st (15,202 x 13)

+

Frequency table of genus and species from data_1st (15,099 x 13)

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

Shortest: 16
Longest: 24

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

1 Escherichia coli -7,485 -49.2% -7,485 -49.2% +7,513 +49.8% +7,513 +49.8% 2 Staphylococcus aureus -3,758 -24.7% -11,243 -74.0% +3,708 +24.6% +11,221 +74.3% 3 Streptococcus pneumoniae -2,371 -15.6% -13,614 -89.6% +2,266 +15.0% +13,487 +89.3% 4 Klebsiella pneumoniae -1,588 -10.4% -15,202 +1,612 +10.7% +15,099 100.0% @@ -977,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.4678332
+# [1] 0.4679118

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

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

Hospital A -0.4688237 +0.4754386 Hospital B -0.4693374 +0.4673058 Hospital C -0.4641460 +0.4625054 Hospital D -0.4664644 +0.4617169 @@ -1020,23 +1027,23 @@ Longest: 24

Hospital A -0.4688237 -4667 +0.4754386 +4560 Hospital B -0.4693374 -5267 +0.4673058 +5215 Hospital C -0.4641460 -2301 +0.4625054 +2307 Hospital D -0.4664644 -2967 +0.4617169 +3017 @@ -1056,27 +1063,27 @@ Longest: 24

Escherichia -0.9249165 -0.8956580 -0.9929192 +0.9237322 +0.8957806 +0.9952083 Klebsiella -0.8413098 -0.8992443 -0.9911839 +0.8207196 +0.8957816 +0.9844913 Staphylococcus -0.9169771 -0.9161788 -0.9949441 +0.9161273 +0.9180151 +0.9927184 Streptococcus -0.6280051 +0.6160635 0.0000000 -0.6280051 +0.6160635 @@ -1087,36 +1094,36 @@ Longest: 24

"2. Gentamicin" = portion_SI(GEN), "3. Amoxi/clav + genta" = portion_SI(AMC, GEN)) %>% tidyr::gather("antibiotic", "S", -genus) %>% - ggplot(aes(x = genus, + ggplot(aes(x = genus, y = S, fill = antibiotic)) + - geom_col(position = "dodge2")
+ geom_col(position = "dodge2")

Plots

To show results in plots, most R users would nowadays use the ggplot2 package. This package lets you create plots in layers. You can read more about it on their website. A quick example would look like these syntaxes:

-
ggplot(data = a_data_set,
-       mapping = aes(x = year,
+
ggplot(data = a_data_set,
+       mapping = aes(x = year,
                      y = value)) +
-  geom_col() +
-  labs(title = "A title",
+  geom_col() +
+  labs(title = "A title",
        subtitle = "A subtitle",
        x = "My X axis",
        y = "My Y axis")
 
 # or as short as:
-ggplot(a_data_set) +
-  geom_bar(aes(year))
+ggplot(a_data_set) + + geom_bar(aes(year))

The AMR package contains functions to extend this ggplot2 package, for example geom_rsi(). It automatically transforms data with count_df() or portion_df() and show results in stacked bars. Its simplest and shortest example:

-
ggplot(data_1st) +
+
ggplot(data_1st) +
   geom_rsi(translate_ab = FALSE)

Omit the translate_ab = FALSE to have the antibiotic codes (AMX, AMC, CIP, GEN) translated to official WHO names (amoxicillin, amoxicillin/clavulanic acid, ciprofloxacin, gentamicin).

If we group on e.g. the genus column and add some additional functions from our package, we can create this:

+ theme(axis.text.y = element_text(face = "italic"))

To simplify this, we also created the ggplot_rsi() function, which combines almost all above functions:

data_1st %>% 
@@ -1143,7 +1150,7 @@ Longest: 24

facet = "antibiotic", breaks = 0:4 * 25, datalabels = FALSE) + - coord_flip()
+ coord_flip()

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 7779e67f..bf35284d 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 ea7fc39e..7007358c 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 7a389df4..090a588b 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 ce42294a..42c7f33c 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/index.html b/docs/articles/index.html index 44019d58..3385d535 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -78,7 +78,7 @@ AMR (for R) - 0.7.0.9010 + 0.7.0.9012
diff --git a/docs/authors.html b/docs/authors.html index 16f3829b..76db20c7 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -78,7 +78,7 @@ AMR (for R) - 0.7.0.9010 + 0.7.0.9012 diff --git a/docs/index.html b/docs/index.html index 49e9f15e..0b9d76aa 100644 --- a/docs/index.html +++ b/docs/index.html @@ -42,7 +42,7 @@ AMR (for R) - 0.7.0.9010 + 0.7.0.9012 diff --git a/docs/news/index.html b/docs/news/index.html index 335dad40..611dbd1e 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -78,7 +78,7 @@ AMR (for R) - 0.7.0.9010 + 0.7.0.9012 @@ -232,9 +232,9 @@ -
+

-AMR 0.7.0.9010 Unreleased +AMR 0.7.0.9012 Unreleased

@@ -1139,7 +1139,7 @@ Using as.mo(..., allow_uncertain = 3)

Contents

@@ -306,7 +306,7 @@ count_R and count_IR can be used to count resistant isolates, count_S and count_

These functions are meant to count isolates. Use the portion_* functions to calculate microbial resistance.

The function n_rsi is an alias of count_all. They can be used to count all available isolates, i.e. where all input antibiotics have an available result (S, I or R). Their use is equal to n_distinct. Their function is equal to count_S(...) + count_IR(...).

The function count_df takes any variable from data that has an "rsi" class (created with as.rsi) and counts the amounts of S, I and R. The resulting tidy data (see Source) data.frame will have three rows (S/I/R) and a column for each variable with class "rsi".

-

The function rsi_df works exactly like count_df, but add the percentage of S, I and R.

+

The function rsi_df works exactly like count_df, but adds the percentage of S, I and R.

Interpretation of S, I and R

diff --git a/docs/reference/index.html b/docs/reference/index.html index e83858dd..e0ffeb79 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -78,7 +78,7 @@ AMR (for R) - 0.7.0.9010 + 0.7.0.9012
diff --git a/docs/reference/mo_property.html b/docs/reference/mo_property.html index 453923bd..a2d7383e 100644 --- a/docs/reference/mo_property.html +++ b/docs/reference/mo_property.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9010 + 0.7.0.9012
diff --git a/docs/reference/portion.html b/docs/reference/portion.html index 481c85ba..92f48de4 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.7.0.9009 + 0.7.0.9012 @@ -321,7 +321,7 @@ portion_R and portion_IR can be used to calculate resistance, portion_S and port

Remember that you should filter your table to let it contain only first isolates! Use first_isolate to determine them in your data set.

These functions are not meant to count isolates, but to calculate the portion of resistance/susceptibility. Use the count functions to count isolates. Low counts can infuence the outcome - these portion functions may camouflage this, since they only return the portion albeit being dependent on the minimum parameter.

The function portion_df takes any variable from data that has an "rsi" class (created with as.rsi) and calculates the portions R, I and S. The resulting tidy data (see Source) data.frame will have three rows (S/I/R) and a column for each group and each variable with class "rsi".

-

The function rsi_df works exactly like portion_df, but add the number of isolates. +

The function rsi_df works exactly like portion_df, but adds the number of isolates.

To calculate the probability (p) of susceptibility of one antibiotic, we use this formula: