Finally, we will apply EUCAST
rules on our antimicrobial results. In Europe, most medical
microbiological laboratories already apply these rules. Our package
@@ -627,9 +632,9 @@ takes into account the antimicrobial susceptibility test results using
# Basing inclusion on all antimicrobial results, using a points threshold of# 2# Including isolates from ICU.
-# => Found 12,429 'phenotype-based' first isolates (62.1% of total where a
+# => Found 20,000 'phenotype-based' first isolates (100.0% of total where a# microbial ID was available)
-
So only 62.1% is suitable for resistance analysis! We can now filter
+
So only 100% is suitable for resistance analysis! We can now filter
on it with the filter() function, also from the
dplyr package:
# base R:plot(disk_values, mo ="E. coli", ab ="cipro")
diff --git a/articles/AMR_files/figure-html/disk_plots-1.png b/articles/AMR_files/figure-html/disk_plots-1.png
index 15013ab11..fc2674506 100644
Binary files a/articles/AMR_files/figure-html/disk_plots-1.png and b/articles/AMR_files/figure-html/disk_plots-1.png differ
diff --git a/articles/AMR_files/figure-html/disk_plots_mo_ab-1.png b/articles/AMR_files/figure-html/disk_plots_mo_ab-1.png
index 2958e24ef..aafd6bbfc 100644
Binary files a/articles/AMR_files/figure-html/disk_plots_mo_ab-1.png and b/articles/AMR_files/figure-html/disk_plots_mo_ab-1.png differ
diff --git a/articles/AMR_files/figure-html/mic_plots-1.png b/articles/AMR_files/figure-html/mic_plots-1.png
index e30b944de..d406df254 100644
Binary files a/articles/AMR_files/figure-html/mic_plots-1.png and b/articles/AMR_files/figure-html/mic_plots-1.png differ
diff --git a/articles/AMR_files/figure-html/mic_plots-2.png b/articles/AMR_files/figure-html/mic_plots-2.png
index bcabfec0c..45e1230f4 100644
Binary files a/articles/AMR_files/figure-html/mic_plots-2.png and b/articles/AMR_files/figure-html/mic_plots-2.png differ
diff --git a/articles/AMR_files/figure-html/mic_plots_mo_ab-1.png b/articles/AMR_files/figure-html/mic_plots_mo_ab-1.png
index 4aaf66b40..23153e7a0 100644
Binary files a/articles/AMR_files/figure-html/mic_plots_mo_ab-1.png and b/articles/AMR_files/figure-html/mic_plots_mo_ab-1.png differ
diff --git a/articles/AMR_files/figure-html/mic_plots_mo_ab-2.png b/articles/AMR_files/figure-html/mic_plots_mo_ab-2.png
index da2c22eac..65348b9b3 100644
Binary files a/articles/AMR_files/figure-html/mic_plots_mo_ab-2.png and b/articles/AMR_files/figure-html/mic_plots_mo_ab-2.png differ
diff --git a/articles/AMR_files/figure-html/plot 1-1.png b/articles/AMR_files/figure-html/plot 1-1.png
index 006a95bc7..cf39095cc 100644
Binary files a/articles/AMR_files/figure-html/plot 1-1.png and b/articles/AMR_files/figure-html/plot 1-1.png differ
diff --git a/articles/AMR_files/figure-html/plot 3-1.png b/articles/AMR_files/figure-html/plot 3-1.png
index a1ed6d84f..123e95830 100644
Binary files a/articles/AMR_files/figure-html/plot 3-1.png and b/articles/AMR_files/figure-html/plot 3-1.png differ
diff --git a/articles/AMR_files/figure-html/plot 4-1.png b/articles/AMR_files/figure-html/plot 4-1.png
index 4d33d2189..f0fba62ba 100644
Binary files a/articles/AMR_files/figure-html/plot 4-1.png and b/articles/AMR_files/figure-html/plot 4-1.png differ
diff --git a/articles/AMR_files/figure-html/plot 5-1.png b/articles/AMR_files/figure-html/plot 5-1.png
index abe8205f7..01d8c6c63 100644
Binary files a/articles/AMR_files/figure-html/plot 5-1.png and b/articles/AMR_files/figure-html/plot 5-1.png differ
diff --git a/articles/EUCAST.html b/articles/EUCAST.html
index bc6b9c7b6..28cb91390 100644
--- a/articles/EUCAST.html
+++ b/articles/EUCAST.html
@@ -38,7 +38,7 @@
AMR (for R)
- 1.8.2.9103
+ 1.8.2.9111
@@ -71,6 +71,11 @@
Conduct AMR Analysis
+
+
+
+ Generate Antibiogram (Trad./Syndromic/WISCA)
+
diff --git a/articles/MDR.html b/articles/MDR.html
index ad2990a62..4c4b62dec 100644
--- a/articles/MDR.html
+++ b/articles/MDR.html
@@ -38,7 +38,7 @@
AMR (for R)
- 1.8.2.9103
+ 1.8.2.9111
@@ -71,6 +71,11 @@
Conduct AMR Analysis
+
+
+
+ Generate Antibiogram (Trad./Syndromic/WISCA)
+
@@ -380,19 +385,19 @@ names or codes, this would have worked exactly the same way:
head(my_TB_data)# rifampicin isoniazid gatifloxacin ethambutol pyrazinamide moxifloxacin
-# 1 S S R I I R
-# 2 R R S S I I
-# 3 S R S S I S
-# 4 R I R S S R
-# 5 R I R I S S
-# 6 I I I R S I
+# 1 I S I I S I
+# 2 S S S S I S
+# 3 R R I S I R
+# 4 I I R S S R
+# 5 R I S S I S
+# 6 R S R I R I# kanamycin# 1 I
-# 2 R
-# 3 R
-# 4 I
+# 2 S
+# 3 S
+# 4 S# 5 R
-# 6 R
+# 6 I
We can now add the interpretation of MDR-TB to our data set. You can
use:
@@ -252,7 +257,7 @@ data using a custom made website. The webdesign knowledge needed
R has a huge community.
Many R users just ask questions on websites like StackOverflow.com, the largest
-online community for programmers. At the time of writing, 478,396
+online community for programmers. At the time of writing, 480,015
R-related questions have already been asked on this platform (that
covers questions and answers for any programming language). In my own
experience, most questions are answered within a couple of
diff --git a/articles/WHONET.html b/articles/WHONET.html
index 0ab21a9be..4a0690d24 100644
--- a/articles/WHONET.html
+++ b/articles/WHONET.html
@@ -38,7 +38,7 @@
AMR (for R)
- 1.8.2.9103
+ 1.8.2.9111
@@ -71,6 +71,11 @@
Conduct AMR Analysis
A data set with 52,141 rows and 22 columns, containing the following
+
A data set with 52,142 rows and 22 columns, containing the following
column names: mo, fullname, status, kingdom,
phylum, class, order, family,
genus, species, subspecies, rank,
@@ -201,7 +206,7 @@ column names: mo, fullname, status, kingdomgbif_renamed_to, prevalence and snomed.
This data set is in R available as microorganisms, after
you load the AMR package.
-
It was last updated on 20 December 2022 15:14:04 UTC. Find more info
+
It was last updated on 6 February 2023 10:57:22 UTC. Find more info
about the structure of this data set here.
Direct download links:
@@ -278,7 +283,7 @@ Set Name ‘Microoganism’, OID 2.16.840.1.114222.4.11.1009 (v12). URL:
It will be downloaded and installed automatically. For RStudio, click on the menu Tools > Install Packages… and then type in “AMR” and press Install.
Note: Not all functions on this website may be available in this latest release. To use all functions and data sets mentioned on this website, install the latest development version.
After this, you can install and update this AMR package like any official release (e.g., using install.packages("AMR") or in RStudio via Tools > Check for Package Updates…).
All functions and arguments with ‘rsi’ were replaced with ‘sir’, such as the interpretation of MIC values (now as.sir() instead of as.rsi()) - all old functions still work for now
For this milestone version, we replaced all mentions of RSI with SIR, to comply with what is actually being commonly used in the field of clinical microbiology when it comes to this tri-form regarding AMR.
While existing functions such as as.rsi(), rsi_df() and ggplot_rsi() still work, their replacements as.sir(), sir_df(), ggplot_sir() are now the current functions for AMR data analysis. A warning will be thrown once a session to remind users about this. The data set rsi_translation is now called clinical_breakpoints to better reflect its content.
The ‘RSI functions’ will be removed in a future version, but not before late 2023 / early 2024.
With the new antibiogram() function, users can now generate traditional, combined, syndromic, and even weighted-incidence syndromic combination antibiograms (WISCA). With this, we follow the logic in the previously described work of Klinker et al. (2021, DOI 10.1177/20499361211011373) and Barbieri et al. (2021, DOI 10.1186/s13756-021-00939-2).
+
The help page for antibiogram() extensively elaborates on use cases, and antibiogram() also supports printing in R Markdown and Quarto, with support for 16 languages.
+
Furthermore, different plotting methods were implemented to allow for graphical visualisations as well.
+
+
+
Interpretation of MIC and disk diffusion values
The clinical breakpoints and intrinsic resistance of EUCAST 2022 and CLSI 2022 have been added for as.sir(). EUCAST 2022 (v12.0) is now the new default guideline for all MIC and disks diffusion interpretations, and for eucast_rules() to apply EUCAST Expert Rules. The default guideline (EUCAST) can now be changed with the new AMR_guideline option, such as: options(AMR_guideline = "CLSI 2020").
Interpretation guidelines older than 10 years were removed, the oldest now included guidelines of EUCAST and CLSI are from 2013.
-
Supported languages
+
Supported languages
We added support for the following languages: Chinese, Greek, Japanese, Polish, Turkish and Ukrainian. All antibiotic names are now available in these languages, and the AMR package will automatically determine a supported language based on the user system language.
We are very grateful for the valuable input by our colleagues from other countries. The AMR package is now available in 16 languages and according to download stats used in almost all countries in the world!
-
Microbiological taxonomy
+
Microbiological taxonomy
The microorganisms data set no longer relies on the Catalogue of Life, but on the List of Prokaryotic names with Standing in Nomenclature (LPSN) and is supplemented with the ‘backbone taxonomy’ from the Global Biodiversity Information Facility (GBIF). The structure of this data set has changed to include separate LPSN and GBIF identifiers. Almost all previous MO codes were retained. It contains over 1,400 taxonomic names from 2022.
We previously relied on our own experience to categorise species into pathogenic groups, but we were very happy to encounter the very recent work of Bartlett et al. (2022, DOI 10.1099/mic.0.001269) who extensively studied medical-scientific literature to categorise all bacterial species into groups. See mo_matching_score() on how their work was incorporated into the prevalence column of the microorganisms data set. Using their results, the as.mo() and all mo_*() functions are now much better capable of converting user input to valid taxonomic records.
The microorganisms.old data set was removed, and all previously accepted names are now included in the microorganisms data set. A new column status contains "accepted" for currently accepted names and "synonym" for taxonomic synonyms; currently invalid names. All previously accepted names now have a microorganisms ID and - if available - an LPSN, GBIF and SNOMED CT identifier.
-
Antibiotic agents and selectors
+
Antibiotic agents and selectors
The new function add_custom_antimicrobials() allows users to add custom antimicrobial codes and names to the AMR package.
The antibiotics data set was greatly updated:
The following 20 antibiotics have been added (also includes the new J01RA ATC group): azithromycin/fluconazole/secnidazole (AFC), cefepime/amikacin (CFA), cefixime/ornidazole (CEO), ceftriaxone/beta-lactamase inhibitor (CEB), ciprofloxacin/metronidazole (CIM), ciprofloxacin/ornidazole (CIO), ciprofloxacin/tinidazole (CIT), furazidin (FUR), isoniazid/sulfamethoxazole/trimethoprim/pyridoxine (IST), lascufloxacin (LSC), levofloxacin/ornidazole (LEO), nemonoxacin (NEM), norfloxacin/metronidazole (NME), norfloxacin/tinidazole (NTI), ofloxacin/ornidazole (OOR), oteseconazole (OTE), rifampicin/ethambutol/isoniazid (REI), sarecycline (SRC), tetracycline/oleandomycin (TOL), and thioacetazone (TAT)
@@ -205,14 +217,14 @@
Also, we added support for using antibiotic selectors in scoped dplyr verbs (with or without using vars()), such as in: ... %>% summarise_at(aminoglycosides(), resistance), please see resistance() for examples.
-
Antiviral agents
+
Antiviral agents
We now added extensive support for antiviral agents! For the first time, the AMR package has extensive support for antiviral drugs and to work with their names, codes and other data in any way.
The antivirals data set has been extended with 18 new drugs (also from the new J05AJ ATC group) and now also contains antiviral identifiers and LOINC codes
A new data type av (antivirals) has been added, which is functionally similar to ab for antibiotics
Function mean_amr_distance() to calculate the mean AMR distance. The mean AMR distance is a normalised numeric value to compare AMR test results and can help to identify similar isolates, without comparing antibiograms by hand.
Function sir_interpretation_history() to view the history of previous runs of as.sir() (previously as.rsi()). This returns a ‘logbook’ with the selected guideline, reference table and specific interpretation of each row in a data set on which as.sir() was run.
@@ -221,10 +233,10 @@
-
Changes
+
Changes
Argument combine_IR has been removed from this package (affecting functions count_df(), proportion_df(), and sir_df() and some plotting functions), since it was replaced with combine_SI three years ago
Using units in ab_ddd(..., units = "...") had been deprecated for some time and is now not supported anymore. Use ab_ddd_units() instead.
All data sets in this package are now a tibble, instead of base R data.frames. Older R versions are still supported, even if they do not support tibbles.
Our data sets are now also continually exported to Apache Feather and Apache Parquet formats. You can find more info in this article on our website.
Added Peter Dutey-Magni, Dmytro Mykhailenko, Anton Mymrikov, Andrew Norgan, and Jonas Salm as contributors, to thank them for their valuable input
New website to make use of the new Bootstrap 5 and pkgdown 2.0. The website now contains results for all examples and will be automatically regenerated with every change to our repository, using GitHub Actions
All R and Rmd files in this project are now styled using the styler package
Generate an antibiogram, and communicate the results in plots or tables. These functions follow the logic of Klinker et al. (2021, doi:10.1177/20499361211011373
+) and Barbieri et al. (2021, doi:10.1186/s13756-021-00939-2
+), and allow reporting in e.g. R Markdown and Quarto as well.
Klinker KP et al. (2021). Antimicrobial stewardship and antibiograms: importance of moving beyond traditional antibiograms. Therapeutic Advances in Infectious Disease, May 5;8:20499361211011373; doi:10.1177/20499361211011373
+
Barbieri E et al. (2021). Development of a Weighted-Incidence Syndromic Combination Antibiogram (WISCA) to guide the choice of the empiric antibiotic treatment for urinary tract infection in paediatric patients: a Bayesian approachAntimicrobial Resistance & Infection Control May 1;10(1):74; doi:10.1186/s13756-021-00939-2
a data.frame containing at least a column with microorganisms and columns with antibiotic results (class 'sir', see as.sir())
+
+
+
antibiotics
+
vector of column names, or (any combinations of) antibiotic selectors such as aminoglycosides() or carbapenems(). For combination antibiograms, this can also be column names separated with "+", such as "TZP+TOB" given that the data set contains columns "TZP" and "TOB". See Examples.
+
+
+
mo_transform
+
a character to transform microorganism input - must be "name", "shortname", "gramstain", or one of the column names of the microorganisms data set: "mo", "fullname", "status", "kingdom", "phylum", "class", "order", "family", "genus", "species", "subspecies", "rank", "ref", "source", "lpsn", "lpsn_parent", "lpsn_renamed_to", "gbif", "gbif_parent", "gbif_renamed_to", "prevalence" or "snomed". Can also be NULL to not transform the input.
+
+
+
ab_transform
+
a character to transform antibiotic input - must be one of the column names of the antibiotics data set: "ab", "cid", "name", "group", "atc", "atc_group1", "atc_group2", "abbreviations", "synonyms", "oral_ddd", "oral_units", "iv_ddd", "iv_units" or "loinc". Can also be NULL to not transform the input.
+
+
+
syndromic_group
+
a column name of x, or values calculated to split rows of x, e.g. by using ifelse() or case_when(). See Examples.
+
+
+
add_total_n
+
a logical to indicate whether total available numbers per pathogen should be added to the table (defaults to TRUE). This will add the lowest and highest number of available isolate per antibiotic (e.g, if for E. coli 200 isolates are available for ciprofloxacin and 150 for amoxicillin, the returned number will be "150-200").
+
+
+
only_all_tested
+
(for combination antibiograms): a logical to indicate that isolates must be tested for all antibiotics, see Details
+
+
+
digits
+
number of digits to use for rounding
+
+
+
col_mo
+
column name of the names or codes of the microorganisms (see as.mo()), defaults to the first column of class mo. Values will be coerced using as.mo().
+
+
+
language
+
language to translate text, which defaults to the system language (see get_AMR_locale())
+
+
+
minimum
+
the minimum allowed number of available (tested) isolates. Any isolate count lower than minimum will return NA with a warning. The default number of 30 isolates is advised by the Clinical and Laboratory Standards Institute (CLSI) as best practice, see Source.
+
+
+
combine_SI
+
a logical to indicate whether all susceptibility should be determined by results of either S or I, instead of only S (defaults to TRUE)
+
+
+
sep
+
a separating character for antibiotic columns in combination antibiograms
+
+
+
...
+
method extensions
+
+
+
object
+
an antibiogram() object
+
+
+
as_kable
+
a logical to indicate whether the printing should be done using knitr::kable() (which is the default in non-interactive sessions)
+
+
+
+
Details
+
This function returns a table with values between 0 and 100 for susceptibility, not resistance.
+
Remember that you should filter your data to let it contain only first isolates! This is needed to exclude duplicates and to reduce selection bias. Use first_isolate() to determine them in your data set with one of the four available algorithms.
+
There are four antibiogram types, as proposed by Klinker et al. (2021, doi:10.1177/20499361211011373
+), and they are all supported by antibiogram():
Traditional Antibiogram
+
Case example: Susceptibility of Pseudomonas aeruginosa to piperacillin/tazobactam (TZP)
Case example: Susceptibility of Pseudomonas aeruginosa to TZP among respiratory specimens (obtained among ICU patients only) for male patients age >=65 years with heart failure
All types of antibiograms can be generated with the functions as described on this page, and can be plotted (using ggplot2::autoplot() or base Rplot()/barplot()) or printed into R Markdown / Quarto formats for reports. Use functions from specific 'table reporting' packages to transform the output of antibiogram() to your needs, e.g. flextable::as_flextable() or gt::gt().
+
Note that for combination antibiograms, it is important to realise that susceptibility can be calculated in two ways, which can be set with the only_all_tested argument (defaults to FALSE). See this example for two antibiotics, Drug A and Drug B, about how antibiogram() works to calculate the %SI:
+
--------------------------------------------------------------------
+ only_all_tested =FALSE only_all_tested =TRUE
+----------------------------------------------
+ Drug A Drug B include as include as include as include as
+ numerator denominator numerator denominator
+----------------------------------------------------------
+ S or I S or I X X X X
+ R S or I X X X X
+<NA> S or I X X --
+ S or I R X X X X
+ R R - X - X
+<NA> R ----
+ S or I <NA> X X --
+ R <NA>----
+<NA><NA>----
+--------------------------------------------------------------------
+
Printing the antibiogram in non-interactive sessions will be done by knitr::kable(), with support for all their implemented formats, such as "markdown". The knitr format will be automatically determined if printed inside a knitr document (LaTeX, HTML, etc.).
+
+
+
+
Examples
+
# example_isolates is a data set available in the AMR package.
+# run ?example_isolates for more info.
+example_isolates
+#># A tibble: 2,000 × 46
+#> date patient age gender ward mo PEN OXA FLC AMX
+#><date><chr><dbl><chr><chr><mo><sir><sir><sir><sir>
+#> 1 2002-01-02 A77334 65 F Clinical B_ESCHR_COLI R NA NA NA
+#> 2 2002-01-03 A77334 65 F Clinical B_ESCHR_COLI R NA NA NA
+#> 3 2002-01-07 067927 45 F ICU B_STPHY_EPDR R NA R NA
+#> 4 2002-01-07 067927 45 F ICU B_STPHY_EPDR R NA R NA
+#> 5 2002-01-13 067927 45 F ICU B_STPHY_EPDR R NA R NA
+#> 6 2002-01-13 067927 45 F ICU B_STPHY_EPDR R NA R NA
+#> 7 2002-01-14 462729 78 M Clinical B_STPHY_AURS R NA S R
+#> 8 2002-01-14 462729 78 M Clinical B_STPHY_AURS R NA S R
+#> 9 2002-01-16 067927 45 F ICU B_STPHY_EPDR R NA R NA
+#>10 2002-01-17 858515 79 F ICU B_STPHY_EPDR R NA S NA
+#># … with 1,990 more rows, and 36 more variables: AMC <sir>, AMP <sir>,
+#># TZP <sir>, CZO <sir>, FEP <sir>, CXM <sir>, FOX <sir>, CTX <sir>,
+#># CAZ <sir>, CRO <sir>, GEN <sir>, TOB <sir>, AMK <sir>, KAN <sir>,
+#># TMP <sir>, SXT <sir>, NIT <sir>, FOS <sir>, LNZ <sir>, CIP <sir>,
+#># MFX <sir>, VAN <sir>, TEC <sir>, TCY <sir>, TGC <sir>, DOX <sir>,
+#># ERY <sir>, CLI <sir>, AZM <sir>, IPM <sir>, MEM <sir>, MTR <sir>,
+#># CHL <sir>, COL <sir>, MUP <sir>, RIF <sir>
+
+
+# Traditional antibiogram ----------------------------------------------
+
+antibiogram(example_isolates,
+ antibiotics =c(aminoglycosides(), carbapenems()))
+#> ℹ For aminoglycosides() using columns 'GEN' (gentamicin), 'TOB'
+#> (tobramycin), 'AMK' (amikacin) and 'KAN' (kanamycin)
+#> ℹ For carbapenems() using columns 'IPM' (imipenem) and 'MEM' (meropenem)
+#> ℹ 502 combinations had less than minimum = 30 results and were ignored
+#># A tibble: 10 × 7
+#> `Pathogen (N min-max)` AMK GEN IPM KAN MEM TOB
+#>*<chr><dbl><dbl><dbl><dbl><dbl><dbl>
+#> 1 CoNS (43-309) 0 0 0 0 0 0
+#> 2 E. coli (0-462) 0 0 0 NA 0 0
+#> 3 E. faecalis (0-39) 0 0 0 0 NA 0
+#> 4 K. pneumoniae (0-58) NA 0 0 NA 0 0
+#> 5 P. aeruginosa (17-30) NA 0 NA 0 NA 0
+#> 6 P. mirabilis (0-34) NA 0 0 NANA 0
+#> 7 S. aureus (2-233) NA 0 NANANA 0
+#> 8 S. epidermidis (8-163) 0 0 NA 0 NA 0
+#> 9 S. hominis (3-80) NA 0 NANANA 0
+#>10 S. pneumoniae (11-117) 0 0 NA 0 NA 0
+
+antibiogram(example_isolates,
+ antibiotics =aminoglycosides(),
+ ab_transform ="atc",
+ mo_transform ="gramstain")
+#> ℹ For aminoglycosides() using columns 'GEN' (gentamicin), 'TOB'
+#> (tobramycin), 'AMK' (amikacin) and 'KAN' (kanamycin)
+#> ℹ 4 combinations had less than minimum = 30 results and were ignored
+#># A tibble: 2 × 5
+#> `Pathogen (N min-max)` J01GB01 J01GB03 J01GB04 J01GB06
+#>*<chr><dbl><dbl><dbl><dbl>
+#>1 Gram-negative (35-686) 0 0 0 0
+#>2 Gram-positive (436-1170) 0 0 0 0
+
+antibiogram(example_isolates,
+ antibiotics =carbapenems(),
+ ab_transform ="name",
+ mo_transform ="name")
+#> ℹ For carbapenems() using columns 'IPM' (imipenem) and 'MEM' (meropenem)
+#> ℹ 172 combinations had less than minimum = 30 results and were ignored
+#># A tibble: 5 × 3
+#> `Pathogen (N min-max)` Imipenem Meropenem
+#>*<chr><dbl><dbl>
+#>1 Coagulase-negative Staphylococcus (CoNS) (48-48) 2 2
+#>2 Enterococcus faecalis (0-38) 3 NA
+#>3 Escherichia coli (418-422) 0 0
+#>4 Klebsiella pneumoniae (51-53) 2 2
+#>5 Proteus mirabilis (27-32) 3 NA
+
+
+# Combined antibiogram -------------------------------------------------
+
+# combined antibiotics yield higher empiric coverage
+antibiogram(example_isolates,
+ antibiotics =c("TZP", "TZP+TOB", "TZP+GEN"),
+ mo_transform ="gramstain")
+#> ℹ 3 combinations had less than minimum = 30 results and were ignored
+#># A tibble: 2 × 4
+#> `Pathogen (N min-max)` TZP `TZP + GEN` `TZP + TOB`
+#>*<chr><dbl><dbl><dbl>
+#>1 Gram-negative (641-693) 2 2 2
+#>2 Gram-positive (345-1044) 4 1 3
+
+antibiogram(example_isolates,
+ antibiotics =c("TZP", "TZP+TOB"),
+ mo_transform ="gramstain",
+ ab_transform ="name",
+ sep =" & ")
+#> ℹ 2 combinations had less than minimum = 30 results and were ignored
+#># A tibble: 2 × 3
+#> `Pathogen (N min-max)` `Piperacillin/tazobactam` Piperacillin/tazobactam & …¹
+#>*<chr><dbl><dbl>
+#>1 Gram-negative (641-693) 2 2
+#>2 Gram-positive (345-550) 4 3
+#># … with abbreviated variable name ¹`Piperacillin/tazobactam & Tobramycin`
+
+
+# Syndromic antibiogram ------------------------------------------------
+
+# the data set could contain a filter for e.g. respiratory specimens
+antibiogram(example_isolates,
+ antibiotics =c(aminoglycosides(), carbapenems()),
+ syndromic_group ="ward")
+#> ℹ For aminoglycosides() using columns 'GEN' (gentamicin), 'TOB'
+#> (tobramycin), 'AMK' (amikacin) and 'KAN' (kanamycin)
+#> ℹ For carbapenems() using columns 'IPM' (imipenem) and 'MEM' (meropenem)
+#> ℹ 897 combinations had less than minimum = 30 results and were ignored
+#># A tibble: 14 × 8
+#> `Syndromic Group` `Pathogen (N min-max)` AMK GEN IPM KAN MEM TOB
+#>*<chr><chr><dbl><dbl><dbl><dbl><dbl><dbl>
+#> 1 Clinical CoNS (23-205) NA 0 0 NA 0 0
+#> 2 ICU CoNS (10-73) NA 0 NANANANA
+#> 3 Outpatient CoNS (3-31) NA 0 NANANANA
+#> 4 Clinical E. coli (0-299) 0 0 0 NA 0 0
+#> 5 ICU E. coli (0-137) 0 0 0 NA 0 0
+#> 6 Clinical K. pneumoniae (0-51) NA 0 0 NA 0 0
+#> 7 Clinical P. mirabilis (0-30) NA 0 NANANA 0
+#> 8 Clinical S. aureus (2-150) NA 0 NANANA 0
+#> 9 ICU S. aureus (0-66) NA 0 NANANANA
+#>10 Clinical S. epidermidis (4-79) NA 0 NANANA 0
+#>11 ICU S. epidermidis (4-75) NA 0 NANANA 0
+#>12 Clinical S. hominis (1-45) NA 0 NANANA 0
+#>13 Clinical S. pneumoniae (5-78) 0 0 NA 0 NA 0
+#>14 ICU S. pneumoniae (5-30) 0 0 NA 0 NA 0
+
+# with a custom language, though this will be determined automatically
+# (i.e., this table will be in Spanish on Spanish systems)
+ex1<-example_isolates[which(mo_genus()=="Escherichia"), ]
+#> ℹ Using column 'mo' as input for mo_genus()
+antibiogram(ex1,
+ antibiotics =aminoglycosides(),
+ ab_transform ="name",
+ syndromic_group =ifelse(ex1$ward=="ICU",
+"UCI", "No UCI"),
+ language ="es")
+#> ℹ For aminoglycosides() using columns 'GEN' (gentamicin), 'TOB'
+#> (tobramycin), 'AMK' (amikacin) and 'KAN' (kanamycin)
+#> ℹ 2 combinations had less than minimum = 30 results and were ignored
+#># A tibble: 2 × 5
+#> `Grupo sindrómico` `Patógeno (N min-max)` Amikacina Gentamicina Tobramicina
+#>*<chr><chr><dbl><dbl><dbl>
+#>1 No UCI E. coli (0-325) 100 37 37
+#>2 UCI E. coli (0-137) 229 87 87
+
+
+# Weighted-incidence syndromic combination antibiogram (WISCA) ---------
+
+# the data set could contain a filter for e.g. respiratory specimens
+antibiogram(example_isolates,
+ antibiotics =c("AMC", "AMC+CIP", "TZP", "TZP+TOB"),
+ mo_transform ="gramstain",
+ minimum =10, # this should be >= 30, but now just as example
+ syndromic_group =ifelse(example_isolates$age>=65&
+example_isolates$gender=="M",
+"WISCA Group 1", "WISCA Group 2"))
+#> ℹ 8 combinations had less than minimum = 10 results and were ignored
+#># A tibble: 4 × 6
+#> `Syndromic Group` `Pathogen (N min-max)` AMC `AMC + CIP` TZP `TZP + TOB`
+#>*<chr><chr><dbl><dbl><dbl><dbl>
+#>1 WISCA Group 1 Gram-negative (261-285) 3 3 3 3
+#>2 WISCA Group 2 Gram-negative (380-442) 2 2 2 2
+#>3 WISCA Group 1 Gram-positive (123-406) 2 2 7 5
+#>4 WISCA Group 2 Gram-positive (222-732) 1 1 4 3
+
+
+# Generate plots with ggplot2 or base R --------------------------------
+
+ab1<-antibiogram(example_isolates,
+ antibiotics =c("AMC", "CIP", "TZP", "TZP+TOB"),
+ mo_transform ="gramstain")
+#> ℹ 4 combinations had less than minimum = 30 results and were ignored
+ab2<-antibiogram(example_isolates,
+ antibiotics =c("AMC", "CIP", "TZP", "TZP+TOB"),
+ mo_transform ="gramstain",
+ syndromic_group ="ward")
+#> ℹ 16 combinations had less than minimum = 30 results and were ignored
+
+plot(ab1)
+
+
+if(requireNamespace("ggplot2")){
+ggplot2::autoplot(ab1)
+}
+
+
+plot(ab2)
+
+
+if(requireNamespace("ggplot2")){
+ggplot2::autoplot(ab2)
+}
+
+
column name of the names or codes of the microorganisms (see as.mo()), defaults to the first column of class mo. Values will be coerced using as.mo().
version_expertrules
@@ -596,7 +601,11 @@
}#> ℹ For aminoglycosides() using columns 'GEN' (gentamicin), 'TOB'#> (tobramycin), 'AMK' (amikacin) and 'KAN' (kanamycin)
-#>Warning: Introducing NA: only 23 results available for KAN in group: ward =
+#>Warning: There was 1 warning in `summarise()`.
+#>ℹ In argument: `across(aminoglycosides(), resistance)`.
+#>ℹ In group 3: `ward = "Outpatient"`.
+#> Caused by warning:
+#>! Introducing NA: only 23 results available for KAN in group: ward =#> "Outpatient" (minimum = 30).#># A tibble: 3 × 5#> ward GEN TOB AMK KAN
@@ -648,110 +657,14 @@
#> (benzylpenicillin), 'LNZ' (linezolid), 'VAN' (vancomycin), 'TEC'#> (teicoplanin), 'ERY' (erythromycin), 'CLI' (clindamycin), 'AZM'#> (azithromycin) and 'RIF' (rifampicin)
-#>Warning: Introducing NA: no results available for OXA in group: ward = "Clinical"
-#> (minimum = 30).
-#>Warning: Introducing NA: no results available for OXA in group: ward = "ICU"
-#> (minimum = 30).
-#>Warning: Introducing NA: no results available for OXA in group: ward = "Outpatient"
-#> (minimum = 30).
-#>Warning: Introducing NA: no results available for FLC in group: ward = "Clinical"
-#> (minimum = 30).
-#>Warning: Introducing NA: no results available for FLC in group: ward = "ICU"
-#> (minimum = 30).
-#>Warning: Introducing NA: no results available for FLC in group: ward = "Outpatient"
-#> (minimum = 30).
-#>Warning: Introducing NA: only 25 results available for AMX in group: ward =
-#> "Outpatient" (minimum = 30).
-#>Warning: Introducing NA: only 27 results available for AMC in group: ward =
-#> "Outpatient" (minimum = 30).
-#>Warning: Introducing NA: only 25 results available for AMP in group: ward =
-#> "Outpatient" (minimum = 30).
-#>Warning: Introducing NA: only 24 results available for TZP in group: ward =
-#> "Outpatient" (minimum = 30).
-#>Warning: Introducing NA: only 23 results available for CZO in group: ward = "ICU"
-#> (minimum = 30).
-#>Warning: Introducing NA: only 10 results available for CZO in group: ward =
-#> "Outpatient" (minimum = 30).
-#>Warning: Introducing NA: only 20 results available for FEP in group: ward =
-#> "Outpatient" (minimum = 30).
-#>Warning: Introducing NA: only 27 results available for CXM in group: ward =
-#> "Outpatient" (minimum = 30).
-#>Warning: Introducing NA: only 22 results available for FOX in group: ward =
-#> "Outpatient" (minimum = 30).
-#>Warning: Introducing NA: only 25 results available for CTX in group: ward =
-#> "Outpatient" (minimum = 30).
-#>Warning: Introducing NA: only 27 results available for CAZ in group: ward =
-#> "Outpatient" (minimum = 30).
-#>Warning: Introducing NA: only 25 results available for CRO in group: ward =
-#> "Outpatient" (minimum = 30).
-#>Warning: Introducing NA: only 27 results available for GEN in group: ward =
-#> "Outpatient" (minimum = 30).
-#>Warning: Introducing NA: only 27 results available for TOB in group: ward =
-#> "Outpatient" (minimum = 30).
-#>Warning: Introducing NA: only 15 results available for AMK in group: ward =
-#> "Outpatient" (minimum = 30).
-#>Warning: Introducing NA: no results available for KAN in group: ward = "Clinical"
-#> (minimum = 30).
-#>Warning: Introducing NA: no results available for KAN in group: ward = "ICU"
-#> (minimum = 30).
-#>Warning: Introducing NA: no results available for KAN in group: ward = "Outpatient"
-#> (minimum = 30).
-#>Warning: Introducing NA: only 22 results available for TMP in group: ward =
-#> "Outpatient" (minimum = 30).
-#>Warning: Introducing NA: only 27 results available for SXT in group: ward =
-#> "Outpatient" (minimum = 30).
-#>Warning: Introducing NA: only 27 results available for NIT in group: ward =
-#> "Outpatient" (minimum = 30).
-#>Warning: Introducing NA: only 25 results available for FOS in group: ward = "ICU"
-#> (minimum = 30).
-#>Warning: Introducing NA: only 2 results available for FOS in group: ward =
-#> "Outpatient" (minimum = 30).
-#>Warning: Introducing NA: only 27 results available for CIP in group: ward =
-#> "Outpatient" (minimum = 30).
-#>Warning: Introducing NA: only 15 results available for MFX in group: ward = "ICU"
-#> (minimum = 30).
-#>Warning: Introducing NA: only 4 results available for MFX in group: ward =
-#> "Outpatient" (minimum = 30).
-#>Warning: Introducing NA: only 5 results available for TCY in group: ward =
-#> "Clinical" (minimum = 30).
-#>Warning: Introducing NA: no results available for TCY in group: ward = "ICU"
-#> (minimum = 30).
-#>Warning: Introducing NA: no results available for TCY in group: ward = "Outpatient"
-#> (minimum = 30).
-#>Warning: Introducing NA: only 13 results available for TGC in group: ward = "ICU"
-#> (minimum = 30).
-#>Warning: Introducing NA: only 2 results available for TGC in group: ward =
-#> "Outpatient" (minimum = 30).
-#>Warning: Introducing NA: no results available for DOX in group: ward = "Clinical"
-#> (minimum = 30).
-#>Warning: Introducing NA: no results available for DOX in group: ward = "ICU"
-#> (minimum = 30).
-#>Warning: Introducing NA: no results available for DOX in group: ward = "Outpatient"
-#> (minimum = 30).
-#>Warning: Introducing NA: only 24 results available for IPM in group: ward =
-#> "Outpatient" (minimum = 30).
-#>Warning: Introducing NA: only 25 results available for MEM in group: ward =
-#> "Outpatient" (minimum = 30).
-#>Warning: Introducing NA: only 2 results available for MTR in group: ward =
-#> "Clinical" (minimum = 30).
-#>Warning: Introducing NA: no results available for MTR in group: ward = "ICU"
-#> (minimum = 30).
-#>Warning: Introducing NA: no results available for MTR in group: ward = "Outpatient"
-#> (minimum = 30).
-#>Warning: Introducing NA: no results available for CHL in group: ward = "Clinical"
-#> (minimum = 30).
-#>Warning: Introducing NA: no results available for CHL in group: ward = "ICU"
-#> (minimum = 30).
-#>Warning: Introducing NA: no results available for CHL in group: ward = "Outpatient"
-#> (minimum = 30).
-#>Warning: Introducing NA: only 9 results available for COL in group: ward =
-#> "Outpatient" (minimum = 30).
-#>Warning: Introducing NA: no results available for MUP in group: ward = "Clinical"
-#> (minimum = 30).
-#>Warning: Introducing NA: no results available for MUP in group: ward = "ICU"
-#> (minimum = 30).
-#>Warning: Introducing NA: no results available for MUP in group: ward = "Outpatient"
+#>Warning: There were 52 warnings in `summarise()`.
+#> The first warning was:
+#>ℹ In argument: `across(not_intrinsic_resistant(), resistance)`.
+#>ℹ In group 1: `ward = "Clinical"`.
+#> Caused by warning:
+#>! Introducing NA: no results available for OXA in group: ward = "Clinical"#> (minimum = 30).
+#>ℹ Run `dplyr::last_dplyr_warnings()` to see the 51 remaining warnings.#># A tibble: 3 × 33#> ward OXA FLC AMX AMC AMP TZP CZO FEP CXM FOX#><chr><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl>
@@ -769,15 +682,14 @@
group_by(ward)%>%summarise(across(ab_selector(name%like%"trim"), susceptibility))}
-#> Including isolates from ICU.#> ℹ For ab_selector(name %like% "trim") using columns 'TMP' (trimethoprim)#> and 'SXT' (trimethoprim/sulfamethoxazole)#># A tibble: 3 × 3#> ward TMP SXT#><chr><dbl><dbl>
-#>1 Clinical 0.627 0.808
-#>2 ICU 0.549 0.778
-#>3 Outpatient 0.667 0.821
+#>1 Clinical 0.633 0.793
+#>2 ICU 0.578 0.792
+#>3 Outpatient 0.705 0.835if(require("dplyr")){# this will select columns 'IPM' (imipenem) and 'MEM' (meropenem):example_isolates%>%
diff --git a/reference/antibiotics.html b/reference/antibiotics.html
index 324da1df7..fafc9e935 100644
--- a/reference/antibiotics.html
+++ b/reference/antibiotics.html
@@ -10,7 +10,7 @@
AMR (for R)
- 1.8.2.9103
+ 1.8.2.9111
@@ -42,6 +42,11 @@
Conduct AMR Analysis
+
+
+
+ Generate Antibiogram (Trad./Syndromic/WISCA)
+
diff --git a/reference/as.ab.html b/reference/as.ab.html
index f017e9f7e..9cfee9280 100644
--- a/reference/as.ab.html
+++ b/reference/as.ab.html
@@ -10,7 +10,7 @@
AMR (for R)
- 1.8.2.9103
+ 1.8.2.9111
@@ -42,6 +42,11 @@
Conduct AMR Analysis
+
+
+
+ Generate Antibiogram (Trad./Syndromic/WISCA)
+
@@ -272,7 +277,7 @@
if(require("dplyr")){# you can quickly rename 'sir' columns using set_ab_names() with dplyr:example_isolates%>%
-set_ab_names(where(is.sir), property ="atc")
+set_ab_names(where(is.sir), property ="atc")}#># A tibble: 2,000 × 46#> date patient age gender ward mo J01CE01 J01CF04 J01CF05
diff --git a/reference/as.av.html b/reference/as.av.html
index c63e2c381..124c6b828 100644
--- a/reference/as.av.html
+++ b/reference/as.av.html
@@ -10,7 +10,7 @@
AMR (for R)
- 1.8.2.9103
+ 1.8.2.9111
@@ -42,6 +42,11 @@
Conduct AMR Analysis
+
+
+
+ Generate Antibiogram (Trad./Syndromic/WISCA)
+
diff --git a/reference/as.disk.html b/reference/as.disk.html
index c4c3730df..cd2f2a6ad 100644
--- a/reference/as.disk.html
+++ b/reference/as.disk.html
@@ -10,7 +10,7 @@
AMR (for R)
- 1.8.2.9103
+ 1.8.2.9111
@@ -42,6 +42,11 @@
Conduct AMR Analysis
+
+
+
+ Generate Antibiogram (Trad./Syndromic/WISCA)
+
diff --git a/reference/as.mic-4.png b/reference/as.mic-4.png
index e43a9606c..f1b1cd1d5 100644
Binary files a/reference/as.mic-4.png and b/reference/as.mic-4.png differ
diff --git a/reference/as.mic-5.png b/reference/as.mic-5.png
index 26b403a78..62e5a977b 100644
Binary files a/reference/as.mic-5.png and b/reference/as.mic-5.png differ
diff --git a/reference/as.mic.html b/reference/as.mic.html
index e0122fd31..e917b07a6 100644
--- a/reference/as.mic.html
+++ b/reference/as.mic.html
@@ -10,7 +10,7 @@
AMR (for R)
- 1.8.2.9103
+ 1.8.2.9111
@@ -42,6 +42,11 @@
Conduct AMR Analysis
+
+
+
+ Generate Antibiogram (Trad./Syndromic/WISCA)
+
diff --git a/reference/as.mo.html b/reference/as.mo.html
index 4a0b657fd..4c798188d 100644
--- a/reference/as.mo.html
+++ b/reference/as.mo.html
@@ -10,7 +10,7 @@
AMR (for R)
- 1.8.2.9103
+ 1.8.2.9111
@@ -42,6 +42,11 @@
Conduct AMR Analysis
+
+
+
+ Generate Antibiogram (Trad./Syndromic/WISCA)
+
diff --git a/reference/as.sir.html b/reference/as.sir.html
index 3d9291806..5014ae6f1 100644
--- a/reference/as.sir.html
+++ b/reference/as.sir.html
@@ -10,7 +10,7 @@
AMR (for R)
- 1.8.2.9103
+ 1.8.2.9111
@@ -42,6 +42,11 @@
Conduct AMR Analysis
+
+
+
+ Generate Antibiogram (Trad./Syndromic/WISCA)
+
@@ -251,7 +256,7 @@
column name of the names or codes of the microorganisms (see as.mo()), defaults to the first column of class mo. Values will be coerced using as.mo().
clean
@@ -312,7 +317,7 @@
Machine-Readable Interpretation Guidelines
-
The repository of this package contains a machine-readable version of all guidelines. This is a CSV file consisting of 18,308 rows and 11 columns. This file is machine-readable, since it contains one row for every unique combination of the test method (MIC or disk diffusion), the antimicrobial drug and the microorganism. This allows for easy implementation of these rules in laboratory information systems (LIS). Note that it only contains interpretation guidelines for humans - interpretation guidelines from CLSI for animals were removed.
+
The repository of this package contains a machine-readable version of all guidelines. This is a CSV file consisting of 18 308 rows and 11 columns. This file is machine-readable, since it contains one row for every unique combination of the test method (MIC or disk diffusion), the antimicrobial drug and the microorganism. This allows for easy implementation of these rules in laboratory information systems (LIS). Note that it only contains interpretation guidelines for humans - interpretation guidelines from CLSI for animals were removed.
column name of the IDs of the microorganisms (see as.mo()), defaults to the first column of class mo. Values will be coerced using as.mo().
+
column name of the names or codes of the microorganisms (see as.mo()), defaults to the first column of class mo. Values will be coerced using as.mo().
FUN
@@ -227,18 +232,31 @@
Examples
# \donttest{
+#' # example_isolates is a data set available in the AMR package.
+# run ?example_isolates for more info.
+example_isolates
+#># A tibble: 2,000 × 46
+#> date patient age gender ward mo PEN OXA FLC AMX
+#><date><chr><dbl><chr><chr><mo><sir><sir><sir><sir>
+#> 1 2002-01-02 A77334 65 F Clinical B_ESCHR_COLI R NA NA NA
+#> 2 2002-01-03 A77334 65 F Clinical B_ESCHR_COLI R NA NA NA
+#> 3 2002-01-07 067927 45 F ICU B_STPHY_EPDR R NA R NA
+#> 4 2002-01-07 067927 45 F ICU B_STPHY_EPDR R NA R NA
+#> 5 2002-01-13 067927 45 F ICU B_STPHY_EPDR R NA R NA
+#> 6 2002-01-13 067927 45 F ICU B_STPHY_EPDR R NA R NA
+#> 7 2002-01-14 462729 78 M Clinical B_STPHY_AURS R NA S R
+#> 8 2002-01-14 462729 78 M Clinical B_STPHY_AURS R NA S R
+#> 9 2002-01-16 067927 45 F ICU B_STPHY_EPDR R NA R NA
+#>10 2002-01-17 858515 79 F ICU B_STPHY_EPDR R NA S NA
+#># … with 1,990 more rows, and 36 more variables: AMC <sir>, AMP <sir>,
+#># TZP <sir>, CZO <sir>, FEP <sir>, CXM <sir>, FOX <sir>, CTX <sir>,
+#># CAZ <sir>, CRO <sir>, GEN <sir>, TOB <sir>, AMK <sir>, KAN <sir>,
+#># TMP <sir>, SXT <sir>, NIT <sir>, FOS <sir>, LNZ <sir>, CIP <sir>,
+#># MFX <sir>, VAN <sir>, TEC <sir>, TCY <sir>, TGC <sir>, DOX <sir>,
+#># ERY <sir>, CLI <sir>, AZM <sir>, IPM <sir>, MEM <sir>, MTR <sir>,
+#># CHL <sir>, COL <sir>, MUP <sir>, RIF <sir>
+x<-bug_drug_combinations(example_isolates)
-head(x)
-#># A tibble: 6 × 6
-#> mo ab S I R total
-#><chr><chr><int><int><int><int>
-#>1 (unknown species) PEN 14 0 1 15
-#>2 (unknown species) OXA 0 0 1 1
-#>3 (unknown species) FLC 0 0 0 0
-#>4 (unknown species) AMX 15 0 1 16
-#>5 (unknown species) AMC 15 0 0 15
-#>6 (unknown species) AMP 15 0 1 16
-#> Use 'format()' on this result to get a publishable/printable format.format(x, translate_ab ="name (atc)")#># A tibble: 39 × 12#> Group Drug CoNS E. co…¹ E. fa…² K. pn…³ P. ae…⁴ P. mi…⁵ S. au…⁶ S. ep…⁷
@@ -262,20 +280,20 @@
bug_drug_combinations(example_isolates, FUN =mo_gramstain)
-#># A tibble: 80 × 6
+#># A tibble: 120 × 6#> mo ab S I R total#>*<chr><chr><int><int><int><int>
-#> 1 Gram-negative PEN 8 0 717 725
-#> 2 Gram-negative OXA 6 0 0 6
-#> 3 Gram-negative FLC 6 0 0 6
+#> 1 Gram-negative AMC 463 89 174 726
+#> 2 Gram-negative AMK 251 0 5 256
+#> 3 Gram-negative AMP 226 0 405 631#> 4 Gram-negative AMX 226 0 405 631
-#> 5 Gram-negative AMC 463 89 174 726
-#> 6 Gram-negative AMP 226 0 405 631
-#> 7 Gram-negative TZP 554 11 76 641
-#> 8 Gram-negative CZO 94 2 110 206
-#> 9 Gram-negative FEP 470 1 14 485
-#>10 Gram-negative CXM 539 22 142 703
-#># … with 70 more rows
+#> 5 Gram-negative AZM 1 2 696 699
+#> 6 Gram-negative CAZ 607 0 27 634
+#> 7 Gram-negative CHL 1 0 30 31
+#> 8 Gram-negative CIP 610 11 63 684
+#> 9 Gram-negative CLI 18 1 709 728
+#>10 Gram-negative COL 309 0 78 387
+#># … with 110 more rows#> Use 'format()' on this result to get a publishable/printable format.bug_drug_combinations(example_isolates,
@@ -289,16 +307,16 @@
#># A tibble: 80 × 6#> mo ab S I R total#>*<chr><chr><int><int><int><int>
-#> 1 E. coli PEN 0 0 467 467
-#> 2 E. coli OXA 0 0 0 0
-#> 3 E. coli FLC 0 0 0 0
+#> 1 E. coli AMC 332 74 61 467
+#> 2 E. coli AMK 171 0 0 171
+#> 3 E. coli AMP 196 0 196 392#> 4 E. coli AMX 196 0 196 392
-#> 5 E. coli AMC 332 74 61 467
-#> 6 E. coli AMP 196 0 196 392
-#> 7 E. coli TZP 388 5 23 416
-#> 8 E. coli CZO 79 1 2 82
-#> 9 E. coli FEP 308 0 9 317
-#>10 E. coli CXM 425 15 25 465
+#> 5 E. coli AZM 0 0 467 467
+#> 6 E. coli CAZ 449 0 11 460
+#> 7 E. coli CHL 0 0 0 0
+#> 8 E. coli CIP 398 1 57 456
+#> 9 E. coli CLI 0 0 467 467
+#>10 E. coli COL 240 0 0 240#># … with 70 more rows#> Use 'format()' on this result to get a publishable/printable format.# }
diff --git a/reference/clinical_breakpoints.html b/reference/clinical_breakpoints.html
index 1d2f80733..44866f505 100644
--- a/reference/clinical_breakpoints.html
+++ b/reference/clinical_breakpoints.html
@@ -10,7 +10,7 @@
AMR (for R)
- 1.8.2.9103
+ 1.8.2.9111
@@ -42,6 +42,11 @@
Conduct AMR Analysis
+
+
+
+ Generate Antibiogram (Trad./Syndromic/WISCA)
+
@@ -148,7 +153,7 @@
A data set containing 2,000 microbial isolates with their full antibiograms. This data set contains randomised fictitious data, but reflects reality and can be used to practise AMR data analysis. For examples, please read the tutorial on our website.
+
A data set containing 2 000 microbial isolates with their full antibiograms. This data set contains randomised fictitious data, but reflects reality and can be used to practise AMR data analysis. For examples, please read the tutorial on our website.
@@ -148,7 +153,7 @@
Format
-
A tibble with 2,000 observations and 46 variables:
date Date of receipt at the laboratory
+
A tibble with 2 000 observations and 46 variables:
date Date of receipt at the laboratory
patient ID of the patient
age Age of the patient
gender Gender of the patient, either "F" or "M"
diff --git a/reference/example_isolates_unclean.html b/reference/example_isolates_unclean.html
index 53ee9e342..a7da9f22d 100644
--- a/reference/example_isolates_unclean.html
+++ b/reference/example_isolates_unclean.html
@@ -1,5 +1,5 @@
-Data Set with Unclean Data — example_isolates_unclean • AMR (for R)Data Set with Unclean Data — example_isolates_unclean • AMR (for R)
@@ -10,7 +10,7 @@
AMR (for R)
- 1.8.2.9103
+ 1.8.2.9111
@@ -42,6 +42,11 @@
Conduct AMR Analysis
+
+
+
+ Generate Antibiogram (Trad./Syndromic/WISCA)
+
@@ -138,7 +143,7 @@
-
A data set containing 3,000 microbial isolates that are not cleaned up and consequently not ready for AMR data analysis. This data set can be used for practice.
+
A data set containing 3 000 microbial isolates that are not cleaned up and consequently not ready for AMR data analysis. This data set can be used for practice.
column name of the names or codes of the microorganisms (see as.mo()), defaults to the first column of class mo. Values will be coerced using as.mo().
col_testcode
@@ -284,7 +289,7 @@
According to Hindler et al. (2007, doi:10.1086/511864
), there are different methods (algorithms) to select first isolates with increasing reliability: isolate-based, patient-based, episode-based and phenotype-based. All methods select on a combination of the taxonomic genus and species (not subspecies).
-
All mentioned methods are covered in the first_isolate() function:
# `example_isolates` is a data set available in the AMR package.# See ?example_isolates.
-example_isolates[first_isolate(), ]
+example_isolates[first_isolate(info =TRUE), ]
+#> Determining first isolates using an episode length of 365 days
+#> ℹ Using column 'date' as input for col_date.
+#> ℹ Using column 'patient' as input for col_patient_id.
+#> Basing inclusion on all antimicrobial results, using a points threshold of
+#> 2#> Including isolates from ICU.
-#># A tibble: 1,379 × 46
+#> ℹ Excluded 16 isolates with a microbial ID 'UNKNOWN' (in column 'mo')
+#> => Found 1,984 'phenotype-based' first isolates (99.2% of total where a
+#> microbial ID was available)
+#># A tibble: 1,984 × 46#> date patient age gender ward mo PEN OXA FLC AMX #><date><chr><dbl><chr><chr><mo><sir><sir><sir><sir>#> 1 2002-01-02 A77334 65 F Clinical B_ESCHR_COLI R NA NA NA
-#> 2 2002-01-07 067927 45 F ICU B_STPHY_EPDR R NA R NA
-#> 3 2002-01-14 462729 78 M Clinical B_STPHY_AURS R NA S R
-#> 4 2002-01-17 858515 79 F ICU B_STPHY_EPDR R NA S NA
-#> 5 2002-01-17 495616 67 M Clinical B_STPHY_EPDR R NA S NA
-#> 6 2002-01-19 738003 71 M Clinical B_ESCHR_COLI R NA NA NA
-#> 7 2002-01-21 462081 75 F Clinical B_CTRBC_FRND R NA NA R
-#> 8 2002-01-22 F35553 50 M ICU B_PROTS_MRBL R NA NA NA
-#> 9 2002-02-03 481442 76 M ICU B_STPHY_CONS R NA S NA
-#>10 2002-02-05 023456 50 M Clinical B_STPHY_HMNS S NA S NA
-#># … with 1,369 more rows, and 36 more variables: AMC <sir>, AMP <sir>,
+#> 2 2002-01-03 A77334 65 F Clinical B_ESCHR_COLI R NA NA NA
+#> 3 2002-01-07 067927 45 F ICU B_STPHY_EPDR R NA R NA
+#> 4 2002-01-07 067927 45 F ICU B_STPHY_EPDR R NA R NA
+#> 5 2002-01-13 067927 45 F ICU B_STPHY_EPDR R NA R NA
+#> 6 2002-01-13 067927 45 F ICU B_STPHY_EPDR R NA R NA
+#> 7 2002-01-14 462729 78 M Clinical B_STPHY_AURS R NA S R
+#> 8 2002-01-14 462729 78 M Clinical B_STPHY_AURS R NA S R
+#> 9 2002-01-16 067927 45 F ICU B_STPHY_EPDR R NA R NA
+#>10 2002-01-17 858515 79 F ICU B_STPHY_EPDR R NA S NA
+#># … with 1,974 more rows, and 36 more variables: AMC <sir>, AMP <sir>,#># TZP <sir>, CZO <sir>, FEP <sir>, CXM <sir>, FOX <sir>, CTX <sir>,#># CAZ <sir>, CRO <sir>, GEN <sir>, TOB <sir>, AMK <sir>, KAN <sir>,#># TMP <sir>, SXT <sir>, NIT <sir>, FOS <sir>, LNZ <sir>, CIP <sir>,
@@ -357,22 +370,21 @@
# \donttest{# get all first Gram-negativesexample_isolates[which(first_isolate(info =FALSE)&mo_is_gram_negative()), ]
-#> Including isolates from ICU.#> ℹ Using column 'mo' as input for mo_is_gram_negative()
-#># A tibble: 437 × 46
+#># A tibble: 731 × 46#> date patient age gender ward mo PEN OXA FLC AMX #><date><chr><dbl><chr><chr><mo><sir><sir><sir><sir>#> 1 2002-01-02 A77334 65 F Clinical B_ESCHR_COLI R NA NA NA
-#> 2 2002-01-19 738003 71 M Clinical B_ESCHR_COLI R NA NA NA
-#> 3 2002-01-21 462081 75 F Clinical B_CTRBC_FRND R NA NA R
-#> 4 2002-01-22 F35553 50 M ICU B_PROTS_MRBL R NA NA NA
-#> 5 2002-02-05 067927 45 F ICU B_SERRT_MRCS R NA NA R
-#> 6 2002-02-27 066895 85 F Clinical B_KLBSL_PNMN R NA NA R
-#> 7 2002-03-08 4FC193 69 M Clinical B_ESCHR_COLI R NA NA R
-#> 8 2002-03-16 4FC193 69 M Clinical B_PSDMN_AERG R NA NA R
-#> 9 2002-04-01 496896 46 F ICU B_ESCHR_COLI R NA NA NA
-#>10 2002-04-23 EE2510 69 F ICU B_ESCHR_COLI R NA NA NA
-#># … with 427 more rows, and 36 more variables: AMC <sir>, AMP <sir>, TZP <sir>,
+#> 2 2002-01-03 A77334 65 F Clinical B_ESCHR_COLI R NA NA NA
+#> 3 2002-01-19 738003 71 M Clinical B_ESCHR_COLI R NA NA NA
+#> 4 2002-01-19 738003 71 M Clinical B_ESCHR_COLI R NA NA NA
+#> 5 2002-01-21 462081 75 F Clinical B_CTRBC_FRND R NA NA R
+#> 6 2002-01-22 F35553 50 M ICU B_PROTS_MRBL R NA NA NA
+#> 7 2002-01-22 F35553 50 M ICU B_PROTS_MRBL R NA NA NA
+#> 8 2002-02-05 067927 45 F ICU B_SERRT_MRCS R NA NA R
+#> 9 2002-02-05 067927 45 F ICU B_SERRT_MRCS R NA NA R
+#>10 2002-02-05 067927 45 F ICU B_SERRT_MRCS R NA NA R
+#># … with 721 more rows, and 36 more variables: AMC <sir>, AMP <sir>, TZP <sir>,#># CZO <sir>, FEP <sir>, CXM <sir>, FOX <sir>, CTX <sir>, CAZ <sir>,#># CRO <sir>, GEN <sir>, TOB <sir>, AMK <sir>, KAN <sir>, TMP <sir>,#># SXT <sir>, NIT <sir>, FOS <sir>, LNZ <sir>, CIP <sir>, MFX <sir>,
@@ -383,23 +395,29 @@
if(require("dplyr")){# filter on first isolates using dplyr:example_isolates%>%
-filter(first_isolate())
+filter(first_isolate(info =TRUE))}
+#> Determining first isolates using an episode length of 365 days
+#> Basing inclusion on all antimicrobial results, using a points threshold of
+#> 2#> Including isolates from ICU.
-#># A tibble: 1,379 × 46
+#> ℹ Excluded 16 isolates with a microbial ID 'UNKNOWN' (in column 'mo')
+#> => Found 1,984 'phenotype-based' first isolates (99.2% of total where a
+#> microbial ID was available)
+#># A tibble: 1,984 × 46#> date patient age gender ward mo PEN OXA FLC AMX #><date><chr><dbl><chr><chr><mo><sir><sir><sir><sir>#> 1 2002-01-02 A77334 65 F Clinical B_ESCHR_COLI R NA NA NA
-#> 2 2002-01-07 067927 45 F ICU B_STPHY_EPDR R NA R NA
-#> 3 2002-01-14 462729 78 M Clinical B_STPHY_AURS R NA S R
-#> 4 2002-01-17 858515 79 F ICU B_STPHY_EPDR R NA S NA
-#> 5 2002-01-17 495616 67 M Clinical B_STPHY_EPDR R NA S NA
-#> 6 2002-01-19 738003 71 M Clinical B_ESCHR_COLI R NA NA NA
-#> 7 2002-01-21 462081 75 F Clinical B_CTRBC_FRND R NA NA R
-#> 8 2002-01-22 F35553 50 M ICU B_PROTS_MRBL R NA NA NA
-#> 9 2002-02-03 481442 76 M ICU B_STPHY_CONS R NA S NA
-#>10 2002-02-05 023456 50 M Clinical B_STPHY_HMNS S NA S NA
-#># … with 1,369 more rows, and 36 more variables: AMC <sir>, AMP <sir>,
+#> 2 2002-01-03 A77334 65 F Clinical B_ESCHR_COLI R NA NA NA
+#> 3 2002-01-07 067927 45 F ICU B_STPHY_EPDR R NA R NA
+#> 4 2002-01-07 067927 45 F ICU B_STPHY_EPDR R NA R NA
+#> 5 2002-01-13 067927 45 F ICU B_STPHY_EPDR R NA R NA
+#> 6 2002-01-13 067927 45 F ICU B_STPHY_EPDR R NA R NA
+#> 7 2002-01-14 462729 78 M Clinical B_STPHY_AURS R NA S R
+#> 8 2002-01-14 462729 78 M Clinical B_STPHY_AURS R NA S R
+#> 9 2002-01-16 067927 45 F ICU B_STPHY_EPDR R NA R NA
+#>10 2002-01-17 858515 79 F ICU B_STPHY_EPDR R NA S NA
+#># … with 1,974 more rows, and 36 more variables: AMC <sir>, AMP <sir>,#># TZP <sir>, CZO <sir>, FEP <sir>, CXM <sir>, FOX <sir>, CTX <sir>,#># CAZ <sir>, CRO <sir>, GEN <sir>, TOB <sir>, AMK <sir>, KAN <sir>,#># TMP <sir>, SXT <sir>, NIT <sir>, FOS <sir>, LNZ <sir>, CIP <sir>,
@@ -411,21 +429,20 @@
example_isolates%>%filter_first_isolate(info =FALSE)}
-#> Including isolates from ICU.
-#># A tibble: 1,379 × 46
+#># A tibble: 1,984 × 46#> date patient age gender ward mo PEN OXA FLC AMX #><date><chr><dbl><chr><chr><mo><sir><sir><sir><sir>#> 1 2002-01-02 A77334 65 F Clinical B_ESCHR_COLI R NA NA NA
-#> 2 2002-01-07 067927 45 F ICU B_STPHY_EPDR R NA R NA
-#> 3 2002-01-14 462729 78 M Clinical B_STPHY_AURS R NA S R
-#> 4 2002-01-17 858515 79 F ICU B_STPHY_EPDR R NA S NA
-#> 5 2002-01-17 495616 67 M Clinical B_STPHY_EPDR R NA S NA
-#> 6 2002-01-19 738003 71 M Clinical B_ESCHR_COLI R NA NA NA
-#> 7 2002-01-21 462081 75 F Clinical B_CTRBC_FRND R NA NA R
-#> 8 2002-01-22 F35553 50 M ICU B_PROTS_MRBL R NA NA NA
-#> 9 2002-02-03 481442 76 M ICU B_STPHY_CONS R NA S NA
-#>10 2002-02-05 023456 50 M Clinical B_STPHY_HMNS S NA S NA
-#># … with 1,369 more rows, and 36 more variables: AMC <sir>, AMP <sir>,
+#> 2 2002-01-03 A77334 65 F Clinical B_ESCHR_COLI R NA NA NA
+#> 3 2002-01-07 067927 45 F ICU B_STPHY_EPDR R NA R NA
+#> 4 2002-01-07 067927 45 F ICU B_STPHY_EPDR R NA R NA
+#> 5 2002-01-13 067927 45 F ICU B_STPHY_EPDR R NA R NA
+#> 6 2002-01-13 067927 45 F ICU B_STPHY_EPDR R NA R NA
+#> 7 2002-01-14 462729 78 M Clinical B_STPHY_AURS R NA S R
+#> 8 2002-01-14 462729 78 M Clinical B_STPHY_AURS R NA S R
+#> 9 2002-01-16 067927 45 F ICU B_STPHY_EPDR R NA R NA
+#>10 2002-01-17 858515 79 F ICU B_STPHY_EPDR R NA S NA
+#># … with 1,974 more rows, and 36 more variables: AMC <sir>, AMP <sir>,#># TZP <sir>, CZO <sir>, FEP <sir>, CXM <sir>, FOX <sir>, CTX <sir>,#># CAZ <sir>, CRO <sir>, GEN <sir>, TOB <sir>, AMK <sir>, KAN <sir>,#># TMP <sir>, SXT <sir>, NIT <sir>, FOS <sir>, LNZ <sir>, CIP <sir>,
@@ -436,25 +453,22 @@
# flag the first isolates per group:example_isolates%>%group_by(ward)%>%
-mutate(first =first_isolate())%>%
+mutate(first =first_isolate(info =FALSE))%>%select(ward, date, patient, mo, first)}
-#> Including isolates from ICU.
-#> Including isolates from ICU.
-#> Including isolates from ICU.#># A tibble: 2,000 × 5#># Groups: ward [3]#> ward date patient mo first#><chr><date><chr><mo><lgl>#> 1 Clinical 2002-01-02 A77334 B_ESCHR_COLI TRUE
-#> 2 Clinical 2002-01-03 A77334 B_ESCHR_COLI FALSE
+#> 2 Clinical 2002-01-03 A77334 B_ESCHR_COLI TRUE #> 3 ICU 2002-01-07 067927 B_STPHY_EPDR TRUE
-#> 4 ICU 2002-01-07 067927 B_STPHY_EPDR FALSE
-#> 5 ICU 2002-01-13 067927 B_STPHY_EPDR FALSE
-#> 6 ICU 2002-01-13 067927 B_STPHY_EPDR FALSE
+#> 4 ICU 2002-01-07 067927 B_STPHY_EPDR TRUE
+#> 5 ICU 2002-01-13 067927 B_STPHY_EPDR TRUE
+#> 6 ICU 2002-01-13 067927 B_STPHY_EPDR TRUE #> 7 Clinical 2002-01-14 462729 B_STPHY_AURS TRUE
-#> 8 Clinical 2002-01-14 462729 B_STPHY_AURS FALSE
-#> 9 ICU 2002-01-16 067927 B_STPHY_EPDR FALSE
+#> 8 Clinical 2002-01-14 462729 B_STPHY_AURS TRUE
+#> 9 ICU 2002-01-16 067927 B_STPHY_EPDR TRUE #>10 ICU 2002-01-17 858515 B_STPHY_EPDR TRUE #># … with 1,990 more rows# }
diff --git a/reference/g.test.html b/reference/g.test.html
index 6d54325f6..f4c7119ad 100644
--- a/reference/g.test.html
+++ b/reference/g.test.html
@@ -10,7 +10,7 @@
AMR (for R)
- 1.8.2.9103
+ 1.8.2.9111
@@ -42,6 +42,11 @@
Conduct AMR Analysis
+
+
+
+ Generate Antibiogram (Trad./Syndromic/WISCA)
+
diff --git a/reference/get_episode.html b/reference/get_episode.html
index da0f76bd6..b24cf3e76 100644
--- a/reference/get_episode.html
+++ b/reference/get_episode.html
@@ -1,5 +1,5 @@
-Determine (New) Episodes for Patients — get_episode • AMR (for R)Determine (New) Episodes for Patients — get_episode • AMR (for R)
@@ -10,7 +10,7 @@
AMR (for R)
- 1.8.2.9103
+ 1.8.2.9111
@@ -42,6 +42,11 @@
Conduct AMR Analysis
+
+
+
+ Generate Antibiogram (Trad./Syndromic/WISCA)
+
@@ -133,12 +138,12 @@
These functions determine which items in a vector can be considered (the start of) a new episode, based on the argument episode_days. This can be used to determine clinical episodes for any epidemiological analysis. The get_episode() function returns the index number of the episode per group, while the is_new_episode() function returns values TRUE/FALSE to indicate whether an item in a vector is the start of a new episode.
+
These functions determine which items in a vector can be considered (the start of) a new episode, based on the argument episode_days. This can be used to determine clinical episodes for any epidemiological analysis. The get_episode() function returns the index number of the episode per group, while the is_new_episode() function returns values TRUE/FALSE for where get_episode() returns 1, and is thus equal to get_episode(...) == 1.
@@ -173,7 +178,7 @@
Details
Dates are first sorted from old to new. The oldest date will mark the start of the first episode. After this date, the next date will be marked that is at least episode_days days later than the start of the first episode. From that second marked date on, the next date will be marked that is at least episode_days days later than the start of the second episode which will be the start of the third episode, and so on. Before the vector is being returned, the original order will be restored.
The first_isolate() function is a wrapper around the is_new_episode() function, but is more efficient for data sets containing microorganism codes or names and allows for different isolate selection methods.
-
The dplyr package is not required for these functions to work, but these functions do support variable grouping and work conveniently inside dplyr verbs such as filter(), mutate() and summarise().
+
The dplyr package is not required for these functions to work, but these episode functions do support variable grouping and work conveniently inside dplyr verbs such as filter(), mutate() and summarise().
See also
@@ -184,47 +189,32 @@
Examples
# `example_isolates` is a data set available in the AMR package.# See ?example_isolates
-df<-example_isolates[sample(seq_len(2000), size =200), ]
+df<-example_isolates[sample(seq_len(2000), size =100), ]get_episode(df$date, episode_days =60)# indices
-#> [1] 14 30 51 29 53 28 49 36 9 7 29 9 43 30 20 51 5 2 5 9 27 6 21 25 14
-#> [26] 20 29 22 42 51 56 39 31 47 1 10 56 7 54 13 39 20 44 10 37 45 26 42 53 3
-#> [51] 2 7 13 51 48 52 31 9 38 50 54 15 41 53 38 23 16 9 26 12 5 26 4 6 31
-#> [76] 7 40 27 55 57 22 52 27 36 26 16 10 48 23 36 49 47 6 6 56 22 51 48 44 24
-#> [101] 58 33 47 49 58 32 8 6 21 3 14 33 57 43 14 50 6 3 53 6 18 15 52 31 22
-#> [126] 7 47 6 42 39 45 1 49 23 53 13 18 35 8 57 12 11 17 3 55 16 12 54 55 14
-#> [151] 9 46 51 55 19 7 36 8 57 4 14 45 45 59 38 55 25 23 60 57 39 38 54 16 31
-#> [176] 3 16 39 50 37 40 14 53 60 6 34 32 14 3 30 52 24 23 1 59 52 11 41 7 26
+#> [1] 24 25 6 9 9 40 28 6 15 42 34 3 1 21 39 3 5 22 30 13 14 31 12 41 36
+#> [26] 34 38 46 18 25 45 43 2 5 17 44 23 43 8 37 17 28 31 43 26 47 43 6 1 28
+#> [51] 18 12 30 22 20 29 31 34 18 13 48 12 31 15 4 3 16 2 7 35 6 19 29 11 24
+#> [76] 16 12 28 14 32 1 23 13 4 6 9 46 38 37 10 13 17 12 40 33 30 7 27 48 38is_new_episode(df$date, episode_days =60)# TRUE/FALSE
-#> [1] FALSE TRUE FALSE TRUE FALSE TRUE FALSE FALSE FALSE FALSE FALSE TRUE
-#> [13] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE TRUE TRUE
-#> [25] FALSE TRUE FALSE FALSE TRUE FALSE TRUE FALSE TRUE FALSE FALSE TRUE
-#> [37] FALSE FALSE TRUE FALSE FALSE FALSE TRUE FALSE TRUE FALSE FALSE FALSE
-#> [49] FALSE FALSE TRUE TRUE TRUE TRUE FALSE TRUE FALSE FALSE FALSE FALSE
-#> [61] FALSE FALSE TRUE FALSE TRUE FALSE FALSE FALSE FALSE FALSE TRUE FALSE
-#> [73] FALSE FALSE FALSE FALSE TRUE TRUE FALSE FALSE TRUE FALSE FALSE FALSE
-#> [85] TRUE FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE
-#> [97] FALSE TRUE FALSE FALSE FALSE TRUE FALSE FALSE TRUE FALSE TRUE FALSE
-#> [109] FALSE FALSE FALSE FALSE FALSE TRUE TRUE TRUE TRUE FALSE TRUE FALSE
-#> [121] TRUE TRUE FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE
-#> [133] FALSE FALSE FALSE FALSE FALSE TRUE FALSE TRUE TRUE FALSE TRUE FALSE
-#> [145] FALSE TRUE FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE TRUE FALSE
-#> [157] TRUE FALSE FALSE TRUE FALSE TRUE FALSE TRUE FALSE TRUE FALSE FALSE
-#> [169] TRUE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
-#> [181] FALSE FALSE FALSE FALSE FALSE TRUE TRUE FALSE TRUE FALSE FALSE TRUE
-#> [193] TRUE TRUE FALSE FALSE TRUE FALSE FALSE FALSE
+#> [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
+#> [13] TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
+#> [25] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
+#> [37] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
+#> [49] TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
+#> [61] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
+#> [73] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE
+#> [85] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
+#> [97] FALSE FALSE FALSE FALSE# filter on results from the third 60-day episode only, using base Rdf[which(get_episode(df$date, 60)==3), ]
-#># A tibble: 6 × 46
-#> date patient age gender ward mo PEN OXA FLC AMX
-#><date><chr><dbl><chr><chr><mo><sir><sir><sir><sir>
-#>1 2002-11-07 430011 82 F Clinical B_STPHY_CONS R NA R R
-#>2 2002-10-18 E55128 57 F ICU B_STPHY_AURS R NA S R
-#>3 2002-11-14 058917 76 F ICU B_STPHY_HMNS R NA S NA
-#>4 2002-10-18 E55128 57 F ICU B_STPHY_AURS R NA S R
-#>5 2002-11-18 956065 89 F Clinical B_ESCHR_COLI R NA NA NA
-#>6 2002-10-14 FCC668 54 F ICU B_ACNTB R NA NA NA
+#># A tibble: 3 × 46
+#> date patient age gender ward mo PEN OXA FLC AMX
+#><date><chr><dbl><chr><chr><mo><sir><sir><sir><sir>
+#>1 2003-02-26 869648 64 M Outpatie… B_STPHY_AURS R NA R R
+#>2 2003-03-22 E44854 60 F ICU B_STRPT_PNMN S NA NA S
+#>3 2003-01-25 088256 73 F ICU B_STPHY_HMNS R NA R R #># … with 36 more variables: AMC <sir>, AMP <sir>, TZP <sir>, CZO <sir>,#># FEP <sir>, CXM <sir>, FOX <sir>, CTX <sir>, CAZ <sir>, CRO <sir>,#># GEN <sir>, TOB <sir>, AMK <sir>, KAN <sir>, TMP <sir>, SXT <sir>,
@@ -234,13 +224,9 @@
#># MUP <sir>, RIF <sir># the functions also work for less than a day, e.g. to include one per hour:
-get_episode(
-c(
-Sys.time(),
-Sys.time()+60*60
-),
- episode_days =1/24
-)
+get_episode(c(Sys.time(),
+Sys.time()+60*60),
+ episode_days =1/24)#> [1] 1 2# \donttest{
@@ -257,45 +243,36 @@
mutate(new_episode =is_new_episode(date, 365))%>%select(patient, date, condition, new_episode)}
-#># A tibble: 200 × 4
-#># Groups: condition [3]
-#> patient date condition new_episode
-#><chr><date><chr><lgl>
-#> 1 277241 2005-08-31 A FALSE
-#> 2 A86006 2009-08-09 C FALSE
-#> 3 16DC39 2015-11-19 A FALSE
-#> 4 F68330 2009-04-09 A FALSE
-#> 5 A79917 2016-05-21 B FALSE
-#> 6 A80D37 2009-01-19 A FALSE
-#> 7 335263 2015-04-30 B FALSE
-#> 8 257844 2011-05-22 B FALSE
-#> 9 B8F499 2004-08-22 B FALSE
-#>10 F35553 2004-02-28 A FALSE
-#># … with 190 more rows
+#>Error in mutate(., condition = sample(x = c("A", "B", "C"), size = 200, replace = TRUE)):ℹ In argument: `condition = sample(x = c("A", "B", "C"), size = 200,
+#> replace = TRUE)`.
+#>Caused by error:
+#>! `condition` must be size 100 or 1, not 200.
+if(require("dplyr")){df%>%group_by(ward, patient)%>%
-transmute(date,
+transmute(date,patient, new_index =get_episode(date, 60), new_logical =is_new_episode(date, 60))}
-#># A tibble: 200 × 5
-#># Groups: ward, patient [183]
+#># A tibble: 100 × 5
+#># Groups: ward, patient [96]#> ward date patient new_index new_logical#><chr><date><chr><dbl><lgl>
-#> 1 ICU 2005-08-31 277241 1 TRUE
-#> 2 Clinical 2009-08-09 A86006 1 TRUE
-#> 3 ICU 2015-11-19 16DC39 1 TRUE
-#> 4 Clinical 2009-04-09 F68330 1 TRUE
-#> 5 Clinical 2016-05-21 A79917 1 TRUE
-#> 6 Clinical 2009-01-19 A80D37 1 TRUE
-#> 7 Clinical 2015-04-30 335263 1 TRUE
-#> 8 Clinical 2011-05-22 257844 1 TRUE
-#> 9 Clinical 2004-08-22 B8F499 1 TRUE
-#>10 ICU 2004-02-28 F35553 2 TRUE
-#># … with 190 more rows
+#> 1 Clinical 2009-12-30 6D2377 1 TRUE
+#> 2 Clinical 2010-04-05 192353 1 TRUE
+#> 3 Clinical 2004-02-02 136315 1 TRUE
+#> 4 ICU 2004-09-22 F35553 1 TRUE
+#> 5 ICU 2004-11-03 D65308 1 TRUE
+#> 6 Clinical 2015-08-14 A84726 1 TRUE
+#> 7 Clinical 2011-04-25 023456 1 TRUE
+#> 8 Clinical 2004-03-03 1435C8 1 TRUE
+#> 9 Clinical 2006-05-26 54890C 1 TRUE
+#>10 ICU 2016-01-28 845227 1 TRUE
+#># … with 90 more rows
+if(require("dplyr")){df%>%group_by(ward)%>%
@@ -309,50 +286,33 @@
#># A tibble: 3 × 5#> ward n_patients n_episodes_365 n_episodes_60 n_episodes_30#><chr><int><int><int><int>
-#>1 Clinical 114 15 53 73
-#>2 ICU 62 12 38 46
-#>3 Outpatient 7 6 7 7
-if(require("dplyr")){
-# grouping on patients and microorganisms leads to the same
-# results as first_isolate() when using 'episode-based':
-x<-df%>%
-filter_first_isolate(
- include_unknown =TRUE,
- method ="episode-based"
-)
+#>1 Clinical 61 2 1 1
+#>2 ICU 31 6 2 1
+#>3 Outpatient 4 2 1 1
-y<-df%>%
-group_by(patient, mo)%>%
-filter(is_new_episode(date, 365))%>%
-ungroup()
-
-identical(x, y)
-}
-#> Including isolates from ICU.
-#> [1] FALSEif(require("dplyr")){
-# but is_new_episode() has a lot more flexibility than first_isolate(),
-# since you can now group on anything that seems relevant:
+# is_new_episode() has a lot more flexibility than first_isolate(),
+# since you can group on anything that seems relevant:df%>%group_by(patient, mo, ward)%>%mutate(flag_episode =is_new_episode(date, 365))%>%select(group_vars(.), flag_episode)}
-#># A tibble: 200 × 4
-#># Groups: patient, mo, ward [189]
-#> patient mo ward flag_episode
-#><chr><mo><chr><lgl>
-#> 1 277241 B_STPHY_AURS ICU TRUE
-#> 2 A86006 B_STPHY_CONS Clinical TRUE
-#> 3 16DC39 B_STPHY_HMLY ICU TRUE
-#> 4 F68330 B_STRPT_PNMN Clinical TRUE
-#> 5 A79917 B_ENTRC_FACM Clinical TRUE
-#> 6 A80D37 B_ESCHR_COLI Clinical TRUE
-#> 7 335263 B_ENTRBC_CLOC Clinical TRUE
-#> 8 257844 B_STPHY_CONS Clinical TRUE
-#> 9 B8F499 B_STPHY_CONS Clinical TRUE
-#>10 F35553 B_STPHY_AURS ICU TRUE
-#># … with 190 more rows
+#># A tibble: 100 × 4
+#># Groups: patient, mo, ward [98]
+#> patient mo ward flag_episode
+#><chr><mo><chr><lgl>
+#> 1 6D2377 B_FSBCT Clinical TRUE
+#> 2 192353 B_STRPT_PNMN Clinical TRUE
+#> 3 136315 B_STRPT Clinical TRUE
+#> 4 F35553 B_STRPT_ORLS ICU TRUE
+#> 5 D65308 B_STPHY_EPDR ICU TRUE
+#> 6 A84726 B_STPHY_HMNS Clinical TRUE
+#> 7 023456 B_PROTS_MRBL Clinical TRUE
+#> 8 1435C8 B_ESCHR_COLI Clinical TRUE
+#> 9 54890C B_ESCHR_COLI Clinical TRUE
+#>10 845227 B_STRPT_PNMN ICU TRUE
+#># … with 90 more rows# }
diff --git a/reference/ggplot_pca.html b/reference/ggplot_pca.html
index 428654615..839d2ba6f 100644
--- a/reference/ggplot_pca.html
+++ b/reference/ggplot_pca.html
@@ -10,7 +10,7 @@
AMR (for R)
- 1.8.2.9103
+ 1.8.2.9111
@@ -42,6 +42,11 @@
Conduct AMR Analysis
+
+
+
+ Generate Antibiogram (Trad./Syndromic/WISCA)
+
@@ -318,152 +323,15 @@
labs(title ="Title here")}}
-#>Warning: Introducing NA: only 14 results available for PEN in group: order =
+#>Warning: There were 73 warnings in `summarise()`.
+#> The first warning was:
+#>ℹ In argument: `PEN = (function (..., minimum = 30, as_percent = FALSE,
+#> only_all_tested = FALSE) ...`.
+#>ℹ In group 5: `order = "Lactobacillales"`, `genus = "Enterococcus"`.
+#> Caused by warning:
+#>! Introducing NA: only 14 results available for PEN in group: order =#> "Lactobacillales", genus = "Enterococcus" (minimum = 30).
-#>Warning: Introducing NA: no results available for OXA in group: order =
-#> "Enterobacterales", genus = "Escherichia" (minimum = 30).
-#>Warning: Introducing NA: no results available for OXA in group: order =
-#> "Enterobacterales", genus = "Klebsiella" (minimum = 30).
-#>Warning: Introducing NA: no results available for OXA in group: order =
-#> "Enterobacterales", genus = "Proteus" (minimum = 30).
-#>Warning: Introducing NA: only 13 results available for OXA in group: order =
-#> "Lactobacillales", genus = "Enterococcus" (minimum = 30).
-#>Warning: Introducing NA: only 15 results available for OXA in group: order =
-#> "Lactobacillales", genus = "Streptococcus" (minimum = 30).
-#>Warning: Introducing NA: no results available for OXA in group: order =
-#> "Pseudomonadales", genus = "Pseudomonas" (minimum = 30).
-#>Warning: Introducing NA: no results available for FLC in group: order =
-#> "Enterobacterales", genus = "Escherichia" (minimum = 30).
-#>Warning: Introducing NA: no results available for FLC in group: order =
-#> "Enterobacterales", genus = "Klebsiella" (minimum = 30).
-#>Warning: Introducing NA: no results available for FLC in group: order =
-#> "Enterobacterales", genus = "Proteus" (minimum = 30).
-#>Warning: Introducing NA: only 13 results available for FLC in group: order =
-#> "Lactobacillales", genus = "Enterococcus" (minimum = 30).
-#>Warning: Introducing NA: no results available for FLC in group: order =
-#> "Pseudomonadales", genus = "Pseudomonas" (minimum = 30).
-#>Warning: Introducing NA: only 26 results available for AMX in group: order =
-#> "Enterobacterales", genus = "Proteus" (minimum = 30).
-#>Warning: Introducing NA: only 26 results available for AMP in group: order =
-#> "Enterobacterales", genus = "Proteus" (minimum = 30).
-#>Warning: Introducing NA: only 27 results available for TZP in group: order =
-#> "Pseudomonadales", genus = "Pseudomonas" (minimum = 30).
-#>Warning: Introducing NA: only 12 results available for CZO in group: order =
-#> "Enterobacterales", genus = "Klebsiella" (minimum = 30).
-#>Warning: Introducing NA: only 5 results available for CZO in group: order =
-#> "Enterobacterales", genus = "Proteus" (minimum = 30).
-#>Warning: Introducing NA: only 27 results available for FEP in group: order =
-#> "Enterobacterales", genus = "Proteus" (minimum = 30).
-#>Warning: Introducing NA: only 23 results available for FEP in group: order =
-#> "Pseudomonadales", genus = "Pseudomonas" (minimum = 30).
-#>Warning: Introducing NA: only 29 results available for FOX in group: order =
-#> "Enterobacterales", genus = "Proteus" (minimum = 30).
-#>Warning: Introducing NA: only 26 results available for AMK in group: order =
-#> "Enterobacterales", genus = "Klebsiella" (minimum = 30).
-#>Warning: Introducing NA: only 6 results available for AMK in group: order =
-#> "Enterobacterales", genus = "Proteus" (minimum = 30).
-#>Warning: Introducing NA: only 17 results available for AMK in group: order =
-#> "Pseudomonadales", genus = "Pseudomonas" (minimum = 30).
-#>Warning: Introducing NA: no results available for KAN in group: order =
-#> "Enterobacterales", genus = "Escherichia" (minimum = 30).
-#>Warning: Introducing NA: no results available for KAN in group: order =
-#> "Enterobacterales", genus = "Klebsiella" (minimum = 30).
-#>Warning: Introducing NA: no results available for KAN in group: order =
-#> "Enterobacterales", genus = "Proteus" (minimum = 30).
-#>Warning: Introducing NA: only 6 results available for NIT in group: order =
-#> "Lactobacillales", genus = "Streptococcus" (minimum = 30).
-#>Warning: Introducing NA: only 17 results available for NIT in group: order =
-#> "Pseudomonadales", genus = "Pseudomonas" (minimum = 30).
-#>Warning: Introducing NA: only 8 results available for FOS in group: order =
-#> "Enterobacterales", genus = "Klebsiella" (minimum = 30).
-#>Warning: Introducing NA: only 2 results available for FOS in group: order =
-#> "Enterobacterales", genus = "Proteus" (minimum = 30).
-#>Warning: Introducing NA: no results available for FOS in group: order =
-#> "Lactobacillales", genus = "Enterococcus" (minimum = 30).
-#>Warning: Introducing NA: no results available for FOS in group: order =
-#> "Lactobacillales", genus = "Streptococcus" (minimum = 30).
-#>Warning: Introducing NA: no results available for FOS in group: order =
-#> "Pseudomonadales", genus = "Pseudomonas" (minimum = 30).
-#>Warning: Introducing NA: only 7 results available for LNZ in group: order =
-#> "Lactobacillales", genus = "Streptococcus" (minimum = 30).
-#>Warning: Introducing NA: only 5 results available for CIP in group: order =
-#> "Lactobacillales", genus = "Enterococcus" (minimum = 30).
-#>Warning: Introducing NA: only 23 results available for CIP in group: order =
-#> "Lactobacillales", genus = "Streptococcus" (minimum = 30).
-#>Warning: Introducing NA: only 2 results available for MFX in group: order =
-#> "Enterobacterales", genus = "Klebsiella" (minimum = 30).
-#>Warning: Introducing NA: only 2 results available for MFX in group: order =
-#> "Enterobacterales", genus = "Proteus" (minimum = 30).
-#>Warning: Introducing NA: no results available for MFX in group: order =
-#> "Lactobacillales", genus = "Enterococcus" (minimum = 30).
-#>Warning: Introducing NA: only 7 results available for MFX in group: order =
-#> "Lactobacillales", genus = "Streptococcus" (minimum = 30).
-#>Warning: Introducing NA: no results available for MFX in group: order =
-#> "Pseudomonadales", genus = "Pseudomonas" (minimum = 30).
-#>Warning: Introducing NA: only 6 results available for TEC in group: order =
-#> "Lactobacillales", genus = "Streptococcus" (minimum = 30).
-#>Warning: Introducing NA: only 3 results available for TCY in group: order =
-#> "Enterobacterales", genus = "Escherichia" (minimum = 30).
-#>Warning: Introducing NA: only 2 results available for TCY in group: order =
-#> "Enterobacterales", genus = "Klebsiella" (minimum = 30).
-#>Warning: Introducing NA: only 18 results available for TGC in group: order =
-#> "Enterobacterales", genus = "Klebsiella" (minimum = 30).
-#>Warning: Introducing NA: only 7 results available for TGC in group: order =
-#> "Lactobacillales", genus = "Streptococcus" (minimum = 30).
-#>Warning: Introducing NA: no results available for DOX in group: order =
-#> "Enterobacterales", genus = "Escherichia" (minimum = 30).
-#>Warning: Introducing NA: no results available for DOX in group: order =
-#> "Enterobacterales", genus = "Klebsiella" (minimum = 30).
-#>Warning: Introducing NA: only 2 results available for DOX in group: order =
-#> "Lactobacillales", genus = "Enterococcus" (minimum = 30).
-#>Warning: Introducing NA: only 27 results available for IPM in group: order =
-#> "Pseudomonadales", genus = "Pseudomonas" (minimum = 30).
-#>Warning: Introducing NA: only 25 results available for MEM in group: order =
-#> "Lactobacillales", genus = "Enterococcus" (minimum = 30).
-#>Warning: Introducing NA: only 26 results available for MEM in group: order =
-#> "Pseudomonadales", genus = "Pseudomonas" (minimum = 30).
-#>Warning: Introducing NA: no results available for MTR in group: order =
-#> "Caryophanales", genus = "Staphylococcus" (minimum = 30).
-#>Warning: Introducing NA: only 2 results available for MTR in group: order =
-#> "Enterobacterales", genus = "Escherichia" (minimum = 30).
-#>Warning: Introducing NA: no results available for MTR in group: order =
-#> "Enterobacterales", genus = "Klebsiella" (minimum = 30).
-#>Warning: Introducing NA: no results available for MTR in group: order =
-#> "Enterobacterales", genus = "Proteus" (minimum = 30).
-#>Warning: Introducing NA: no results available for MTR in group: order =
-#> "Lactobacillales", genus = "Enterococcus" (minimum = 30).
-#>Warning: Introducing NA: no results available for MTR in group: order =
-#> "Lactobacillales", genus = "Streptococcus" (minimum = 30).
-#>Warning: Introducing NA: no results available for MTR in group: order =
-#> "Pseudomonadales", genus = "Pseudomonas" (minimum = 30).
-#>Warning: Introducing NA: no results available for CHL in group: order =
-#> "Enterobacterales", genus = "Escherichia" (minimum = 30).
-#>Warning: Introducing NA: no results available for CHL in group: order =
-#> "Enterobacterales", genus = "Klebsiella" (minimum = 30).
-#>Warning: Introducing NA: no results available for CHL in group: order =
-#> "Enterobacterales", genus = "Proteus" (minimum = 30).
-#>Warning: Introducing NA: no results available for CHL in group: order =
-#> "Lactobacillales", genus = "Enterococcus" (minimum = 30).
-#>Warning: Introducing NA: no results available for CHL in group: order =
-#> "Lactobacillales", genus = "Streptococcus" (minimum = 30).
-#>Warning: Introducing NA: only 9 results available for COL in group: order =
-#> "Pseudomonadales", genus = "Pseudomonas" (minimum = 30).
-#>Warning: Introducing NA: no results available for MUP in group: order =
-#> "Enterobacterales", genus = "Escherichia" (minimum = 30).
-#>Warning: Introducing NA: no results available for MUP in group: order =
-#> "Enterobacterales", genus = "Klebsiella" (minimum = 30).
-#>Warning: Introducing NA: no results available for MUP in group: order =
-#> "Enterobacterales", genus = "Proteus" (minimum = 30).
-#>Warning: Introducing NA: no results available for MUP in group: order =
-#> "Lactobacillales", genus = "Enterococcus" (minimum = 30).
-#>Warning: Introducing NA: no results available for MUP in group: order =
-#> "Lactobacillales", genus = "Streptococcus" (minimum = 30).
-#>Warning: Introducing NA: no results available for MUP in group: order =
-#> "Pseudomonadales", genus = "Pseudomonas" (minimum = 30).
-#>Warning: Introducing NA: no results available for RIF in group: order =
-#> "Lactobacillales", genus = "Enterococcus" (minimum = 30).
-#>Warning: Introducing NA: no results available for RIF in group: order =
-#> "Lactobacillales", genus = "Streptococcus" (minimum = 30).
+#>ℹ Run `dplyr::last_dplyr_warnings()` to see the 72 remaining warnings.#> ℹ Columns selected for PCA: "AMC", "CAZ", "CTX", "CXM", "GEN", "SXT", "TMP"#> and "TOB". Total observations available: 7.#> Groups (n=4, named as 'order'):
diff --git a/reference/ggplot_sir-8.png b/reference/ggplot_sir-8.png
index 8daa19d00..5b10bb883 100644
Binary files a/reference/ggplot_sir-8.png and b/reference/ggplot_sir-8.png differ
diff --git a/reference/ggplot_sir.html b/reference/ggplot_sir.html
index 3674610f4..667fa2887 100644
--- a/reference/ggplot_sir.html
+++ b/reference/ggplot_sir.html
@@ -10,7 +10,7 @@
AMR (for R)
- 1.8.2.9103
+ 1.8.2.9111
@@ -42,6 +42,11 @@
Conduct AMR Analysis
+
+
+
+ Generate Antibiogram (Trad./Syndromic/WISCA)
+
@@ -391,9 +396,8 @@
select(age_group, CIP)%>%ggplot_sir(x ="age_group")}
-#> Including isolates from ICU.
-#>Warning: Removed 6 rows containing missing values (`position_stack()`).
-#>Warning: Removed 6 rows containing missing values (`position_stack()`).
+#>Warning: Removed 4 rows containing missing values (`position_stack()`).
+#>Warning: Removed 4 rows containing missing values (`position_stack()`).if(require("ggplot2")&&require("dplyr")){# a shorter version which also adjusts data label colours:
diff --git a/reference/guess_ab_col.html b/reference/guess_ab_col.html
index 80103ab93..bddb62312 100644
--- a/reference/guess_ab_col.html
+++ b/reference/guess_ab_col.html
@@ -10,7 +10,7 @@
AMR (for R)
- 1.8.2.9103
+ 1.8.2.9111
@@ -42,6 +42,11 @@
Conduct AMR Analysis
+
+
+
+ Generate Antibiogram (Trad./Syndromic/WISCA)
+
diff --git a/reference/index.html b/reference/index.html
index 3a20b446b..ac5d0b75c 100644
--- a/reference/index.html
+++ b/reference/index.html
@@ -10,7 +10,7 @@
AMR (for R)
- 1.8.2.9103
+ 1.8.2.9111
@@ -42,6 +42,11 @@
Conduct AMR Analysis
+
+
+
+ Generate Antibiogram (Trad./Syndromic/WISCA)
+
@@ -241,7 +246,7 @@
Analysing data: antimicrobial resistance
-
Use these function for the analysis part. You can use susceptibility() or resistance() on any antibiotic column. Be sure to first select the isolates that are appropiate for analysis, by using first_isolate() or is_new_episode(). You can also filter your data on certain resistance in certain antibiotic classes (carbapenems(), aminoglycosides()), or determine multi-drug resistant microorganisms (MDRO, mdro()).
+
Use these function for the analysis part. You can use susceptibility() or resistance() on any antibiotic column. With antibiogram(), you can generate a traditional, combined, syndromic, or weighted-incidence syndromic combination antibiogram(WISCA). This function also comes with support for R Markdown and Quarto. Be sure to first select the isolates that are appropiate for analysis, by using first_isolate() or is_new_episode(). You can also filter your data on certain resistance in certain antibiotic classes (carbapenems(), aminoglycosides()), or determine multi-drug resistant microorganisms (MDRO, mdro()).
column name of the names or codes of the microorganisms (see as.mo()), defaults to the first column of class mo. Values will be coerced using as.mo().
info
@@ -347,7 +352,10 @@ A microorganism is categorised as "Resistant" when there is a high likelihood of
#>Warning: in mdro(): NA introduced for isolates where the available percentage of#> antimicrobial classes was below 50% (set with pct_required_classes)#> (16 isolates had no test results)
-#>Warning: in mdro(): NA introduced for isolates where the available percentage of
+#>Warning: There was 1 warning in `mutate()`.
+#>ℹ In argument: `MDRO = mdro()`.
+#> Caused by warning:
+#>! in mdro(): NA introduced for isolates where the available percentage of#> antimicrobial classes was below 50% (set with pct_required_classes)#> .#> Negative Multi-drug-resistant (MDR)
diff --git a/reference/mean_amr_distance.html b/reference/mean_amr_distance.html
index 385f62672..6b9a76860 100644
--- a/reference/mean_amr_distance.html
+++ b/reference/mean_amr_distance.html
@@ -10,7 +10,7 @@
AMR (for R)
- 1.8.2.9103
+ 1.8.2.9111
@@ -42,6 +42,11 @@
Conduct AMR Analysis
+
+
+
+ Generate Antibiogram (Trad./Syndromic/WISCA)
+
@@ -196,31 +201,31 @@
sir<-random_sir(10)sir#> Class 'sir'
-#> [1] S I R I S R R I R S
+#> [1] R S R R S R I S I Rmean_amr_distance(sir)
-#> [1] -0.7745967 -0.7745967 1.1618950 -0.7745967 -0.7745967 1.1618950
-#> [7] 1.1618950 -0.7745967 1.1618950 -0.7745967
+#> [1] 0.9486833 -0.9486833 0.9486833 0.9486833 -0.9486833 0.9486833
+#> [7] -0.9486833 -0.9486833 -0.9486833 0.9486833mic<-random_mic(10)mic#> Class 'mic'
-#> [1] 0.5 0.005 4 0.005 4 16 8 >=128 <=0.002
-#> [10] 0.125
+#> [1] <=0.001 8 2 <=0.001 16 <=0.001 0.25 128 0.125
+#> [10] <=0.001mean_amr_distance(mic)
-#> [1] 0.004555148 -1.189296722 0.543632982 -1.189296722 0.543632982
-#> [6] 0.903018205 0.723325594 1.442096040 -1.426837433 -0.354830075
+#> [1] -1.052079574 0.902371938 0.600893605 -1.052079574 1.053111104
+#> [6] -1.052079574 0.148676107 1.505328602 -0.002063059 -1.052079574# equal to the Z-score of their log2:(log2(mic)-mean(log2(mic)))/sd(log2(mic))
-#> [1] 0.004555148 -1.189296722 0.543632982 -1.189296722 0.543632982
-#> [6] 0.903018205 0.723325594 1.442096040 -1.426837433 -0.354830075
+#> [1] -1.052079574 0.902371938 0.600893605 -1.052079574 1.053111104
+#> [6] -1.052079574 0.148676107 1.505328602 -0.002063059 -1.052079574disk<-random_disk(10)disk#> Class 'disk'
-#> [1] 8 32 43 15 44 37 16 14 29 29
+#> [1] 38 7 36 29 48 15 25 50 50 39mean_amr_distance(disk)
-#> [1] -1.4621577 0.4144083 1.2745011 -0.9148259 1.3526913 0.8053596
-#> [7] -0.8366357 -0.9930162 0.1798376 0.1798376
+#> [1] 0.2922699 -1.8147922 0.1563304 -0.3194578 0.9719673 -1.2710342
+#> [7] -0.5913368 1.1079068 1.1079068 0.3602396y<-data.frame( id =LETTERS[1:10],
@@ -230,36 +235,26 @@
tobr =random_mic(10, ab ="tobr", mo ="Escherichia coli"))y
-#> id amox cipr gent tobr
-#> 1 A I 25 16 0.25
-#> 2 B I 30 16 0.25
-#> 3 C I 28 0.5 8
-#> 4 D I 26 16 0.25
-#> 5 E S 26 8 0.5
-#> 6 F R 21 16 0.25
-#> 7 G S 19 2 2
-#> 8 H I 27 8 1
-#> 9 I R 19 8 1
-#> 10 J R 28 8 4
+#> id amox cipr gent tobr
+#> 1 A S 26 <=0.5 0.5
+#> 2 B I 20 >=16 2
+#> 3 C R 22 1 0.5
+#> 4 D S 25 >=16 >=8
+#> 5 E I 18 >=16 0.5
+#> 6 F S 18 <=0.5 <=0.25
+#> 7 G S 19 2 <=0.25
+#> 8 H S 21 8 0.5
+#> 9 I R 25 1 <=0.25
+#> 10 J S 25 <=0.5 <=0.25mean_amr_distance(y)#> ℹ Calculating mean AMR distance based on columns "amox", "cipr", "gent" and#> "tobr"
-#> [1] -0.19598774 0.12451337 -0.09209741 -0.13188752 -0.14956959 0.06516053
-#> [7] -0.63363528 0.05123363 0.05598101 0.90628900
-y$amr_distance<-mean_amr_distance(y, where(is.mic))
-#> ℹ Calculating mean AMR distance based on columns "gent" and "tobr"
+#> [1] -0.08308833 0.31310698 0.30459906 1.01959980 -0.15475222 -0.87382971
+#> [7] -0.56840820 -0.02905708 0.38884763 -0.31701792
+y$amr_distance<-mean_amr_distance(y, where(is.mic))
+#>Error in .subset(x, j): invalid subscript type 'list'y[order(y$amr_distance), ]
-#> id amox cipr gent tobr amr_distance
-#> 3 C I 28 0.5 8 -0.27108669
-#> 7 G S 19 2 2 -0.20035843
-#> 5 E S 26 8 0.5 -0.12963016
-#> 1 A I 25 16 0.25 -0.09426603
-#> 2 B I 30 16 0.25 -0.09426603
-#> 4 D I 26 16 0.25 -0.09426603
-#> 6 F R 21 16 0.25 -0.09426603
-#> 8 H I 27 8 1 0.14377582
-#> 9 I R 19 8 1 0.14377582
-#> 10 J R 28 8 4 0.69058778
+#>Error in order(y$amr_distance): argument 1 is not a vectorif(require("dplyr")){y%>%
@@ -271,17 +266,17 @@
}#> ℹ Calculating mean AMR distance based on columns "amox", "cipr", "gent" and#> "tobr"
-#> id amox cipr gent tobr amr_distance check_id_C
-#> 1 C I 28 0.5 8 -0.09209741 0.00000000
-#> 2 D I 26 16 0.25 -0.13188752 0.03979011
-#> 3 E S 26 8 0.5 -0.14956959 0.05747218
-#> 4 A I 25 16 0.25 -0.19598774 0.10389034
-#> 5 H I 27 8 1 0.05123363 0.14333103
-#> 6 I R 19 8 1 0.05598101 0.14807842
-#> 7 F R 21 16 0.25 0.06516053 0.15725794
-#> 8 B I 30 16 0.25 0.12451337 0.21661078
-#> 9 G S 19 2 2 -0.63363528 0.54153787
-#> 10 J R 28 8 4 0.90628900 0.99838641
+#> id amox cipr gent tobr amr_distance check_id_C
+#> 1 C R 22 1 0.5 0.30459906 0.000000000
+#> 2 B I 20 >=16 2 0.31310698 0.008507921
+#> 3 I R 25 1 <=0.25 0.38884763 0.084248568
+#> 4 H S 21 8 0.5 -0.02905708 0.333656139
+#> 5 A S 26 <=0.5 0.5 -0.08308833 0.387687383
+#> 6 E I 18 >=16 0.5 -0.15475222 0.459351276
+#> 7 J S 25 <=0.5 <=0.25 -0.31701792 0.621616981
+#> 8 D S 25 >=16 >=8 1.01959980 0.715000742
+#> 9 G S 19 2 <=0.25 -0.56840820 0.873007255
+#> 10 F S 18 <=0.5 <=0.25 -0.87382971 1.178428772if(require("dplyr")){# support for groupsexample_isolates%>%
diff --git a/reference/microorganisms.codes.html b/reference/microorganisms.codes.html
index 944c454cc..e71b9798c 100644
--- a/reference/microorganisms.codes.html
+++ b/reference/microorganisms.codes.html
@@ -1,5 +1,5 @@
-Data Set with 5,910 Common Microorganism Codes — microorganisms.codes • AMR (for R)Data Set with 5 910 Common Microorganism Codes — microorganisms.codes • AMR (for R)
@@ -10,7 +10,7 @@
AMR (for R)
- 1.8.2.9103
+ 1.8.2.9111
@@ -42,6 +42,11 @@
Conduct AMR Analysis
+
+
+
+ Generate Antibiogram (Trad./Syndromic/WISCA)
+
@@ -132,7 +137,7 @@
A tibble with 52,141 observations and 22 variables:
mo ID of microorganism as used by this package
+
A tibble with 52 142 observations and 22 variables:
mo ID of microorganism as used by this package
fullname Full name, like "Escherichia coli". For the taxonomic ranks genus, species and subspecies, this is the 'pasted' text of genus, species, and subspecies. For all taxonomic ranks higher than genus, this is the name of the taxon.
status Status of the taxon, either "accepted" or "synonym"
kingdom, phylum, class, order, family, genus, species, subspecies Taxonomic rank of the microorganism
one of the column names of the microorganisms data set: "mo", "fullname", "status", "kingdom", "phylum", "class", "order", "family", "genus", "species", "subspecies", "rank", "ref", "source", "lpsn", "lpsn_parent", "lpsn_renamed_to", "gbif", "gbif_parent", "gbif_renamed_to", "prevalence" or "snomed", or must be "shortname"
+
one of the column names of the microorganisms data set: "mo", "fullname", "status", "kingdom", "phylum", "class", "order", "family", "genus", "species", "subspecies", "rank", "ref", "source", "lpsn", "lpsn_parent", "lpsn_renamed_to", "gbif", "gbif_parent", "gbif_renamed_to", "prevalence" or "snomed"