To calculate antimicrobial resistance in a more sensible way, also by
correcting for too few results, we use the resistance() and
susceptibility() functions.
@@ -1348,7 +1348,7 @@ categories.
labs(title ="MIC Distribution and SIR Interpretation", x ="Sample Groups", y ="MIC (mg/L)")
-
+
This plot provides an intuitive way to assess susceptibility patterns
across different groups while incorporating clinical breakpoints.
For a more straightforward and less manual approach,
@@ -1357,12 +1357,12 @@ extended by this package to directly plot MIC and disk diffusion
values:
# by providing `mo` and `ab`, colours will indicate the SIR interpretation:autoplot(mic_values, mo ="K. pneumoniae", ab ="cipro", guideline ="EUCAST 2024")
-
+
Author: Dr. Matthijs Berends, 23rd Feb 2025
diff --git a/articles/AMR.md b/articles/AMR.md
index 041b17c84..6a3f227f6 100644
--- a/articles/AMR.md
+++ b/articles/AMR.md
@@ -3,7 +3,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](https://rmarkdown.rstudio.com/). However, the
-methodology remains unchanged. This page was generated on 15 December
+methodology remains unchanged. This page was generated on 22 December
2025.
## Introduction
@@ -52,9 +52,9 @@ structure of your data generally look like this:
| date | patient_id | mo | AMX | CIP |
|:----------:|:----------:|:----------------:|:---:|:---:|
-| 2025-12-15 | abcd | Escherichia coli | S | S |
-| 2025-12-15 | abcd | Escherichia coli | S | R |
-| 2025-12-15 | efgh | Escherichia coli | R | S |
+| 2025-12-22 | abcd | Escherichia coli | S | S |
+| 2025-12-22 | abcd | Escherichia coli | S | R |
+| 2025-12-22 | efgh | Escherichia coli | R | S |
### Needed R packages
diff --git a/articles/AMR_for_Python.html b/articles/AMR_for_Python.html
index d19f090a3..a40a28e66 100644
--- a/articles/AMR_for_Python.html
+++ b/articles/AMR_for_Python.html
@@ -30,7 +30,7 @@
AMR (for R)
- 3.0.1.9004
+ 3.0.1.9007
diff --git a/articles/AMR_with_tidymodels.html b/articles/AMR_with_tidymodels.html
index 415fa4edd..2c54030d0 100644
--- a/articles/AMR_with_tidymodels.html
+++ b/articles/AMR_with_tidymodels.html
@@ -30,7 +30,7 @@
AMR (for R)
- 3.0.1.9004
+ 3.0.1.9007
@@ -88,7 +88,7 @@
@@ -438,21 +438,258 @@ and reproducibly.
<mic> columns directly in tidymodels
workflows using AMR-specific recipe steps. This includes a
transformation to log2 scale using
-step_mic_log2(), which prepares MIC values for use in
+step_mic_log2(), which prepares MIC values for use in
classification models.
This approach and idea formed the basis for the publication DOI:
10.3389/fmicb.2025.1582703 to model the presence of
-extended-spectrum beta-lactamases (ESBL).
-
-
NOTE: THIS EXAMPLE WILL BE AVAILABLE IN A NEXT VERSION (#TODO)
-
The new AMR package version will contain new tidymodels selectors
-such as step_mic_log2().
-
-
+extended-spectrum beta-lactamases (ESBL) based on MIC values.
+
+
+Objective
+
+
Our goal is to:
+
+
Use raw MIC values to predict whether a bacterial isolate produces
+ESBL.
+
Apply AMR-aware preprocessing in a tidymodels
+recipe.
+
Train a classification model and evaluate its predictive
+performance.
+
+
+
+
+Data Preparation
+
+
We use the esbl_isolates dataset that comes with the AMR
+package.
+esbl_isolates: Contains MIC test results and ESBL
+status for each isolate.
+
+mutate(esbl = ...): Converts the target column to an
+ordered factor for classification.
+
+
+
+
+Defining the Workflow
+
+
+
1. Preprocessing with a Recipe
+
+
We use our step_mic_log2() function to log2-transform
+MIC values, ensuring that MICs are numeric and properly scaled. All MIC
+predictors can easily and agnostically selected using the new
+all_mic_predictors():
+
+# Split into training and testing sets
+set.seed(123)
+split<-initial_split(data)
+training_data<-training(split)
+testing_data<-testing(split)
+
+# Define the recipe
+mic_recipe<-recipe(esbl~., data =training_data)%>%
+remove_role(genus, old_role ="predictor")%>%# Remove non-informative variable
+step_mic_log2(all_mic_predictors())#%>% # Log2 transform all MIC predictors
+# prep()
+
+mic_recipe
+#>
+#> ──Recipe──────────────────────────────────────────────────────────────────────
+#>
+#> ── Inputs
+#> Number of variables by role
+#> outcome: 1
+#> predictor: 17
+#> undeclared role: 1
+#>
+#> ── Operations
+#> • Log2 transformation of MIC columns: all_mic_predictors()
+
Explanation:
+
+
+remove_role(): Removes irrelevant variables like
+genus.
+
+step_mic_log2(): Applies
+log2(as.numeric(...)) to all MIC predictors in one go.
+
+prep(): Finalises the recipe based on training
+data.
+
+
+
+
2. Specifying the Model
+
+
We use a simple logistic regression to model ESBL presence, though
+recent models such as xgboost (link
+to parsnip manual) could be much more precise.
+
+# Define the model
+model<-logistic_reg(mode ="classification")%>%
+set_engine("glm")
+
+model
+#> Logistic Regression Model Specification (classification)
+#>
+#> Computational engine: glm
+
Explanation:
+
+
+logistic_reg(): Specifies a binary classification
+model.
+fit(): Trains the model on the processed training
+data.
+
+predict(): Produces predictions for unseen test
+data.
+
+metric_set(): Allows evaluating multiple classification
+metrics. This will make our_metrics to become a function
+that we can use to check the predictions with.
+
+
It appears we can predict ESBL gene presence with a positive
+predictive value (PPV) of 92.1% and a negative predictive value (NPV) of
+91.9 using a simplistic logistic regression model.
+
+
+
+Visualising Predictions
+
+
We can visualise predictions by comparing predicted and actual ESBL
+status.
+
+library(ggplot2)
+
+ggplot(predictions, aes(x =esbl, fill =.pred_class))+
+geom_bar(position ="stack")+
+labs(title ="Predicted vs Actual ESBL Status",
+ x ="Actual ESBL",
+ y ="Count")+
+theme_minimal()
+
+
And plot the certainties too - how certain were the actual
+predictions?
In this example, we showcased how the new AMR-specific
+recipe steps simplify working with <mic> columns in
+tidymodels. The step_mic_log2() transformation
+converts ordered MICs to log2-transformed numerics, improving
+compatibility with classification models.
+
This pipeline enables realistic, reproducible, and interpretable
+modelling of antimicrobial resistance data.
+
-
Example 2: Predicting AMR Over Time
+
Example 3: Predicting AMR Over Time
In this third example, we aim to predict antimicrobial resistance
(AMR) trends over time using tidymodels. We will model
@@ -461,8 +698,8 @@ amoxicillin-clavulanic acid AMC, and ciprofloxacin
CIP), based on historical data grouped by year and hospital
ward.
-
-Objective
+
+Objective
Our goal is to:
@@ -473,12 +710,12 @@ model.
-
-Data Preparation
+
+Data Preparation
We start by transforming the example_isolates dataset
into a structured time-series format.
We plot resistance trends over time for amoxicillin.
-
+
library(ggplot2)# Plot actual vs predicted resistance over time
@@ -677,10 +914,10 @@ sets.
x ="Year", y ="Resistance Proportion")+theme_minimal()
-
+
Additionally, we can visualise resistance trends in
ggplot2 and directly add linear models there:
-
+
ggplot(data_time, aes(x =year, y =res_AMX, color =gramstain))+geom_line()+labs(title ="AMX Resistance Trends",
@@ -691,7 +928,7 @@ sets.
formula =y~x, alpha =0.25)+theme_minimal()
-
+
diff --git a/articles/AMR_with_tidymodels.md b/articles/AMR_with_tidymodels.md
index 4db5a2065..747801c2f 100644
--- a/articles/AMR_with_tidymodels.md
+++ b/articles/AMR_with_tidymodels.md
@@ -1,6 +1,6 @@
# AMR with tidymodels
-> This page was entirely written by our [AMR for R
+> This page was almost entirely written by our [AMR for R
> Assistant](https://chat.amr-for-r.org), a ChatGPT manually-trained
> model able to answer any question about the `AMR` package.
@@ -351,21 +351,250 @@ and reproducibly.
In this second example, we demonstrate how to use `` columns
directly in `tidymodels` workflows using AMR-specific recipe steps. This
-includes a transformation to `log2` scale using `step_mic_log2()`, which
-prepares MIC values for use in classification models.
+includes a transformation to `log2` scale using
+[`step_mic_log2()`](https://amr-for-r.org/reference/amr-tidymodels.md),
+which prepares MIC values for use in classification models.
This approach and idea formed the basis for the publication [DOI:
10.3389/fmicb.2025.1582703](https://doi.org/10.3389/fmicb.2025.1582703)
-to model the presence of extended-spectrum beta-lactamases (ESBL).
+to model the presence of extended-spectrum beta-lactamases (ESBL) based
+on MIC values.
-> NOTE: THIS EXAMPLE WILL BE AVAILABLE IN A NEXT VERSION (#TODO)
->
-> The new AMR package version will contain new tidymodels selectors such
-> as `step_mic_log2()`.
+### **Objective**
+
+Our goal is to:
+
+1. Use raw MIC values to predict whether a bacterial isolate produces
+ ESBL.
+2. Apply AMR-aware preprocessing in a `tidymodels` recipe.
+3. Train a classification model and evaluate its predictive
+ performance.
+
+### **Data Preparation**
+
+We use the `esbl_isolates` dataset that comes with the AMR package.
+
+``` r
+# Load required libraries
+library(AMR)
+library(tidymodels)
+
+# View the esbl_isolates data set
+esbl_isolates
+#> # A tibble: 500 × 19
+#> esbl genus AMC AMP TZP CXM FOX CTX CAZ GEN TOB TMP SXT
+#>
+#> 1 FALSE Esch… 32 32 4 64 64 8.00 8.00 1 1 16.0 20
+#> 2 FALSE Esch… 32 32 4 64 64 4.00 8.00 1 1 16.0 320
+#> 3 FALSE Esch… 4 2 64 8 4 8.00 0.12 16 16 0.5 20
+#> 4 FALSE Kleb… 32 32 16 64 64 8.00 8.00 1 1 0.5 20
+#> 5 FALSE Esch… 32 32 4 4 4 0.25 2.00 1 1 16.0 320
+#> 6 FALSE Citr… 32 32 16 64 64 64.00 32.00 1 1 0.5 20
+#> 7 FALSE Morg… 32 32 4 64 64 16.00 2.00 1 1 0.5 20
+#> 8 FALSE Prot… 16 32 4 1 4 8.00 0.12 1 1 16.0 320
+#> 9 FALSE Ente… 32 32 8 64 64 32.00 4.00 1 1 0.5 20
+#> 10 FALSE Citr… 32 32 32 64 64 8.00 64.00 1 1 16.0 320
+#> # ℹ 490 more rows
+#> # ℹ 6 more variables: NIT , FOS , CIP , IPM , MEM ,
+#> # COL
+
+# Prepare a binary outcome and convert to ordered factor
+data <- esbl_isolates %>%
+ mutate(esbl = factor(esbl, levels = c(FALSE, TRUE), ordered = TRUE))
+```
+
+**Explanation:**
+
+- `esbl_isolates`: Contains MIC test results and ESBL status for each
+ isolate.
+- `mutate(esbl = ...)`: Converts the target column to an ordered factor
+ for classification.
+
+### **Defining the Workflow**
+
+#### 1. Preprocessing with a Recipe
+
+We use our
+[`step_mic_log2()`](https://amr-for-r.org/reference/amr-tidymodels.md)
+function to log2-transform MIC values, ensuring that MICs are numeric
+and properly scaled. All MIC predictors can easily and agnostically
+selected using the new
+[`all_mic_predictors()`](https://amr-for-r.org/reference/amr-tidymodels.md):
+
+``` r
+# Split into training and testing sets
+set.seed(123)
+split <- initial_split(data)
+training_data <- training(split)
+testing_data <- testing(split)
+
+# Define the recipe
+mic_recipe <- recipe(esbl ~ ., data = training_data) %>%
+ remove_role(genus, old_role = "predictor") %>% # Remove non-informative variable
+ step_mic_log2(all_mic_predictors()) #%>% # Log2 transform all MIC predictors
+ # prep()
+
+mic_recipe
+#>
+#> ── Recipe ──────────────────────────────────────────────────────────────────────
+#>
+#> ── Inputs
+#> Number of variables by role
+#> outcome: 1
+#> predictor: 17
+#> undeclared role: 1
+#>
+#> ── Operations
+#> • Log2 transformation of MIC columns: all_mic_predictors()
+```
+
+**Explanation:**
+
+- `remove_role()`: Removes irrelevant variables like genus.
+- [`step_mic_log2()`](https://amr-for-r.org/reference/amr-tidymodels.md):
+ Applies `log2(as.numeric(...))` to all MIC predictors in one go.
+- `prep()`: Finalises the recipe based on training data.
+
+#### 2. Specifying the Model
+
+We use a simple logistic regression to model ESBL presence, though
+recent models such as xgboost ([link to `parsnip`
+manual](https://parsnip.tidymodels.org/reference/details_boost_tree_xgboost.html))
+could be much more precise.
+
+``` r
+# Define the model
+model <- logistic_reg(mode = "classification") %>%
+ set_engine("glm")
+
+model
+#> Logistic Regression Model Specification (classification)
+#>
+#> Computational engine: glm
+```
+
+**Explanation:**
+
+- `logistic_reg()`: Specifies a binary classification model.
+- `set_engine("glm")`: Uses the base R GLM engine.
+
+#### 3. Building the Workflow
+
+``` r
+# Create workflow
+workflow_model <- workflow() %>%
+ add_recipe(mic_recipe) %>%
+ add_model(model)
+
+workflow_model
+#> ══ Workflow ════════════════════════════════════════════════════════════════════
+#> Preprocessor: Recipe
+#> Model: logistic_reg()
+#>
+#> ── Preprocessor ────────────────────────────────────────────────────────────────
+#> 1 Recipe Step
+#>
+#> • step_mic_log2()
+#>
+#> ── Model ───────────────────────────────────────────────────────────────────────
+#> Logistic Regression Model Specification (classification)
+#>
+#> Computational engine: glm
+```
+
+### **Training and Evaluating the Model**
+
+``` r
+# Fit the model
+fitted <- fit(workflow_model, training_data)
+
+# Generate predictions
+predictions <- predict(fitted, testing_data) %>%
+ bind_cols(predict(fitted, testing_data, type = "prob")) %>% # add probabilities
+ bind_cols(testing_data)
+
+# Evaluate model performance
+our_metrics <- metric_set(accuracy, recall, precision, sensitivity, specificity, ppv, npv)
+metrics <- our_metrics(predictions, truth = esbl, estimate = .pred_class)
+
+metrics
+#> # A tibble: 7 × 3
+#> .metric .estimator .estimate
+#>
+#> 1 accuracy binary 0.92
+#> 2 recall binary 0.921
+#> 3 precision binary 0.921
+#> 4 sensitivity binary 0.921
+#> 5 specificity binary 0.919
+#> 6 ppv binary 0.921
+#> 7 npv binary 0.919
+```
+
+**Explanation:**
+
+- `fit()`: Trains the model on the processed training data.
+- [`predict()`](https://rdrr.io/r/stats/predict.html): Produces
+ predictions for unseen test data.
+- `metric_set()`: Allows evaluating multiple classification metrics.
+ This will make `our_metrics` to become a function that we can use to
+ check the predictions with.
+
+It appears we can predict ESBL gene presence with a positive predictive
+value (PPV) of 92.1% and a negative predictive value (NPV) of 91.9 using
+a simplistic logistic regression model.
+
+### **Visualising Predictions**
+
+We can visualise predictions by comparing predicted and actual ESBL
+status.
+
+``` r
+library(ggplot2)
+
+ggplot(predictions, aes(x = esbl, fill = .pred_class)) +
+ geom_bar(position = "stack") +
+ labs(title = "Predicted vs Actual ESBL Status",
+ x = "Actual ESBL",
+ y = "Count") +
+ theme_minimal()
+```
+
+
+
+And plot the certainties too - how certain were the actual predictions?
+
+``` r
+predictions %>%
+ mutate(certainty = ifelse(.pred_class == "FALSE",
+ .pred_FALSE,
+ .pred_TRUE),
+ correct = ifelse(esbl == .pred_class, "Right", "Wrong")) %>%
+ ggplot(aes(x = seq_len(nrow(predictions)),
+ y = certainty,
+ colour = correct)) +
+ scale_colour_manual(values = c(Right = "green3", Wrong = "red2"),
+ name = "Correct?") +
+ geom_point() +
+ scale_y_continuous(labels = function(x) paste0(x * 100, "%"),
+ limits = c(0.5, 1)) +
+ theme_minimal()
+```
+
+ \###
+**Conclusion**
+
+In this example, we showcased how the new `AMR`-specific recipe steps
+simplify working with `` columns in `tidymodels`. The
+[`step_mic_log2()`](https://amr-for-r.org/reference/amr-tidymodels.md)
+transformation converts ordered MICs to log2-transformed numerics,
+improving compatibility with classification models.
+
+This pipeline enables realistic, reproducible, and interpretable
+modelling of antimicrobial resistance data.
------------------------------------------------------------------------
-## Example 2: Predicting AMR Over Time
+## Example 3: Predicting AMR Over Time
In this third example, we aim to predict antimicrobial resistance (AMR)
trends over time using `tidymodels`. We will model resistance to three
@@ -573,7 +802,7 @@ ggplot(predictions_time, aes(x = year)) +
theme_minimal()
```
-
+
Additionally, we can visualise resistance trends in `ggplot2` and
directly add linear models there:
@@ -591,7 +820,7 @@ ggplot(data_time, aes(x = year, y = res_AMX, color = gramstain)) +
theme_minimal()
```
-
+
### **Conclusion**
diff --git a/articles/AMR_with_tidymodels_files/figure-html/unnamed-chunk-14-1.png b/articles/AMR_with_tidymodels_files/figure-html/unnamed-chunk-14-1.png
index a4c4c0185..09e769ea7 100644
Binary files a/articles/AMR_with_tidymodels_files/figure-html/unnamed-chunk-14-1.png and b/articles/AMR_with_tidymodels_files/figure-html/unnamed-chunk-14-1.png differ
diff --git a/articles/AMR_with_tidymodels_files/figure-html/unnamed-chunk-15-1.png b/articles/AMR_with_tidymodels_files/figure-html/unnamed-chunk-15-1.png
index 96c1ecedb..79c49fa5b 100644
Binary files a/articles/AMR_with_tidymodels_files/figure-html/unnamed-chunk-15-1.png and b/articles/AMR_with_tidymodels_files/figure-html/unnamed-chunk-15-1.png differ
diff --git a/articles/AMR_with_tidymodels_files/figure-html/unnamed-chunk-21-1.png b/articles/AMR_with_tidymodels_files/figure-html/unnamed-chunk-21-1.png
new file mode 100644
index 000000000..a4c4c0185
Binary files /dev/null and b/articles/AMR_with_tidymodels_files/figure-html/unnamed-chunk-21-1.png differ
diff --git a/articles/AMR_with_tidymodels_files/figure-html/unnamed-chunk-22-1.png b/articles/AMR_with_tidymodels_files/figure-html/unnamed-chunk-22-1.png
new file mode 100644
index 000000000..96c1ecedb
Binary files /dev/null and b/articles/AMR_with_tidymodels_files/figure-html/unnamed-chunk-22-1.png differ
diff --git a/articles/EUCAST.html b/articles/EUCAST.html
index 5687512fd..9e045a3b4 100644
--- a/articles/EUCAST.html
+++ b/articles/EUCAST.html
@@ -30,7 +30,7 @@
AMR (for R)
- 3.0.1.9004
+ 3.0.1.9007
diff --git a/articles/PCA.html b/articles/PCA.html
index b3bf0b8a9..5bcc2e863 100644
--- a/articles/PCA.html
+++ b/articles/PCA.html
@@ -30,7 +30,7 @@
AMR (for R)
- 3.0.1.9004
+ 3.0.1.9007
@@ -210,18 +210,18 @@ per drug explain the difference per microorganism.
But we can’t see the explanation of the points. Perhaps this works
better with our new ggplot_pca() function, that
automatically adds the right labels and even groups:
diff --git a/articles/index.html b/articles/index.html
index 070e70b73..3691db919 100644
--- a/articles/index.html
+++ b/articles/index.html
@@ -7,7 +7,7 @@
AMR (for R)
- 3.0.1.9004
+ 3.0.1.9007
diff --git a/authors.html b/authors.html
index c5e88d108..b298aab7e 100644
--- a/authors.html
+++ b/authors.html
@@ -7,7 +7,7 @@
AMR (for R)
- 3.0.1.9004
+ 3.0.1.9007
diff --git a/index.html b/index.html
index 80db3b078..3773b2d9d 100644
--- a/index.html
+++ b/index.html
@@ -33,7 +33,7 @@
AMR (for R)
- 3.0.1.9004
+ 3.0.1.9007
diff --git a/llms.txt b/llms.txt
index 8a1a7bd45..2f258a948 100644
--- a/llms.txt
+++ b/llms.txt
@@ -859,6 +859,8 @@ information about how to work with functions in this package.
: Data Set with Clinical Breakpoints for SIR Interpretation
- [`example_isolates`](https://amr-for-r.org/reference/example_isolates.md)
: Data Set with 2 000 Example Isolates
+- [`esbl_isolates`](https://amr-for-r.org/reference/esbl_isolates.md) :
+ Data Set with 500 ESBL Isolates
- [`microorganisms.codes`](https://amr-for-r.org/reference/microorganisms.codes.md)
: Data Set with 6 036 Common Microorganism Codes
- [`microorganisms.groups`](https://amr-for-r.org/reference/microorganisms.groups.md)
diff --git a/news/index.html b/news/index.html
index 3565e213a..4a55bb50a 100644
--- a/news/index.html
+++ b/news/index.html
@@ -7,7 +7,7 @@
AMR (for R)
- 3.0.1.9004
+ 3.0.1.9007
@@ -49,9 +49,19 @@
-
AMR 3.0.1.9004
+
AMR 3.0.1.9007
-
Changed
+
New
+
Integration with the tidymodels framework to allow seamless use of SIR, MIC and disk data in modelling pipelines via recipes
+
Data set esbl_isolates to practise with AMR modelling
+
+
+
Changed
Fixed a bug in antibiogram() for when no antimicrobials are set
Added taniborbactam (TAN) and cefepime/taniborbactam (FTA) to the antimicrobials data set
Fixed a bug in as.sir() where for numeric input the arguments S, i, and R would not be considered (#244)
@@ -104,7 +114,7 @@
This package now supports not only tools for AMR data analysis in clinical settings, but also for veterinary and environmental microbiology. This was made possible through a collaboration with the University of Prince Edward Island’s Atlantic Veterinary College, Canada. To celebrate this great improvement of the package, we also updated the package logo to reflect this change.
Breaking
-
Dataset antibiotics has been renamed to antimicrobials as the data set contains more than just antibiotics. Using antibiotics will still work, but now returns a warning.
+
Data set antibiotics has been renamed to antimicrobials as the data set contains more than just antibiotics. Using antibiotics will still work, but now returns a warning.
Removed all functions and references that used the deprecated rsi class, which were all replaced with their sir equivalents over two years ago.
The antibiogram() function now supports creating true Weighted-Incidence Syndromic Combination Antibiograms (WISCA), a powerful Bayesian method for estimating regimen coverage probabilities using pathogen incidence and antimicrobial susceptibility data. WISCA offers improved precision for syndrome-specific treatment, even in datasets with sparse data. A dedicated wisca() function is also available for easy usage.
+
The antibiogram() function now supports creating true Weighted-Incidence Syndromic Combination Antibiograms (WISCA), a powerful Bayesian method for estimating regimen coverage probabilities using pathogen incidence and antimicrobial susceptibility data. WISCA offers improved precision for syndrome-specific treatment, even in data sets with sparse data. A dedicated wisca() function is also available for easy usage.
More global coverage of languages
diff --git a/news/index.md b/news/index.md
index cd082253c..e44a424b0 100644
--- a/news/index.md
+++ b/news/index.md
@@ -1,6 +1,23 @@
# Changelog
-## AMR 3.0.1.9004
+## AMR 3.0.1.9007
+
+#### New
+
+- Integration with the **tidymodels** framework to allow seamless use of
+ SIR, MIC and disk data in modelling pipelines via `recipes`
+ - [`step_mic_log2()`](https://amr-for-r.org/reference/amr-tidymodels.md)
+ to transform `` columns with log2, and
+ [`step_sir_numeric()`](https://amr-for-r.org/reference/amr-tidymodels.md)
+ to convert `` columns to numeric
+ - New `tidyselect` helpers:
+ [`all_sir()`](https://amr-for-r.org/reference/amr-tidymodels.md),
+ [`all_sir_predictors()`](https://amr-for-r.org/reference/amr-tidymodels.md),
+ [`all_mic()`](https://amr-for-r.org/reference/amr-tidymodels.md),
+ [`all_mic_predictors()`](https://amr-for-r.org/reference/amr-tidymodels.md),
+ [`all_disk()`](https://amr-for-r.org/reference/amr-tidymodels.md),
+ [`all_disk_predictors()`](https://amr-for-r.org/reference/amr-tidymodels.md)
+- Data set `esbl_isolates` to practise with AMR modelling
#### Changed
@@ -119,8 +136,8 @@ this change.
#### Breaking
-- Dataset `antibiotics` has been renamed to `antimicrobials` as the data
- set contains more than just antibiotics. Using `antibiotics` will
+- Data set `antibiotics` has been renamed to `antimicrobials` as the
+ data set contains more than just antibiotics. Using `antibiotics` will
still work, but now returns a warning.
- Removed all functions and references that used the deprecated `rsi`
class, which were all replaced with their `sir` equivalents over two
@@ -158,7 +175,7 @@ this change.
Combination Antibiograms (WISCA), a powerful Bayesian method for
estimating regimen coverage probabilities using pathogen incidence
and antimicrobial susceptibility data. WISCA offers improved
- precision for syndrome-specific treatment, even in datasets with
+ precision for syndrome-specific treatment, even in data sets with
sparse data. A dedicated
[`wisca()`](https://amr-for-r.org/reference/antibiogram.md) function
is also available for easy usage.
diff --git a/pkgdown.yml b/pkgdown.yml
index 9cf64ec60..d9d3a2b5e 100644
--- a/pkgdown.yml
+++ b/pkgdown.yml
@@ -10,7 +10,7 @@ articles:
PCA: PCA.html
WHONET: WHONET.html
WISCA: WISCA.html
-last_built: 2025-12-15T12:28Z
+last_built: 2025-12-22T08:44Z
urls:
reference: https://amr-for-r.org/reference
article: https://amr-for-r.org/articles
diff --git a/reference/AMR-deprecated.html b/reference/AMR-deprecated.html
index 3cb954b0b..16931715b 100644
--- a/reference/AMR-deprecated.html
+++ b/reference/AMR-deprecated.html
@@ -7,7 +7,7 @@
AMR (for R)
- 3.0.1.9004
+ 3.0.1.9007
diff --git a/reference/AMR-options.html b/reference/AMR-options.html
index ed6ed3a13..1df3ceb65 100644
--- a/reference/AMR-options.html
+++ b/reference/AMR-options.html
@@ -7,7 +7,7 @@
AMR (for R)
- 3.0.1.9004
+ 3.0.1.9007
diff --git a/reference/AMR.html b/reference/AMR.html
index 5542bb480..d9d0e316a 100644
--- a/reference/AMR.html
+++ b/reference/AMR.html
@@ -21,7 +21,7 @@ The AMR package is available in English, Arabic, Bengali, Chinese, Czech, Danish
AMR (for R)
- 3.0.1.9004
+ 3.0.1.9007
diff --git a/reference/WHOCC.html b/reference/WHOCC.html
index 577ba75b6..50df1e272 100644
--- a/reference/WHOCC.html
+++ b/reference/WHOCC.html
@@ -7,7 +7,7 @@
AMR (for R)
- 3.0.1.9004
+ 3.0.1.9007
diff --git a/reference/WHONET.html b/reference/WHONET.html
index d98df6895..2d31f0e64 100644
--- a/reference/WHONET.html
+++ b/reference/WHONET.html
@@ -7,7 +7,7 @@
AMR (for R)
- 3.0.1.9004
+ 3.0.1.9007
diff --git a/reference/ab_from_text.html b/reference/ab_from_text.html
index 4246a01e2..8a247fd41 100644
--- a/reference/ab_from_text.html
+++ b/reference/ab_from_text.html
@@ -7,7 +7,7 @@
AMR (for R)
- 3.0.1.9004
+ 3.0.1.9007
diff --git a/reference/ab_property.html b/reference/ab_property.html
index 3248aa63d..2d1820497 100644
--- a/reference/ab_property.html
+++ b/reference/ab_property.html
@@ -7,7 +7,7 @@
AMR (for R)
- 3.0.1.9004
+ 3.0.1.9007
diff --git a/reference/add_custom_antimicrobials.html b/reference/add_custom_antimicrobials.html
index 1316bfd61..f363f5750 100644
--- a/reference/add_custom_antimicrobials.html
+++ b/reference/add_custom_antimicrobials.html
@@ -7,7 +7,7 @@
AMR (for R)
- 3.0.1.9004
+ 3.0.1.9007
diff --git a/reference/add_custom_microorganisms.html b/reference/add_custom_microorganisms.html
index 04854530b..bfae9cfa0 100644
--- a/reference/add_custom_microorganisms.html
+++ b/reference/add_custom_microorganisms.html
@@ -7,7 +7,7 @@
AMR (for R)
- 3.0.1.9004
+ 3.0.1.9007
diff --git a/reference/age.html b/reference/age.html
index b21db5aef..c77de6fb7 100644
--- a/reference/age.html
+++ b/reference/age.html
@@ -7,7 +7,7 @@
AMR (for R)
- 3.0.1.9004
+ 3.0.1.9007
@@ -112,16 +112,16 @@
df#> birth_date age age_exact age_at_y2k
-#> 1 1980-02-27 45 45.79726 19
-#> 2 1953-07-26 72 72.38904 46
-#> 3 1949-09-02 76 76.28493 50
-#> 4 1986-08-03 39 39.36712 13
-#> 5 1932-11-19 93 93.07123 67
-#> 6 1949-03-30 76 76.71233 50
-#> 7 1996-06-23 29 29.47945 3
-#> 8 1963-09-16 62 62.24658 36
-#> 9 1952-05-16 73 73.58356 47
-#> 10 1952-11-14 73 73.08493 47
+#> 1 1980-02-27 45 45.81644 19
+#> 2 1953-07-26 72 72.40822 46
+#> 3 1949-09-02 76 76.30411 50
+#> 4 1986-08-03 39 39.38630 13
+#> 5 1932-11-19 93 93.09041 67
+#> 6 1949-03-30 76 76.73151 50
+#> 7 1996-06-23 29 29.49863 3
+#> 8 1963-09-16 62 62.26575 36
+#> 9 1952-05-16 73 73.60274 47
+#> 10 1952-11-14 73 73.10411 47
-
WISCA uses a sophisticated Bayesian decision model to combine both local and pooled antimicrobial resistance data. This approach not only evaluates local patterns but can also draw on multi-centre datasets to improve regimen accuracy, even in low-incidence infections like paediatric bloodstream infections (BSIs).
+
WISCA uses a sophisticated Bayesian decision model to combine both local and pooled antimicrobial resistance data. This approach not only evaluates local patterns but can also draw on multi-centre data sets to improve regimen accuracy, even in low-incidence infections like paediatric bloodstream infections (BSIs).
@@ -587,9 +587,9 @@ Adhering to previously described approaches (see Source) and especially the Baye
#># Type: WISCA with 95% CI#> `Syndromic Group` `Piperacillin/tazobactam` Piperacillin/tazobactam + Gentam…¹#><chr><chr><chr>
-#>1 Clinical 73.4% (67.6-78.6%) 92.4% (90.6-93.7%)
-#>2 ICU 57.4% (49.7-65.6%) 85% (82.1-87.6%)
-#>3 Outpatient 56.9% (46.9-66.7%) 74.4% (69-79.7%)
+#>1 Clinical 73.5% (68.1-78.6%) 92.3% (90.8-93.8%)
+#>2 ICU 57.3% (49.8-64.9%) 84.8% (82-87.7%)
+#>3 Outpatient 56.8% (47-67%) 74.4% (68.6-79.7%) #># ℹ abbreviated name: ¹`Piperacillin/tazobactam + Gentamicin`#># ℹ 1 more variable: `Piperacillin/tazobactam + Tobramycin` <chr>#># Use `ggplot2::autoplot()` or base R `plot()` to create a plot of this antibiogram,
@@ -614,9 +614,9 @@ Adhering to previously described approaches (see Source) and especially the Baye
#>#> |Syndromic Group |Piperacillin/tazobactam |#> |:---------------|:-----------------------|
-#> |Clinical |73.6% (68.4-79%) |
-#> |ICU |57.4% (49.7-65.4%) |
-#> |Outpatient |57% (47.2-66.7%) |
+#> |Clinical |73.6% (68.5-78.7%) |
+#> |ICU |57.4% (49.3-65.8%) |
+#> |Outpatient |57% (47.1-67.3%) |# Generate plots with ggplot2 or base R --------------------------------
diff --git a/reference/antibiogram.md b/reference/antibiogram.md
index 8cd532ffd..86242c681 100644
--- a/reference/antibiogram.md
+++ b/reference/antibiogram.md
@@ -427,9 +427,9 @@ pathogen, but rather by syndrome.
WISCA uses a sophisticated Bayesian decision model to combine both
local and pooled antimicrobial resistance data. This approach not
- only evaluates local patterns but can also draw on multi-centre
- datasets to improve regimen accuracy, even in low-incidence
- infections like paediatric bloodstream infections (BSIs).
+ only evaluates local patterns but can also draw on multi-centre data
+ sets to improve regimen accuracy, even in low-incidence infections
+ like paediatric bloodstream infections (BSIs).
### Grouped tibbles
@@ -777,9 +777,9 @@ antibiogram(example_isolates,
#> # Type: WISCA with 95% CI
#> `Syndromic Group` `Piperacillin/tazobactam` Piperacillin/tazobactam + Gentam…¹
#>
-#> 1 Clinical 73.4% (67.6-78.6%) 92.4% (90.6-93.7%)
-#> 2 ICU 57.4% (49.7-65.6%) 85% (82.1-87.6%)
-#> 3 Outpatient 56.9% (46.9-66.7%) 74.4% (69-79.7%)
+#> 1 Clinical 73.5% (68.1-78.6%) 92.3% (90.8-93.8%)
+#> 2 ICU 57.3% (49.8-64.9%) 84.8% (82-87.7%)
+#> 3 Outpatient 56.8% (47-67%) 74.4% (68.6-79.7%)
#> # ℹ abbreviated name: ¹`Piperacillin/tazobactam + Gentamicin`
#> # ℹ 1 more variable: `Piperacillin/tazobactam + Tobramycin`
#> # Use `ggplot2::autoplot()` or base R `plot()` to create a plot of this antibiogram,
@@ -804,9 +804,9 @@ if (requireNamespace("knitr")) {
#>
#> |Syndromic Group |Piperacillin/tazobactam |
#> |:---------------|:-----------------------|
-#> |Clinical |73.6% (68.4-79%) |
-#> |ICU |57.4% (49.7-65.4%) |
-#> |Outpatient |57% (47.2-66.7%) |
+#> |Clinical |73.6% (68.5-78.7%) |
+#> |ICU |57.4% (49.3-65.8%) |
+#> |Outpatient |57% (47.1-67.3%) |
# Generate plots with ggplot2 or base R --------------------------------
diff --git a/reference/antimicrobial_selectors.html b/reference/antimicrobial_selectors.html
index bbda9499a..808488158 100644
--- a/reference/antimicrobial_selectors.html
+++ b/reference/antimicrobial_selectors.html
@@ -17,7 +17,7 @@ my_data_with_all_these_columns %>%
AMR (for R)
- 3.0.1.9004
+ 3.0.1.9007
@@ -670,6 +670,9 @@ my_data_with_all_these_columns %>%
#> Loading required package: data.table#>#> Attaching package: ‘data.table’
+#> The following object is masked from ‘package:purrr’:
+#>
+#> transpose#> The following objects are masked from ‘package:dplyr’:#>#> between, first, last
diff --git a/reference/antimicrobial_selectors.md b/reference/antimicrobial_selectors.md
index 3ee2c076d..9efe9397b 100644
--- a/reference/antimicrobial_selectors.md
+++ b/reference/antimicrobial_selectors.md
@@ -1013,6 +1013,9 @@ if (require("data.table")) {
#> Loading required package: data.table
#>
#> Attaching package: ‘data.table’
+#> The following object is masked from ‘package:purrr’:
+#>
+#> transpose
#> The following objects are masked from ‘package:dplyr’:
#>
#> between, first, last
diff --git a/reference/antimicrobials.html b/reference/antimicrobials.html
index f8308b604..d94c888ad 100644
--- a/reference/antimicrobials.html
+++ b/reference/antimicrobials.html
@@ -9,7 +9,7 @@ The antibiotics data set has been renamed to antimicrobials. The old name will b
AMR (for R)
- 3.0.1.9004
+ 3.0.1.9007
diff --git a/reference/as.ab.html b/reference/as.ab.html
index 985b21861..4e468cdb1 100644
--- a/reference/as.ab.html
+++ b/reference/as.ab.html
@@ -7,7 +7,7 @@
AMR (for R)
- 3.0.1.9004
+ 3.0.1.9007
diff --git a/reference/as.av.html b/reference/as.av.html
index cb49b7b21..73b41616c 100644
--- a/reference/as.av.html
+++ b/reference/as.av.html
@@ -7,7 +7,7 @@
AMR (for R)
- 3.0.1.9004
+ 3.0.1.9007
diff --git a/reference/as.disk.html b/reference/as.disk.html
index d36d26f1e..faa5510ef 100644
--- a/reference/as.disk.html
+++ b/reference/as.disk.html
@@ -7,7 +7,7 @@
AMR (for R)
- 3.0.1.9004
+ 3.0.1.9007
diff --git a/reference/as.mic.html b/reference/as.mic.html
index b4b8359c3..910d42bab 100644
--- a/reference/as.mic.html
+++ b/reference/as.mic.html
@@ -7,7 +7,7 @@
AMR (for R)
- 3.0.1.9004
+ 3.0.1.9007
diff --git a/reference/as.mo.html b/reference/as.mo.html
index f3e6ff7d3..6bb4f00f1 100644
--- a/reference/as.mo.html
+++ b/reference/as.mo.html
@@ -7,7 +7,7 @@
AMR (for R)
- 3.0.1.9004
+ 3.0.1.9007
diff --git a/reference/as.sir.html b/reference/as.sir.html
index 72a53a4de..e5df904b5 100644
--- a/reference/as.sir.html
+++ b/reference/as.sir.html
@@ -9,7 +9,7 @@ Breakpoints are currently implemented from EUCAST 2011-2025 and CLSI 2011-2025,
AMR (for R)
- 3.0.1.9004
+ 3.0.1.9007
@@ -416,10 +416,10 @@ Breakpoints are currently implemented from EUCAST 2011-2025 and CLSI 2011-2025,
#># A tibble: 4 × 18#> datetime index method ab_given mo_given host_given input_given#><dttm><int><chr><chr><chr><chr><chr>
-#>1 2025-12-15 12:29:02 1 MIC amoxicillin Escherich… human 8
-#>2 2025-12-15 12:29:02 1 MIC cipro Escherich… human 0.256
-#>3 2025-12-15 12:29:02 1 DISK tobra Escherich… human 16
-#>4 2025-12-15 12:29:03 1 DISK genta Escherich… human 18
+#>1 2025-12-22 08:45:24 1 MIC amoxicillin Escherich… human 8
+#>2 2025-12-22 08:45:24 1 MIC cipro Escherich… human 0.256
+#>3 2025-12-22 08:45:24 1 DISK tobra Escherich… human 16
+#>4 2025-12-22 08:45:24 1 DISK genta Escherich… human 18 #># ℹ 11 more variables: ab <ab>, mo <mo>, host <chr>, input <chr>,#># outcome <sir>, notes <chr>, guideline <chr>, ref_table <chr>, uti <lgl>,#># breakpoint_S_R <chr>, site <chr>
@@ -620,12 +620,12 @@ Breakpoints are currently implemented from EUCAST 2011-2025 and CLSI 2011-2025,
# For CLEANING existing SIR values -------------------------------------as.sir(c("S", "SDD", "I", "R", "NI", "A", "B", "C"))
-#>Warning: in `as.sir()`: 3 results in index '20' truncated (38%) that were invalid
+#>Warning: in `as.sir()`: 3 results in index '21' truncated (38%) that were invalid#> antimicrobial interpretations: "A", "B", and "C"#> Class 'sir'#> [1] S SDD I R NI <NA> <NA> <NA>as.sir("<= 0.002; S")# will return "S"
-#>Warning: in `as.sir()`: 1 result in index '20' truncated (100%) that were invalid
+#>Warning: in `as.sir()`: 1 result in index '21' truncated (100%) that were invalid#> antimicrobial interpretations: "<= 0.002; S"#> Class 'sir'#> [1] <NA>
diff --git a/reference/as.sir.md b/reference/as.sir.md
index eed483ea3..99cf6ce5b 100644
--- a/reference/as.sir.md
+++ b/reference/as.sir.md
@@ -648,10 +648,10 @@ sir_interpretation_history()
#> # A tibble: 4 × 18
#> datetime index method ab_given mo_given host_given input_given
#>
-#> 1 2025-12-15 12:29:02 1 MIC amoxicillin Escherich… human 8
-#> 2 2025-12-15 12:29:02 1 MIC cipro Escherich… human 0.256
-#> 3 2025-12-15 12:29:02 1 DISK tobra Escherich… human 16
-#> 4 2025-12-15 12:29:03 1 DISK genta Escherich… human 18
+#> 1 2025-12-22 08:45:24 1 MIC amoxicillin Escherich… human 8
+#> 2 2025-12-22 08:45:24 1 MIC cipro Escherich… human 0.256
+#> 3 2025-12-22 08:45:24 1 DISK tobra Escherich… human 16
+#> 4 2025-12-22 08:45:24 1 DISK genta Escherich… human 18
#> # ℹ 11 more variables: ab , mo , host , input ,
#> # outcome , notes , guideline , ref_table , uti ,
#> # breakpoint_S_R , site
@@ -852,12 +852,12 @@ as.sir(
# For CLEANING existing SIR values -------------------------------------
as.sir(c("S", "SDD", "I", "R", "NI", "A", "B", "C"))
-#> Warning: in `as.sir()`: 3 results in index '20' truncated (38%) that were invalid
+#> Warning: in `as.sir()`: 3 results in index '21' truncated (38%) that were invalid
#> antimicrobial interpretations: "A", "B", and "C"
#> Class 'sir'
#> [1] S SDD I R NI
as.sir("<= 0.002; S") # will return "S"
-#> Warning: in `as.sir()`: 1 result in index '20' truncated (100%) that were invalid
+#> Warning: in `as.sir()`: 1 result in index '21' truncated (100%) that were invalid
#> antimicrobial interpretations: "<= 0.002; S"
#> Class 'sir'
#> [1]
diff --git a/reference/atc_online.html b/reference/atc_online.html
index 480136491..ec685a5d6 100644
--- a/reference/atc_online.html
+++ b/reference/atc_online.html
@@ -7,7 +7,7 @@
AMR (for R)
- 3.0.1.9004
+ 3.0.1.9007
diff --git a/reference/av_from_text.html b/reference/av_from_text.html
index bde8c8e73..dd76e4ef4 100644
--- a/reference/av_from_text.html
+++ b/reference/av_from_text.html
@@ -7,7 +7,7 @@
AMR (for R)
- 3.0.1.9004
+ 3.0.1.9007
diff --git a/reference/av_property.html b/reference/av_property.html
index 945c47b32..678859212 100644
--- a/reference/av_property.html
+++ b/reference/av_property.html
@@ -7,7 +7,7 @@
AMR (for R)
- 3.0.1.9004
+ 3.0.1.9007
diff --git a/reference/availability.html b/reference/availability.html
index 16fe3e253..180001d45 100644
--- a/reference/availability.html
+++ b/reference/availability.html
@@ -7,7 +7,7 @@
AMR (for R)
- 3.0.1.9004
+ 3.0.1.9007
diff --git a/reference/bug_drug_combinations.html b/reference/bug_drug_combinations.html
index 198f65b27..8ff0abd84 100644
--- a/reference/bug_drug_combinations.html
+++ b/reference/bug_drug_combinations.html
@@ -7,7 +7,7 @@
AMR (for R)
- 3.0.1.9004
+ 3.0.1.9007
diff --git a/reference/clinical_breakpoints.html b/reference/clinical_breakpoints.html
index 5744b0f94..e50f9e432 100644
--- a/reference/clinical_breakpoints.html
+++ b/reference/clinical_breakpoints.html
@@ -1,12 +1,12 @@
-Data Set with Clinical Breakpoints for SIR Interpretation — clinical_breakpoints • AMR (for R)Data Set with Clinical Breakpoints for SIR Interpretation — clinical_breakpoints • AMR (for R)AMR (for R)
- 3.0.1.9004
+ 3.0.1.9007
@@ -64,7 +64,7 @@ Use as.sir() to transform MICs or disks measurements to SIR values.">
-
Data set containing clinical breakpoints to interpret MIC and disk diffusion to SIR values, according to international guidelines. This dataset contain breakpoints for humans, 7 different animal groups, and ECOFFs.
+
Data set containing clinical breakpoints to interpret MIC and disk diffusion to SIR values, according to international guidelines. This data set contains breakpoints for humans, 7 different animal groups, and ECOFFs.
These breakpoints are currently implemented:
For clinical microbiology: EUCAST 2011-2025 and CLSI 2011-2025;
For veterinary microbiology: EUCAST 2021-2025 and CLSI 2019-2025;
For ECOFFs (Epidemiological Cut-off Values): EUCAST 2020-2025 and CLSI 2022-2025.
diff --git a/reference/clinical_breakpoints.md b/reference/clinical_breakpoints.md
index a628480b0..bd632457a 100644
--- a/reference/clinical_breakpoints.md
+++ b/reference/clinical_breakpoints.md
@@ -2,7 +2,7 @@
Data set containing clinical breakpoints to interpret MIC and disk
diffusion to SIR values, according to international guidelines. This
-dataset contain breakpoints for humans, 7 different animal groups, and
+data set contains breakpoints for humans, 7 different animal groups, and
ECOFFs.
These breakpoints are currently implemented:
diff --git a/reference/count.html b/reference/count.html
index dbd6f9a82..0e1440ff3 100644
--- a/reference/count.html
+++ b/reference/count.html
@@ -9,7 +9,7 @@ count_resistant() should be used to count resistant isolates, count_susceptible(
AMR (for R)
- 3.0.1.9004
+ 3.0.1.9007
diff --git a/reference/custom_eucast_rules.html b/reference/custom_eucast_rules.html
index 1f1ea1d03..1bddb658e 100644
--- a/reference/custom_eucast_rules.html
+++ b/reference/custom_eucast_rules.html
@@ -7,7 +7,7 @@
AMR (for R)
- 3.0.1.9004
+ 3.0.1.9007
diff --git a/reference/custom_mdro_guideline.html b/reference/custom_mdro_guideline.html
index 87a0da9a4..c9404872d 100644
--- a/reference/custom_mdro_guideline.html
+++ b/reference/custom_mdro_guideline.html
@@ -7,7 +7,7 @@
AMR (for R)
- 3.0.1.9004
+ 3.0.1.9007
diff --git a/reference/dosage.html b/reference/dosage.html
index 7466b1fac..7ec78786c 100644
--- a/reference/dosage.html
+++ b/reference/dosage.html
@@ -7,7 +7,7 @@
AMR (for R)
- 3.0.1.9004
+ 3.0.1.9007
diff --git a/reference/esbl_isolates.html b/reference/esbl_isolates.html
new file mode 100644
index 000000000..37ffa4197
--- /dev/null
+++ b/reference/esbl_isolates.html
@@ -0,0 +1,112 @@
+
+Data Set with 500 ESBL Isolates — esbl_isolates • AMR (for R)
+ Skip to contents
+
+
+
A data set containing 500 microbial isolates with MIC values of common antibiotics and a binary esbl column for extended-spectrum beta-lactamase (ESBL) production. This data set contains randomised fictitious data but reflects reality and can be used to practise AMR-related machine learning, e.g., classification modelling with tidymodels.