diff --git a/DESCRIPTION b/DESCRIPTION index 29b9f39c..5bea109a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 1.8.1.9010 -Date: 2022-05-16 +Version: 1.8.1.9011 +Date: 2022-06-03 Title: Antimicrobial Resistance Data Analysis Description: Functions to simplify and standardise antimicrobial resistance (AMR) data analysis and to work with microbial and antimicrobial properties by @@ -90,5 +90,5 @@ BugReports: https://github.com/msberends/AMR/issues License: GPL-2 | file LICENSE Encoding: UTF-8 LazyData: true -RoxygenNote: 7.1.2 +RoxygenNote: 7.2.0 Roxygen: list(markdown = TRUE) diff --git a/NEWS.md b/NEWS.md index d75c7fc2..de19e5f0 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,5 @@ -# `AMR` 1.8.1.9010 -## Last updated: 16 May 2022 +# `AMR` 1.8.1.9011 +## Last updated: 3 June 2022 ### New * EUCAST 2022 and CLSI 2022 guidelines have been added for `as.rsi()`. EUCAST 2022 is now the new default guideline for all MIC and disks diffusion interpretations. @@ -11,7 +11,7 @@ * Small fix for using `ab_from_text()` * Fixes for reading in text files using `set_mo_source()`, which now also allows the source file to contain valid taxonomic names instead of only valid microorganism ID of this package * Using any `random_*()` function (such as `random_mic()`) is now possible by directly calling the package without loading it first: `AMR::random_mic(10)` - +* Changed value in column `prevalence` of the `microorganisms` data set from 3 to 2 for these genera: *Acholeplasma*, *Alistipes*, *Alloprevotella*, *Bergeyella*, *Borrelia*, *Brachyspira*, *Butyricimonas*, *Cetobacterium*, *Chlamydia*, *Chlamydophila*, *Deinococcus*, *Dysgonomonas*, *Elizabethkingia*, *Empedobacter*, *Haloarcula*, *Halobacterium*, *Halococcus*, *Myroides*, *Odoribacter*, *Ornithobacterium*, *Parabacteroides*, *Pedobacter*, *Phocaeicola*, *Porphyromonas*, *Riemerella*, *Sphingobacterium*, *Streptobacillus*, *Tenacibaculum*, *Terrimonas*, *Victivallis*, *Wautersiella*, *Weeksella* # `AMR` 1.8.1 diff --git a/data-raw/AMR_latest.tar.gz b/data-raw/AMR_latest.tar.gz index a8b51104..a85387c6 100644 Binary files a/data-raw/AMR_latest.tar.gz and b/data-raw/AMR_latest.tar.gz differ diff --git a/data-raw/reproduction_of_microorganisms.R b/data-raw/reproduction_of_microorganisms.R index bc571fad..f4b92ac2 100644 --- a/data-raw/reproduction_of_microorganisms.R +++ b/data-raw/reproduction_of_microorganisms.R @@ -168,31 +168,40 @@ rm(ref_taxonomy) rm(data_col.bak) rm(data_dsmz.bak) -mo_found_in_NL <- c("Absidia", "Acremonium", "Actinotignum", "Aedes", "Alternaria", "Anaerosalibacter", "Ancylostoma", - "Angiostrongylus", "Anisakis", "Anopheles", "Apophysomyces", "Arachnia", "Ascaris", "Aspergillus", - "Aureobacterium", "Aureobasidium", "Bacteroides", "Balantidum", "Basidiobolus", "Beauveria", - "Bilophilia", "Blastocystis", "Branhamella", "Brochontrix", "Brugia", "Calymmatobacterium", "Candida", "Capillaria", - "Capnocytophaga", "Catabacter", "Cdc", "Chaetomium", "Chilomastix", "Chryseobacterium", - "Chryseomonas", "Chrysonilia", "Cladophialophora", "Cladosporium", "Clonorchis", "Conidiobolus", - "Contracaecum", "Cordylobia", "Cryptococcus", "Curvularia", "Demodex", "Dermatobia", "Dicrocoelium", - "Dioctophyma", "Diphyllobothrium", "Dipylidium", "Dirofilaria", "Dracunculus", "Echinococcus", - "Echinostoma", "Elisabethkingia", "Enterobius", "Enteromonas", "Euascomycetes", "Exophiala", - "Exserohilum", "Fasciola", "Fasciolopsis", "Flavobacterium", "Fonsecaea", "Fusarium", "Fusobacterium", - "Giardia", "Gnathostoma", "Hendersonula", "Heterophyes", "Hymenolepis", "Hypomyces", - "Hysterothylacium", "Kloeckera", "Koserella", "Larva", "Lecythophora", "Leishmania", "Lelliottia", - "Leptomyxida", "Leptosphaeria", "Leptotrichia", "Loa", "Lucilia", "Lumbricus", "Malassezia", - "Malbranchea", "Mansonella", "Mesocestoides", "Metagonimus", "Metarrhizium", "Molonomonas", - "Mortierella", "Mucor", "Multiceps", "Mycocentrospora", "Mycoplasma", "Nanophetus", "Nattrassia", - "Necator", "Nectria", "Novospingobium", "Ochroconis", "Oesophagostomum", "Oidiodendron", "Onchocerca", - "Opisthorchis", "Opistorchis", "Paragonimus", "Paramyxovirus", "Pediculus", "Phlebotomus", - "Phocanema", "Phoma", "Phthirus", "Piedraia", "Pithomyces", "Pityrosporum", "Prevotella", +mo_found_in_NL <- c("Absidia", "Acholeplasma", "Acremonium", "Actinotignum", "Aedes", "Alistipes", + "Alloprevotella", "Alternaria", "Anaerosalibacter", "Ancylostoma", "Angiostrongylus", + "Anisakis", "Anopheles", "Apophysomyces", "Arachnia", "Ascaris", "Aspergillus", + "Aureobacterium", "Aureobasidium", "Bacteroides", "Balantidum", "Basidiobolus", + "Beauveria", "Bergeyella", "Bilophilia", "Blastocystis", "Borrelia", "Brachyspira", + "Branhamella", "Brochontrix", "Brugia", "Butyricimonas", "Calymmatobacterium", + "Candida", "Capillaria", "Capnocytophaga", "Catabacter", "Cdc", "Cetobacterium", + "Chaetomium", "Chilomastix", "Chlamydia", "Chlamydophila", "Chryseobacterium", + "Chryseomonas", "Chrysonilia", "Cladophialophora", "Cladosporium", "Clonorchis", + "Conidiobolus", "Contracaecum", "Cordylobia", "Cryptococcus", "Curvularia", "Deinococcus", + "Demodex", "Dermatobia", "Dicrocoelium", "Dioctophyma", "Diphyllobothrium", "Dipylidium", + "Dirofilaria", "Dracunculus", "Dysgonomonas", "Echinococcus", "Echinostoma", + "Elisabethkingia", "Elizabethkingia", "Empedobacter", "Enterobius", "Enteromonas", + "Euascomycetes", "Exophiala", "Exserohilum", "Fasciola", "Fasciolopsis", "Flavobacterium", + "Fonsecaea", "Fusarium", "Fusobacterium", "Giardia", "Gnathostoma", "Haloarcula", + "Halobacterium", "Halococcus", "Hendersonula", "Heterophyes", "Hymenolepis", "Hypomyces", + "Hysterothylacium", "Kloeckera", "Koserella", "Larva", "Lecythophora", "Leishmania", + "Lelliottia", "Leptomyxida", "Leptosphaeria", "Leptotrichia", "Loa", "Lucilia", "Lumbricus", + "Malassezia", "Malbranchea", "Mansonella", "Mesocestoides", "Metagonimus", "Metarrhizium", + "Molonomonas", "Mortierella", "Mucor", "Multiceps", "Mycocentrospora", "Mycoplasma", + "Myroides", "Nanophetus", "Nattrassia", "Necator", "Nectria", "Novospingobium", "Ochroconis", + "Odoribacter", "Oesophagostomum", "Oidiodendron", "Onchocerca", "Opisthorchis", + "Opistorchis", "Ornithobacterium", "Parabacteroides", "Paragonimus", "Paramyxovirus", + "Pediculus", "Pedobacter", "Phlebotomus", "Phocaeicola", "Phocanema", "Phoma", + "Phthirus", "Piedraia", "Pithomyces", "Pityrosporum", "Porphyromonas", "Prevotella", "Pseudallescheria", "Pseudoterranova", "Pulex", "Retortamonas", "Rhizomucor", "Rhizopus", - "Rhodotorula", "Salinococcus", "Sanguibacteroides", "Sarcophagidae", "Sarcoptes", "Schistosoma", - "Scolecobasidium", "Scopulariopsis", "Scytalidium", "Spirometra", "Sporobolomyces", "Stachybotrys", - "Stenotrophomononas", "Stomatococcus", "Strongyloides", "Syncephalastraceae", "Syngamus", "Taenia", - "Ternidens", "Torulopsis", "Toxocara", "Toxoplasma", "Treponema", "Trichinella", "Trichobilharzia", "Trichoderma", - "Trichomonas", "Trichophyton", "Trichosporon", "Trichostrongylus", "Trichuris", "Tritirachium", - "Trombicula", "Trypanosoma", "Tunga", "Ureaplasma", "Wuchereria") + "Rhodotorula", "Riemerella", "Salinococcus", "Sanguibacteroides", "Sarcophagidae", "Sarcoptes", + "Schistosoma", "Scolecobasidium", "Scopulariopsis", "Scytalidium", "Sphingobacterium", + "Spirometra", "Sporobolomyces", "Stachybotrys", "Stenotrophomononas", "Stomatococcus", + "Streptobacillus", "Strongyloides", "Syncephalastraceae", "Syngamus", "Taenia", + "Tenacibaculum", "Ternidens", "Terrimonas", "Torulopsis", "Toxocara", "Toxoplasma", + "Treponema", "Trichinella", "Trichobilharzia", "Trichoderma", "Trichomonas", "Trichophyton", + "Trichosporon", "Trichostrongylus", "Trichuris", "Tritirachium", "Trombicula", "Trypanosoma", + "Tunga", "Ureaplasma", "Victivallis", "Wautersiella", "Weeksella", "Wuchereria") MOs <- data_total %>% filter( diff --git a/docs/404.html b/docs/404.html index f77db2be..9d39967a 100644 --- a/docs/404.html +++ b/docs/404.html @@ -43,7 +43,7 @@ AMR (for R) - 1.8.1.9010 + 1.8.1.9011 diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index ea004b66..109a6e41 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -17,7 +17,7 @@ AMR (for R) - 1.8.1.9010 + 1.8.1.9011 diff --git a/docs/articles/datasets.html b/docs/articles/datasets.html index c9b84f76..fe8236ad 100644 --- a/docs/articles/datasets.html +++ b/docs/articles/datasets.html @@ -44,7 +44,7 @@ AMR (for R) - 1.8.1.9010 + 1.8.1.9011 @@ -190,7 +190,7 @@ diff --git a/docs/news/index.html b/docs/news/index.html index 2e3d1591..bc85ff1b 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -17,7 +17,7 @@ AMR (for R) - 1.8.1.9010 + 1.8.1.9011 @@ -157,16 +157,16 @@
- +
-

Last updated: 16 May 2022

+

Last updated: 3 June 2022

-

New

+

New

  • EUCAST 2022 and CLSI 2022 guidelines have been added for as.rsi(). EUCAST 2022 is now the new default guideline for all MIC and disks diffusion interpretations.
-

Changed

+

Changed

  • Fix for as.rsi() on certain EUCAST breakpoints for MIC values
  • Removed as.integer() for MIC values, since MIC are not integer values and running table() on MIC values consequently failed for not being able to retrieve the level position (as that’s how normally as.integer() on factors work)
  • @@ -176,6 +176,8 @@
  • Fixes for reading in text files using set_mo_source(), which now also allows the source file to contain valid taxonomic names instead of only valid microorganism ID of this package
  • Using any random_*() function (such as random_mic()) is now possible by directly calling the package without loading it first: AMR::random_mic(10)
  • +
  • Changed value in column prevalence of the microorganisms data set from 3 to 2 for these genera: Acholeplasma, Alistipes, Alloprevotella, Bergeyella, Borrelia, Brachyspira, Butyricimonas, Cetobacterium, Chlamydia, Chlamydophila, Deinococcus, Dysgonomonas, Elizabethkingia, Empedobacter, Haloarcula, Halobacterium, Halococcus, Myroides, Odoribacter, Ornithobacterium, Parabacteroides, Pedobacter, Phocaeicola, Porphyromonas, Riemerella, Sphingobacterium, Streptobacillus, Tenacibaculum, Terrimonas, Victivallis, Wautersiella, Weeksella +
diff --git a/docs/reference/as.mic.html b/docs/reference/as.mic.html index 43aa4cf4..e0005066 100644 --- a/docs/reference/as.mic.html +++ b/docs/reference/as.mic.html @@ -17,7 +17,7 @@ AMR (for R) - 1.8.1.9010 + 1.8.1.9011 @@ -190,34 +190,10 @@

Details

To interpret MIC values as RSI values, use as.rsi() on MIC values. It supports guidelines from EUCAST (2011-2022) and CLSI (2011-2022).

-

This class for MIC values is a quite a special data type: formally it is an ordered factor with valid MIC values as factor levels (to make sure only valid MIC values are retained), but for any mathematical operation it acts as decimal numbers:

x <- random_mic(10)
-x
-#> Class <mic>
-#>  [1] 16     1      8      8      64     >=128  0.0625 32     32     16
-
-is.factor(x)
-#> [1] TRUE
-
-x[1] * 2
-#> [1] 32
-
-median(x)
-#> [1] 26
- -

This makes it possible to maintain operators that often come with MIC values, such ">=" and "<=", even when filtering using numeric values in data analysis, e.g.:

x[x > 4]
-#> Class <mic>
-#> [1] 16    8     8     64    >=128 32    32    16
-
-df <- data.frame(x, hospital = "A")
-subset(df, x > 4) # or with dplyr: df %>% filter(x > 4)
-#>        x hospital
-#> 1     16        A
-#> 5     64        A
-#> 6  >=128        A
-#> 8     32        A
-#> 9     32        A
-#> 10    16        A
- +

This class for MIC values is a quite a special data type: formally it is an ordered factor with valid MIC values as factor levels (to make sure only valid MIC values are retained), but for any mathematical operation it acts as decimal numbers:

+

+

This makes it possible to maintain operators that often come with MIC values, such ">=" and "<=", even when filtering using numeric values in data analysis, e.g.:

+

The following generic functions are implemented for the MIC class: !, !=, %%, %/%, &, *, +, -, /, <, <=, ==, >, >=, ^, |, abs(), acos(), acosh(), all(), any(), asin(), asinh(), atan(), atanh(), ceiling(), cos(), cosh(), cospi(), cummax(), cummin(), cumprod(), cumsum(), digamma(), exp(), expm1(), floor(), gamma(), lgamma(), log(), log1p(), log2(), log10(), max(), mean(), min(), prod(), range(), round(), sign(), signif(), sin(), sinh(), sinpi(), sqrt(), sum(), tan(), tanh(), tanpi(), trigamma() and trunc(). Some functions of the stats package are also implemented: median(), quantile(), mad(), IQR(), fivenum(). Also, boxplot.stats() is supported. Since sd() and var() are non-generic functions, these could not be extended. Use mad() as an alternative, or use e.g. sd(as.numeric(x)) where x is your vector of MIC values.

Using as.double() or as.numeric() on MIC values will remove the operators and return a numeric vector. Do not use as.integer() on MIC values as by the R convention on factors, it will return the index of the factor levels (which is often useless for regular users).

Use droplevels() to drop unused levels. At default, it will return a plain factor. Use droplevels(..., as.mic = TRUE) to maintain the <mic> class.

diff --git a/docs/reference/as.mo.html b/docs/reference/as.mo.html index 3a2f9ef5..812dc72e 100644 --- a/docs/reference/as.mo.html +++ b/docs/reference/as.mo.html @@ -17,7 +17,7 @@ AMR (for R) - 1.8.1.9007 + 1.8.1.9011
@@ -217,20 +217,8 @@

General Info

-

A microorganism (MO) code from this package (class: mo) is human readable and typically looks like these examples:

  Code               Full name
-  ---------------    --------------------------------------
-  B_KLBSL            Klebsiella
-  B_KLBSL_PNMN       Klebsiella pneumoniae
-  B_KLBSL_PNMN_RHNS  Klebsiella pneumoniae rhinoscleromatis
-  |   |    |    |
-  |   |    |    |
-  |   |    |    \---> subspecies, a 4-5 letter acronym
-  |   |    \----> species, a 4-5 letter acronym
-  |   \----> genus, a 5-7 letter acronym
-  \----> taxonomic kingdom: A (Archaea), AN (Animalia), B (Bacteria),
-                            C (Chromista), F (Fungi), P (Protozoa)
-
- +

A microorganism (MO) code from this package (class: mo) is human readable and typically looks like these examples:

+

Values that cannot be coerced will be considered 'unknown' and will get the MO code UNKNOWN.

Use the mo_* functions to get properties based on the returned code, see Examples.

The algorithm uses data from the Catalogue of Life (see below) and from one other source (see microorganisms).

@@ -269,12 +257,12 @@

Source

-
  1. Becker K et al. Coagulase-Negative Staphylococci. 2014. Clin Microbiol Rev. 27(4): 870-926; doi: 10.1128/CMR.00109-13

  2. -
  3. Becker K et al. Implications of identifying the recently defined members of the S. aureus complex, S. argenteus and S. schweitzeri: A position paper of members of the ESCMID Study Group for staphylococci and Staphylococcal Diseases (ESGS). 2019. Clin Microbiol Infect; doi: 10.1016/j.cmi.2019.02.028

  4. -
  5. Becker K et al. Emergence of coagulase-negative staphylococci 2020. Expert Rev Anti Infect Ther. 18(4):349-366; doi: 10.1080/14787210.2020.1730813

  6. -
  7. Lancefield RC A serological differentiation of human and other groups of hemolytic streptococci. 1933. J Exp Med. 57(4): 571-95; doi: 10.1084/jem.57.4.571

  8. +
    1. Becker K et al. Coagulase-Negative Staphylococci. 2014. Clin Microbiol Rev. 27(4): 870-926; doi:10.1128/CMR.00109-13

    2. +
    3. Becker K et al. Implications of identifying the recently defined members of the S. aureus complex, S. argenteus and S. schweitzeri: A position paper of members of the ESCMID Study Group for staphylococci and Staphylococcal Diseases (ESGS). 2019. Clin Microbiol Infect; doi:10.1016/j.cmi.2019.02.028

    4. +
    5. Becker K et al. Emergence of coagulase-negative staphylococci 2020. Expert Rev Anti Infect Ther. 18(4):349-366; doi:10.1080/14787210.2020.1730813

    6. +
    7. Lancefield RC A serological differentiation of human and other groups of hemolytic streptococci. 1933. J Exp Med. 57(4): 571-95; doi:10.1084/jem.57.4.571

    8. Catalogue of Life: 2019 Annual Checklist, http://www.catalogueoflife.org

    9. -
    10. List of Prokaryotic names with Standing in Nomenclature (5 October 2021), doi: 10.1099/ijsem.0.004332

    11. +
    12. List of Prokaryotic names with Standing in Nomenclature (5 October 2021), doi:10.1099/ijsem.0.004332

    13. US Edition of SNOMED CT from 1 September 2020, retrieved from the Public Health Information Network Vocabulary Access and Distribution System (PHIN VADS), OID 2.16.840.1.114222.4.11.1009, version 12; url: https://phinvads.cdc.gov/vads/ViewValueSet.action?oid=2.16.840.1.114222.4.11.1009

    diff --git a/docs/reference/as.rsi.html b/docs/reference/as.rsi.html index 288f1f68..07adf13c 100644 --- a/docs/reference/as.rsi.html +++ b/docs/reference/as.rsi.html @@ -17,7 +17,7 @@ AMR (for R) - 1.8.1.9009 + 1.8.1.9011
    @@ -249,12 +249,12 @@

    The as.rsi() function works in four ways:

    1. For cleaning raw / untransformed data. The data will be cleaned to only contain values S, I and R and will try its best to determine this with some intelligence. For example, mixed values with R/SI interpretations and MIC values such as "<0.25; S" will be coerced to "S". Combined interpretations for multiple test methods (as seen in laboratory records) such as "S; S" will be coerced to "S", but a value like "S; I" will return NA with a warning that the input is unclear.

    2. -
    3. For interpreting minimum inhibitory concentration (MIC) values according to EUCAST or CLSI. You must clean your MIC values first using as.mic(), that also gives your columns the new data class mic. Also, be sure to have a column with microorganism names or codes. It will be found automatically, but can be set manually using the mo argument.

      • Using dplyr, R/SI interpretation can be done very easily with either:

        your_data %>% mutate_if(is.mic, as.rsi)             # until dplyr 1.0.0
        -your_data %>% mutate(across(where(is.mic), as.rsi)) # since dplyr 1.0.0
      • +
      • For interpreting minimum inhibitory concentration (MIC) values according to EUCAST or CLSI. You must clean your MIC values first using as.mic(), that also gives your columns the new data class mic. Also, be sure to have a column with microorganism names or codes. It will be found automatically, but can be set manually using the mo argument.

        • Using dplyr, R/SI interpretation can be done very easily with either:

          +

        • Operators like "<=" will be stripped before interpretation. When using conserve_capped_values = TRUE, an MIC value of e.g. ">2" will always return "R", even if the breakpoint according to the chosen guideline is ">=4". This is to prevent that capped values from raw laboratory data would not be treated conservatively. The default behaviour (conserve_capped_values = FALSE) considers ">2" to be lower than ">=4" and might in this case return "S" or "I".

      • -
      • For interpreting disk diffusion diameters according to EUCAST or CLSI. You must clean your disk zones first using as.disk(), that also gives your columns the new data class disk. Also, be sure to have a column with microorganism names or codes. It will be found automatically, but can be set manually using the mo argument.

        • Using dplyr, R/SI interpretation can be done very easily with either:

          your_data %>% mutate_if(is.disk, as.rsi)             # until dplyr 1.0.0
          -your_data %>% mutate(across(where(is.disk), as.rsi)) # since dplyr 1.0.0
        • +
        • For interpreting disk diffusion diameters according to EUCAST or CLSI. You must clean your disk zones first using as.disk(), that also gives your columns the new data class disk. Also, be sure to have a column with microorganism names or codes. It will be found automatically, but can be set manually using the mo argument.

          • Using dplyr, R/SI interpretation can be done very easily with either:

            +

        • For interpreting a complete data set, with automatic determination of MIC values, disk diffusion diameters, microorganism names or codes, and antimicrobial test results. This is done very simply by running as.rsi(your_data).

    diff --git a/docs/reference/count.html b/docs/reference/count.html index b7d2a2f3..27626646 100644 --- a/docs/reference/count.html +++ b/docs/reference/count.html @@ -18,7 +18,7 @@ count_resistant() should be used to count resistant isolates, count_susceptible( AMR (for R) - 1.8.1.9007 + 1.8.1.9011 @@ -243,30 +243,12 @@ A microorganism is categorised as Susceptible, Increased exposure when

    Combination Therapy

    -

    When using more than one variable for ... (= combination therapy), use only_all_tested to only count isolates that are tested for all antibiotics/variables that you test them for. See this example for two antibiotics, Drug A and Drug B, about how susceptibility() 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>        -            -            -            -
    ---------------------------------------------------------------------
    -
    - -

    Please note that, in combination therapies, for only_all_tested = TRUE applies that:

    count_S()    +   count_I()    +   count_R()    = count_all()
    -  proportion_S() + proportion_I() + proportion_R() = 1
    - -

    and that, in combination therapies, for only_all_tested = FALSE applies that:

    count_S()    +   count_I()    +   count_R()    >= count_all()
    -  proportion_S() + proportion_I() + proportion_R() >= 1
    - +

    When using more than one variable for ... (= combination therapy), use only_all_tested to only count isolates that are tested for all antibiotics/variables that you test them for. See this example for two antibiotics, Drug A and Drug B, about how susceptibility() works to calculate the %SI:

    +

    +

    Please note that, in combination therapies, for only_all_tested = TRUE applies that:

    +

    +

    and that, in combination therapies, for only_all_tested = FALSE applies that:

    +

    Using only_all_tested has no impact when only using one antibiotic as input.

    diff --git a/docs/reference/custom_eucast_rules.html b/docs/reference/custom_eucast_rules.html index 70afcc50..94af62b2 100644 --- a/docs/reference/custom_eucast_rules.html +++ b/docs/reference/custom_eucast_rules.html @@ -17,7 +17,7 @@ AMR (for R) - 1.8.1.9007 + 1.8.1.9011
    @@ -186,81 +186,29 @@

    Basics

    -

    If you are familiar with the case_when() function of the dplyr package, you will recognise the input method to set your own rules. Rules must be set using what R considers to be the 'formula notation'. The rule itself is written before the tilde (~) and the consequence of the rule is written after the tilde:

    x <- custom_eucast_rules(TZP == "S" ~ aminopenicillins == "S",
    -                         TZP == "R" ~ aminopenicillins == "R")
    - -

    These are two custom EUCAST rules: if TZP (piperacillin/tazobactam) is "S", all aminopenicillins (ampicillin and amoxicillin) must be made "S", and if TZP is "R", aminopenicillins must be made "R". These rules can also be printed to the console, so it is immediately clear how they work:

    x
    -#> A set of custom EUCAST rules:
    -#> 
    -#>   1. If TZP is S then set to S:
    -#>      amoxicillin (AMX), ampicillin (AMP)
    -#> 
    -#>   2. If TZP is R then set to R:
    -#>      amoxicillin (AMX), ampicillin (AMP)
    - -

    The rules (the part before the tilde, in above example TZP == "S" and TZP == "R") must be evaluable in your data set: it should be able to run as a filter in your data set without errors. This means for the above example that the column TZP must exist. We will create a sample data set and test the rules set:

    df <- data.frame(mo = c("E. coli", "K. pneumoniae"),
    -                 TZP = "R",
    -                 amox = "",
    -                 AMP = "")
    -df
    -#>              mo TZP amox AMP
    -#> 1       E. coli   R         
    -#> 2 K. pneumoniae   R         
    -                 
    -eucast_rules(df, rules = "custom", custom_rules = x)
    -#>              mo TZP amox AMP
    -#> 1       E. coli   R    R   R     
    -#> 2 K. pneumoniae   R    R   R  
    - +

    If you are familiar with the case_when() function of the dplyr package, you will recognise the input method to set your own rules. Rules must be set using what R considers to be the 'formula notation'. The rule itself is written before the tilde (~) and the consequence of the rule is written after the tilde:

    +

    +

    These are two custom EUCAST rules: if TZP (piperacillin/tazobactam) is "S", all aminopenicillins (ampicillin and amoxicillin) must be made "S", and if TZP is "R", aminopenicillins must be made "R". These rules can also be printed to the console, so it is immediately clear how they work:

    +

    +

    The rules (the part before the tilde, in above example TZP == "S" and TZP == "R") must be evaluable in your data set: it should be able to run as a filter in your data set without errors. This means for the above example that the column TZP must exist. We will create a sample data set and test the rules set:

    +

    Using taxonomic properties in rules

    -

    There is one exception in variables used for the rules: all column names of the microorganisms data set can also be used, but do not have to exist in the data set. These column names are: mo, fullname, kingdom, phylum, class, order, family, genus, species, subspecies, rank, ref, species_id, source, prevalence and snomed. Thus, this next example will work as well, despite the fact that the df data set does not contain a column genus:

    y <- custom_eucast_rules(TZP == "S" & genus == "Klebsiella" ~ aminopenicillins == "S",
    -                         TZP == "R" & genus == "Klebsiella" ~ aminopenicillins == "R")
    -
    -eucast_rules(df, rules = "custom", custom_rules = y)
    -#>              mo TZP amox AMP
    -#> 1       E. coli   R         
    -#> 2 K. pneumoniae   R    R   R
    - +

    There is one exception in variables used for the rules: all column names of the microorganisms data set can also be used, but do not have to exist in the data set. These column names are: r vector_and(colnames(microorganisms), quote = "``", sort = FALSE). Thus, this next example will work as well, despite the fact that the df data set does not contain a column genus:

    +

    Usage of antibiotic group names

    -

    It is possible to define antibiotic groups instead of single antibiotics for the rule consequence, the part after the tilde. In above examples, the antibiotic group aminopenicillins is used to include ampicillin and amoxicillin. The following groups are allowed (case-insensitive). Within parentheses are the agents that will be matched when running the rule.

    +

    It is possible to define antibiotic groups instead of single antibiotics for the rule consequence, the part after the tilde. In above examples, the antibiotic group aminopenicillins is used to include ampicillin and amoxicillin. The following groups are allowed (case-insensitive). Within parentheses are the agents that will be matched when running the rule.

    +

    r paste0(" * ", sapply(DEFINED_AB_GROUPS, function(x) paste0("``", tolower(gsub("^AB_", "", x)), "``\\cr(", vector_and(ab_name(eval(parse(text = x), envir = asNamespace("AMR")), language = NULL, tolower = TRUE), quotes = FALSE), ")"), USE.NAMES = FALSE), "\n", collapse = "")

    +
    diff --git a/docs/reference/eucast_rules.html b/docs/reference/eucast_rules.html index 26ba1ef8..f018105f 100644 --- a/docs/reference/eucast_rules.html +++ b/docs/reference/eucast_rules.html @@ -18,7 +18,7 @@ To improve the interpretation of the antibiogram before EUCAST rules are applied AMR (for R) - 1.8.1.9007 + 1.8.1.9011
    @@ -185,7 +185,7 @@ To improve the interpretation of the antibiogram before EUCAST rules are applied

    Source

    Details

    -

    Overview of the data set:

    head(rsi_translation)

    ##     guideline method site           mo rank_index  ab     ref_tbl disk_dose
    -## 1 EUCAST 2022    MIC <NA> F_ASPRG_MGTS          2 AMB Aspergillus      <NA>
    -## 2 EUCAST 2022    MIC <NA> F_ASPRG_NIGR          2 AMB Aspergillus      <NA>
    -## 3 EUCAST 2022    MIC <NA>      F_CANDD          3 AMB     Candida      <NA>
    -## 4 EUCAST 2022    MIC <NA> F_CANDD_ALBC          2 AMB     Candida      <NA>
    -## 5 EUCAST 2022    MIC <NA> F_CANDD_DBLN          2 AMB     Candida      <NA>
    -## 6 EUCAST 2022    MIC <NA> F_CANDD_KRUS          2 AMB     Candida      <NA>
    -##   breakpoint_S breakpoint_R   uti
    -## 1            1            1 FALSE
    -## 2            1            1 FALSE
    -## 3            1            1 FALSE
    -## 4            1            1 FALSE
    -## 5            1            1 FALSE
    -## 6            1            1 FALSE
    - +

    Overview of the data set:

    +

    head(rsi_translation)

    +

    The repository of this AMR package contains a file comprising this exact data set: https://github.com/msberends/AMR/blob/main/data-raw/rsi_translation.txt. This file allows for machine reading EUCAST and CLSI guidelines, which is almost impossible with the Excel and PDF files distributed by EUCAST and CLSI. The file is updated automatically and the mo and ab columns have been transformed to contain the full official names instead of codes.

    diff --git a/docs/survey.html b/docs/survey.html index 2732c78b..8375c389 100644 --- a/docs/survey.html +++ b/docs/survey.html @@ -17,7 +17,7 @@ AMR (for R) - 1.8.1.9010 + 1.8.1.9011
    diff --git a/man/as.mic.Rd b/man/as.mic.Rd index bce228bd..8d8f3b68 100755 --- a/man/as.mic.Rd +++ b/man/as.mic.Rd @@ -35,7 +35,9 @@ This transforms vectors to a new class \code{\link{mic}}, which treats the input \details{ To interpret MIC values as RSI values, use \code{\link[=as.rsi]{as.rsi()}} on MIC values. It supports guidelines from EUCAST (2011-2022) and CLSI (2011-2022). -This class for MIC values is a quite a special data type: formally it is an ordered \link{factor} with valid MIC values as \link{factor} levels (to make sure only valid MIC values are retained), but for any mathematical operation it acts as decimal numbers:\preformatted{x <- random_mic(10) +This class for MIC values is a quite a special data type: formally it is an ordered \link{factor} with valid MIC values as \link{factor} levels (to make sure only valid MIC values are retained), but for any mathematical operation it acts as decimal numbers: + +\if{html}{\out{
    }}\preformatted{x <- random_mic(10) x #> Class #> [1] 16 1 8 8 64 >=128 0.0625 32 32 16 @@ -48,9 +50,11 @@ x[1] * 2 median(x) #> [1] 26 -} +}\if{html}{\out{
    }} -This makes it possible to maintain operators that often come with MIC values, such ">=" and "<=", even when filtering using \link{numeric} values in data analysis, e.g.:\preformatted{x[x > 4] +This makes it possible to maintain operators that often come with MIC values, such ">=" and "<=", even when filtering using \link{numeric} values in data analysis, e.g.: + +\if{html}{\out{
    }}\preformatted{x[x > 4] #> Class #> [1] 16 8 8 64 >=128 32 32 16 @@ -63,7 +67,7 @@ subset(df, x > 4) # or with dplyr: df \%>\% filter(x > 4) #> 8 32 A #> 9 32 A #> 10 16 A -} +}\if{html}{\out{
    }} The following \link[=groupGeneric]{generic functions} are implemented for the MIC class: \code{!}, \code{!=}, \code{\%\%}, \code{\%/\%}, \code{&}, \code{*}, \code{+}, \code{-}, \code{/}, \code{<}, \code{<=}, \code{==}, \code{>}, \code{>=}, \code{^}, \code{|}, \code{\link[=abs]{abs()}}, \code{\link[=acos]{acos()}}, \code{\link[=acosh]{acosh()}}, \code{\link[=all]{all()}}, \code{\link[=any]{any()}}, \code{\link[=asin]{asin()}}, \code{\link[=asinh]{asinh()}}, \code{\link[=atan]{atan()}}, \code{\link[=atanh]{atanh()}}, \code{\link[=ceiling]{ceiling()}}, \code{\link[=cos]{cos()}}, \code{\link[=cosh]{cosh()}}, \code{\link[=cospi]{cospi()}}, \code{\link[=cummax]{cummax()}}, \code{\link[=cummin]{cummin()}}, \code{\link[=cumprod]{cumprod()}}, \code{\link[=cumsum]{cumsum()}}, \code{\link[=digamma]{digamma()}}, \code{\link[=exp]{exp()}}, \code{\link[=expm1]{expm1()}}, \code{\link[=floor]{floor()}}, \code{\link[=gamma]{gamma()}}, \code{\link[=lgamma]{lgamma()}}, \code{\link[=log]{log()}}, \code{\link[=log1p]{log1p()}}, \code{\link[=log2]{log2()}}, \code{\link[=log10]{log10()}}, \code{\link[=max]{max()}}, \code{\link[=mean]{mean()}}, \code{\link[=min]{min()}}, \code{\link[=prod]{prod()}}, \code{\link[=range]{range()}}, \code{\link[=round]{round()}}, \code{\link[=sign]{sign()}}, \code{\link[=signif]{signif()}}, \code{\link[=sin]{sin()}}, \code{\link[=sinh]{sinh()}}, \code{\link[=sinpi]{sinpi()}}, \code{\link[=sqrt]{sqrt()}}, \code{\link[=sum]{sum()}}, \code{\link[=tan]{tan()}}, \code{\link[=tanh]{tanh()}}, \code{\link[=tanpi]{tanpi()}}, \code{\link[=trigamma]{trigamma()}} and \code{\link[=trunc]{trunc()}}. Some functions of the \code{stats} package are also implemented: \code{\link[=median]{median()}}, \code{\link[=quantile]{quantile()}}, \code{\link[=mad]{mad()}}, \code{\link[=IQR]{IQR()}}, \code{\link[=fivenum]{fivenum()}}. Also, \code{\link[=boxplot.stats]{boxplot.stats()}} is supported. Since \code{\link[=sd]{sd()}} and \code{\link[=var]{var()}} are non-generic functions, these could not be extended. Use \code{\link[=mad]{mad()}} as an alternative, or use e.g. \code{sd(as.numeric(x))} where \code{x} is your vector of MIC values. diff --git a/man/as.mo.Rd b/man/as.mo.Rd index 945ea50e..ad582ce8 100644 --- a/man/as.mo.Rd +++ b/man/as.mo.Rd @@ -61,7 +61,9 @@ Use this function to determine a valid microorganism code (\code{\link{mo}}). De \details{ \subsection{General Info}{ -A microorganism (MO) code from this package (class: \code{\link{mo}}) is human readable and typically looks like these examples:\preformatted{ Code Full name +A microorganism (MO) code from this package (class: \code{\link{mo}}) is human readable and typically looks like these examples: + +\if{html}{\out{
    }}\preformatted{ Code Full name --------------- -------------------------------------- B_KLBSL Klebsiella B_KLBSL_PNMN Klebsiella pneumoniae @@ -73,7 +75,7 @@ A microorganism (MO) code from this package (class: \code{\link{mo}}) is human r | \\----> genus, a 5-7 letter acronym \\----> taxonomic kingdom: A (Archaea), AN (Animalia), B (Bacteria), C (Chromista), F (Fungi), P (Protozoa) -} +}\if{html}{\out{
    }} Values that cannot be coerced will be considered 'unknown' and will get the MO code \code{UNKNOWN}. diff --git a/man/as.rsi.Rd b/man/as.rsi.Rd index e72e7fee..faf6ccb0 100755 --- a/man/as.rsi.Rd +++ b/man/as.rsi.Rd @@ -94,16 +94,20 @@ The \code{\link[=as.rsi]{as.rsi()}} function works in four ways: \item For \strong{cleaning raw / untransformed data}. The data will be cleaned to only contain values S, I and R and will try its best to determine this with some intelligence. For example, mixed values with R/SI interpretations and MIC values such as \code{"<0.25; S"} will be coerced to \code{"S"}. Combined interpretations for multiple test methods (as seen in laboratory records) such as \code{"S; S"} will be coerced to \code{"S"}, but a value like \code{"S; I"} will return \code{NA} with a warning that the input is unclear. \item For \strong{interpreting minimum inhibitory concentration (MIC) values} according to EUCAST or CLSI. You must clean your MIC values first using \code{\link[=as.mic]{as.mic()}}, that also gives your columns the new data class \code{\link{mic}}. Also, be sure to have a column with microorganism names or codes. It will be found automatically, but can be set manually using the \code{mo} argument. \itemize{ -\item Using \code{dplyr}, R/SI interpretation can be done very easily with either:\preformatted{your_data \%>\% mutate_if(is.mic, as.rsi) # until dplyr 1.0.0 +\item Using \code{dplyr}, R/SI interpretation can be done very easily with either: + +\if{html}{\out{
    }}\preformatted{your_data \%>\% mutate_if(is.mic, as.rsi) # until dplyr 1.0.0 your_data \%>\% mutate(across(where(is.mic), as.rsi)) # since dplyr 1.0.0 -} +}\if{html}{\out{
    }} \item Operators like "<=" will be stripped before interpretation. When using \code{conserve_capped_values = TRUE}, an MIC value of e.g. ">2" will always return "R", even if the breakpoint according to the chosen guideline is ">=4". This is to prevent that capped values from raw laboratory data would not be treated conservatively. The default behaviour (\code{conserve_capped_values = FALSE}) considers ">2" to be lower than ">=4" and might in this case return "S" or "I". } \item For \strong{interpreting disk diffusion diameters} according to EUCAST or CLSI. You must clean your disk zones first using \code{\link[=as.disk]{as.disk()}}, that also gives your columns the new data class \code{\link{disk}}. Also, be sure to have a column with microorganism names or codes. It will be found automatically, but can be set manually using the \code{mo} argument. \itemize{ -\item Using \code{dplyr}, R/SI interpretation can be done very easily with either:\preformatted{your_data \%>\% mutate_if(is.disk, as.rsi) # until dplyr 1.0.0 +\item Using \code{dplyr}, R/SI interpretation can be done very easily with either: + +\if{html}{\out{
    }}\preformatted{your_data \%>\% mutate_if(is.disk, as.rsi) # until dplyr 1.0.0 your_data \%>\% mutate(across(where(is.disk), as.rsi)) # since dplyr 1.0.0 -} +}\if{html}{\out{
    }} } \item For \strong{interpreting a complete data set}, with automatic determination of MIC values, disk diffusion diameters, microorganism names or codes, and antimicrobial test results. This is done very simply by running \code{as.rsi(your_data)}. } diff --git a/man/count.Rd b/man/count.Rd index 4da9cb7f..1a06e682 100644 --- a/man/count.Rd +++ b/man/count.Rd @@ -97,7 +97,9 @@ This AMR package honours this (new) insight. Use \code{\link[=susceptibility]{su \section{Combination Therapy}{ -When using more than one variable for \code{...} (= combination therapy), use \code{only_all_tested} to only count isolates that are tested for all antibiotics/variables that you test them for. See this example for two antibiotics, Drug A and Drug B, about how \code{\link[=susceptibility]{susceptibility()}} works to calculate the \%SI:\preformatted{-------------------------------------------------------------------- +When using more than one variable for \code{...} (= combination therapy), use \code{only_all_tested} to only count isolates that are tested for all antibiotics/variables that you test them for. See this example for two antibiotics, Drug A and Drug B, about how \code{\link[=susceptibility]{susceptibility()}} works to calculate the \%SI: + +\if{html}{\out{
    }}\preformatted{-------------------------------------------------------------------- only_all_tested = FALSE only_all_tested = TRUE ----------------------- ----------------------- Drug A Drug B include as include as include as include as @@ -113,15 +115,19 @@ When using more than one variable for \code{...} (= combination therapy), use \c R - - - - - - - - -------------------------------------------------------------------- -} +}\if{html}{\out{
    }} -Please note that, in combination therapies, for \code{only_all_tested = TRUE} applies that:\preformatted{ count_S() + count_I() + count_R() = count_all() +Please note that, in combination therapies, for \code{only_all_tested = TRUE} applies that: + +\if{html}{\out{
    }}\preformatted{ count_S() + count_I() + count_R() = count_all() proportion_S() + proportion_I() + proportion_R() = 1 -} +}\if{html}{\out{
    }} -and that, in combination therapies, for \code{only_all_tested = FALSE} applies that:\preformatted{ count_S() + count_I() + count_R() >= count_all() +and that, in combination therapies, for \code{only_all_tested = FALSE} applies that: + +\if{html}{\out{
    }}\preformatted{ count_S() + count_I() + count_R() >= count_all() proportion_S() + proportion_I() + proportion_R() >= 1 -} +}\if{html}{\out{
    }} Using \code{only_all_tested} has no impact when only using one antibiotic as input. } diff --git a/man/custom_eucast_rules.Rd b/man/custom_eucast_rules.Rd index cbf3e334..cc36e696 100644 --- a/man/custom_eucast_rules.Rd +++ b/man/custom_eucast_rules.Rd @@ -22,11 +22,15 @@ Some organisations have their own adoption of EUCAST rules. This function can be \subsection{Basics}{ -If you are familiar with the \code{\link[dplyr:case_when]{case_when()}} function of the \code{dplyr} package, you will recognise the input method to set your own rules. Rules must be set using what \R considers to be the 'formula notation'. The rule itself is written \emph{before} the tilde (\code{~}) and the consequence of the rule is written \emph{after} the tilde:\preformatted{x <- custom_eucast_rules(TZP == "S" ~ aminopenicillins == "S", - TZP == "R" ~ aminopenicillins == "R") -} +If you are familiar with the \code{\link[dplyr:case_when]{case_when()}} function of the \code{dplyr} package, you will recognise the input method to set your own rules. Rules must be set using what \R considers to be the 'formula notation'. The rule itself is written \emph{before} the tilde (\code{~}) and the consequence of the rule is written \emph{after} the tilde: -These are two custom EUCAST rules: if TZP (piperacillin/tazobactam) is "S", all aminopenicillins (ampicillin and amoxicillin) must be made "S", and if TZP is "R", aminopenicillins must be made "R". These rules can also be printed to the console, so it is immediately clear how they work:\preformatted{x +\if{html}{\out{
    }}\preformatted{x <- custom_eucast_rules(TZP == "S" ~ aminopenicillins == "S", + TZP == "R" ~ aminopenicillins == "R") +}\if{html}{\out{
    }} + +These are two custom EUCAST rules: if TZP (piperacillin/tazobactam) is "S", all aminopenicillins (ampicillin and amoxicillin) must be made "S", and if TZP is "R", aminopenicillins must be made "R". These rules can also be printed to the console, so it is immediately clear how they work: + +\if{html}{\out{
    }}\preformatted{x #> A set of custom EUCAST rules: #> #> 1. If TZP is S then set to S: @@ -34,9 +38,11 @@ These are two custom EUCAST rules: if TZP (piperacillin/tazobactam) is "S", all #> #> 2. If TZP is R then set to R: #> amoxicillin (AMX), ampicillin (AMP) -} +}\if{html}{\out{
    }} -The rules (the part \emph{before} the tilde, in above example \code{TZP == "S"} and \code{TZP == "R"}) must be evaluable in your data set: it should be able to run as a filter in your data set without errors. This means for the above example that the column \code{TZP} must exist. We will create a sample data set and test the rules set:\preformatted{df <- data.frame(mo = c("E. coli", "K. pneumoniae"), +The rules (the part \emph{before} the tilde, in above example \code{TZP == "S"} and \code{TZP == "R"}) must be evaluable in your data set: it should be able to run as a filter in your data set without errors. This means for the above example that the column \code{TZP} must exist. We will create a sample data set and test the rules set: + +\if{html}{\out{
    }}\preformatted{df <- data.frame(mo = c("E. coli", "K. pneumoniae"), TZP = "R", amox = "", AMP = "") @@ -49,54 +55,28 @@ eucast_rules(df, rules = "custom", custom_rules = x) #> mo TZP amox AMP #> 1 E. coli R R R #> 2 K. pneumoniae R R R -} +}\if{html}{\out{
    }} } \subsection{Using taxonomic properties in rules}{ -There is one exception in variables used for the rules: all column names of the \link{microorganisms} data set can also be used, but do not have to exist in the data set. These column names are: \code{mo}, \code{fullname}, \code{kingdom}, \code{phylum}, \code{class}, \code{order}, \code{family}, \code{genus}, \code{species}, \code{subspecies}, \code{rank}, \code{ref}, \code{species_id}, \code{source}, \code{prevalence} and \code{snomed}. Thus, this next example will work as well, despite the fact that the \code{df} data set does not contain a column \code{genus}:\preformatted{y <- custom_eucast_rules(TZP == "S" & genus == "Klebsiella" ~ aminopenicillins == "S", +There is one exception in variables used for the rules: all column names of the \link{microorganisms} data set can also be used, but do not have to exist in the data set. These column names are: \verb{r vector_and(colnames(microorganisms), quote = "``", sort = FALSE)}. Thus, this next example will work as well, despite the fact that the \code{df} data set does not contain a column \code{genus}: + +\if{html}{\out{
    }}\preformatted{y <- custom_eucast_rules(TZP == "S" & genus == "Klebsiella" ~ aminopenicillins == "S", TZP == "R" & genus == "Klebsiella" ~ aminopenicillins == "R") eucast_rules(df, rules = "custom", custom_rules = y) #> mo TZP amox AMP #> 1 E. coli R #> 2 K. pneumoniae R R R -} +}\if{html}{\out{
    }} } \subsection{Usage of antibiotic group names}{ It is possible to define antibiotic groups instead of single antibiotics for the rule consequence, the part \emph{after} the tilde. In above examples, the antibiotic group \code{aminopenicillins} is used to include ampicillin and amoxicillin. The following groups are allowed (case-insensitive). Within parentheses are the agents that will be matched when running the rule. -\itemize{ -\item \code{aminoglycosides}\cr(amikacin, amikacin/fosfomycin, amphotericin B-high, apramycin, arbekacin, astromicin, bekanamycin, dibekacin, framycetin, gentamicin, gentamicin-high, habekacin, hygromycin, isepamicin, kanamycin, kanamycin-high, kanamycin/cephalexin, micronomicin, neomycin, netilmicin, pentisomicin, plazomicin, propikacin, ribostamycin, sisomicin, streptoduocin, streptomycin, streptomycin-high, tobramycin and tobramycin-high) -\item \code{aminopenicillins}\cr(amoxicillin and ampicillin) -\item \code{antifungals}\cr(5-fluorocytosine, amphotericin B, anidulafungin, butoconazole, caspofungin, ciclopirox, clotrimazole, econazole, fluconazole, fosfluconazole, griseofulvin, hachimycin, ibrexafungerp, isavuconazole, isoconazole, itraconazole, ketoconazole, manogepix, micafungin, miconazole, nystatin, pimaricin, posaconazole, rezafungin, ribociclib, sulconazole, terbinafine, terconazole and voriconazole) -\item \code{antimycobacterials}\cr(4-aminosalicylic acid, calcium aminosalicylate, capreomycin, clofazimine, delamanid, enviomycin, ethambutol, ethambutol/isoniazid, ethionamide, isoniazid, morinamide, p-aminosalicylic acid, pretomanid, prothionamide, pyrazinamide, rifabutin, rifampicin, rifampicin/isoniazid, rifampicin/pyrazinamide/ethambutol/isoniazid, rifampicin/pyrazinamide/isoniazid, rifamycin, rifapentine, simvastatin/fenofibrate, sodium aminosalicylate, streptomycin/isoniazid, terizidone, thioacetazone/isoniazid, tiocarlide and viomycin) -\item \code{betalactams}\cr(amoxicillin, amoxicillin/clavulanic acid, amoxicillin/sulbactam, ampicillin, ampicillin/sulbactam, apalcillin, aspoxicillin, avibactam, azidocillin, azlocillin, aztreonam, aztreonam/avibactam, aztreonam/nacubactam, bacampicillin, benzathine benzylpenicillin, benzathine phenoxymethylpenicillin, benzylpenicillin, biapenem, carbenicillin, carindacillin, cefacetrile, cefaclor, cefadroxil, cefaloridine, cefamandole, cefatrizine, cefazedone, cefazolin, cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime, cefepime/clavulanic acid, cefepime/nacubactam, cefepime/tazobactam, cefetamet, cefetamet pivoxil, cefetecol, cefetrizole, cefixime, cefmenoxime, cefmetazole, cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam, ceforanide, cefoselis, cefotaxime, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam, cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening, cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil, cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline, ceftaroline/avibactam, ceftazidime, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftobiprole, ceftobiprole medocaril, ceftolozane/enzyme inhibitor, ceftolozane/tazobactam, ceftriaxone, cefuroxime, cefuroxime axetil, cephalexin, cephalothin, cephapirin, cephradine, ciclacillin, clometocillin, cloxacillin, dicloxacillin, doripenem, epicillin, ertapenem, flucloxacillin, hetacillin, imipenem, imipenem/EDTA, imipenem/relebactam, latamoxef, lenampicillin, loracarbef, mecillinam, meropenem, meropenem/nacubactam, meropenem/vaborbactam, metampicillin, methicillin, mezlocillin, mezlocillin/sulbactam, nacubactam, nafcillin, oxacillin, panipenem, penamecillin, penicillin/novobiocin, penicillin/sulbactam, phenethicillin, phenoxymethylpenicillin, piperacillin, piperacillin/sulbactam, piperacillin/tazobactam, piridicillin, pivampicillin, pivmecillinam, procaine benzylpenicillin, propicillin, razupenem, ritipenem, ritipenem acoxil, sarmoxicillin, sulbactam, sulbenicillin, sultamicillin, talampicillin, tazobactam, tebipenem, temocillin, ticarcillin and ticarcillin/clavulanic acid) -\item \code{carbapenems}\cr(biapenem, doripenem, ertapenem, imipenem, imipenem/EDTA, imipenem/relebactam, meropenem, meropenem/nacubactam, meropenem/vaborbactam, panipenem, razupenem, ritipenem, ritipenem acoxil and tebipenem) -\item \code{cephalosporins}\cr(cefacetrile, cefaclor, cefadroxil, cefaloridine, cefamandole, cefatrizine, cefazedone, cefazolin, cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime, cefepime/clavulanic acid, cefepime/tazobactam, cefetamet, cefetamet pivoxil, cefetecol, cefetrizole, cefixime, cefmenoxime, cefmetazole, cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam, ceforanide, cefoselis, cefotaxime, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam, cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening, cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil, cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline, ceftaroline/avibactam, ceftazidime, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftobiprole, ceftobiprole medocaril, ceftolozane/enzyme inhibitor, ceftolozane/tazobactam, ceftriaxone, cefuroxime, cefuroxime axetil, cephalexin, cephalothin, cephapirin, cephradine, latamoxef and loracarbef) -\item \code{cephalosporins_1st}\cr(cefacetrile, cefadroxil, cefaloridine, cefatrizine, cefazedone, cefazolin, cefroxadine, ceftezole, cephalexin, cephalothin, cephapirin and cephradine) -\item \code{cephalosporins_2nd}\cr(cefaclor, cefamandole, cefmetazole, cefonicid, ceforanide, cefotetan, cefotiam, cefoxitin, cefoxitin screening, cefprozil, cefuroxime, cefuroxime axetil and loracarbef) -\item \code{cephalosporins_3rd}\cr(cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefetamet, cefetamet pivoxil, cefixime, cefmenoxime, cefodizime, cefoperazone, cefoperazone/sulbactam, cefotaxime, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotiam hexetil, cefovecin, cefpimizole, cefpiramide, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefsulodin, ceftazidime, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftriaxone and latamoxef) -\item \code{cephalosporins_4th}\cr(cefepime, cefepime/clavulanic acid, cefepime/tazobactam, cefetecol, cefoselis, cefozopran, cefpirome and cefquinome) -\item \code{cephalosporins_5th}\cr(ceftaroline, ceftaroline/avibactam, ceftobiprole, ceftobiprole medocaril, ceftolozane/enzyme inhibitor and ceftolozane/tazobactam) -\item \code{cephalosporins_except_caz}\cr(cefacetrile, cefaclor, cefadroxil, cefaloridine, cefamandole, cefatrizine, cefazedone, cefazolin, cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime, cefepime/clavulanic acid, cefepime/tazobactam, cefetamet, cefetamet pivoxil, cefetecol, cefetrizole, cefixime, cefmenoxime, cefmetazole, cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam, ceforanide, cefoselis, cefotaxime, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam, cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening, cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil, cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline, ceftaroline/avibactam, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftobiprole, ceftobiprole medocaril, ceftolozane/enzyme inhibitor, ceftolozane/tazobactam, ceftriaxone, cefuroxime, cefuroxime axetil, cephalexin, cephalothin, cephapirin, cephradine, latamoxef and loracarbef) -\item \code{fluoroquinolones}\cr(besifloxacin, ciprofloxacin, clinafloxacin, danofloxacin, delafloxacin, difloxacin, enoxacin, enrofloxacin, finafloxacin, fleroxacin, garenoxacin, gatifloxacin, gemifloxacin, grepafloxacin, levofloxacin, levonadifloxacin, lomefloxacin, marbofloxacin, metioxate, miloxacin, moxifloxacin, nadifloxacin, nifuroquine, norfloxacin, ofloxacin, orbifloxacin, pazufloxacin, pefloxacin, pradofloxacin, premafloxacin, prulifloxacin, rufloxacin, sarafloxacin, sitafloxacin, sparfloxacin, temafloxacin, tilbroquinol, tioxacin, tosufloxacin and trovafloxacin) -\item \code{glycopeptides}\cr(avoparcin, dalbavancin, norvancomycin, oritavancin, ramoplanin, teicoplanin, teicoplanin-macromethod, telavancin, vancomycin and vancomycin-macromethod) -\item \code{glycopeptides_except_lipo}\cr(avoparcin, norvancomycin, ramoplanin, teicoplanin, teicoplanin-macromethod, vancomycin and vancomycin-macromethod) -\item \code{lincosamides}\cr(acetylmidecamycin, acetylspiramycin, clindamycin, gamithromycin, kitasamycin, lincomycin, meleumycin, nafithromycin, pirlimycin, primycin, solithromycin, tildipirosin, tilmicosin, tulathromycin, tylosin and tylvalosin) -\item \code{lipoglycopeptides}\cr(dalbavancin, oritavancin and telavancin) -\item \code{macrolides}\cr(acetylmidecamycin, acetylspiramycin, azithromycin, clarithromycin, dirithromycin, erythromycin, flurithromycin, gamithromycin, josamycin, kitasamycin, meleumycin, midecamycin, miocamycin, nafithromycin, oleandomycin, pirlimycin, primycin, rokitamycin, roxithromycin, solithromycin, spiramycin, telithromycin, tildipirosin, tilmicosin, troleandomycin, tulathromycin, tylosin and tylvalosin) -\item \code{oxazolidinones}\cr(cadazolid, cycloserine, linezolid, tedizolid and thiacetazone) -\item \code{penicillins}\cr(amoxicillin, amoxicillin/clavulanic acid, amoxicillin/sulbactam, ampicillin, ampicillin/sulbactam, apalcillin, aspoxicillin, avibactam, azidocillin, azlocillin, aztreonam, aztreonam/avibactam, aztreonam/nacubactam, bacampicillin, benzathine benzylpenicillin, benzathine phenoxymethylpenicillin, benzylpenicillin, carbenicillin, carindacillin, cefepime/nacubactam, ciclacillin, clometocillin, cloxacillin, dicloxacillin, epicillin, flucloxacillin, hetacillin, lenampicillin, mecillinam, metampicillin, methicillin, mezlocillin, mezlocillin/sulbactam, nacubactam, nafcillin, oxacillin, penamecillin, penicillin/novobiocin, penicillin/sulbactam, phenethicillin, phenoxymethylpenicillin, piperacillin, piperacillin/sulbactam, piperacillin/tazobactam, piridicillin, pivampicillin, pivmecillinam, procaine benzylpenicillin, propicillin, sarmoxicillin, sulbactam, sulbenicillin, sultamicillin, talampicillin, tazobactam, temocillin, ticarcillin and ticarcillin/clavulanic acid) -\item \code{polymyxins}\cr(colistin, polymyxin B and polymyxin B/polysorbate 80) -\item \code{quinolones}\cr(besifloxacin, cinoxacin, ciprofloxacin, clinafloxacin, danofloxacin, delafloxacin, difloxacin, enoxacin, enrofloxacin, finafloxacin, fleroxacin, flumequine, garenoxacin, gatifloxacin, gemifloxacin, grepafloxacin, levofloxacin, levonadifloxacin, lomefloxacin, marbofloxacin, metioxate, miloxacin, moxifloxacin, nadifloxacin, nalidixic acid, nifuroquine, nitroxoline, norfloxacin, ofloxacin, orbifloxacin, oxolinic acid, pazufloxacin, pefloxacin, pipemidic acid, piromidic acid, pradofloxacin, premafloxacin, prulifloxacin, rosoxacin, rufloxacin, sarafloxacin, sitafloxacin, sparfloxacin, temafloxacin, tilbroquinol, tioxacin, tosufloxacin and trovafloxacin) -\item \code{streptogramins}\cr(pristinamycin and quinupristin/dalfopristin) -\item \code{tetracyclines}\cr(cetocycline, chlortetracycline, clomocycline, demeclocycline, doxycycline, eravacycline, lymecycline, metacycline, minocycline, omadacycline, oxytetracycline, penimepicycline, rolitetracycline, tetracycline and tigecycline) -\item \code{tetracyclines_except_tgc}\cr(cetocycline, chlortetracycline, clomocycline, demeclocycline, doxycycline, eravacycline, lymecycline, metacycline, minocycline, omadacycline, oxytetracycline, penimepicycline, rolitetracycline and tetracycline) -\item \code{trimethoprims}\cr(brodimoprim, sulfadiazine, sulfadiazine/tetroxoprim, sulfadiazine/trimethoprim, sulfadimethoxine, sulfadimidine, sulfadimidine/trimethoprim, sulfafurazole, sulfaisodimidine, sulfalene, sulfamazone, sulfamerazine, sulfamerazine/trimethoprim, sulfamethizole, sulfamethoxazole, sulfamethoxypyridazine, sulfametomidine, sulfametoxydiazine, sulfametrole/trimethoprim, sulfamoxole, sulfamoxole/trimethoprim, sulfanilamide, sulfaperin, sulfaphenazole, sulfapyridine, sulfathiazole, sulfathiourea, trimethoprim and trimethoprim/sulfamethoxazole) -\item \code{ureidopenicillins}\cr(azlocillin, mezlocillin, piperacillin and piperacillin/tazobactam) -} + +\verb{r paste0(" * ", sapply(DEFINED_AB_GROUPS, function(x) paste0("``", tolower(gsub("^AB_", "", x)), "``\\\\cr(", vector_and(ab_name(eval(parse(text = x), envir = asNamespace("AMR")), language = NULL, tolower = TRUE), quotes = FALSE), ")"), USE.NAMES = FALSE), "\\n", collapse = "")} } } diff --git a/man/eucast_rules.Rd b/man/eucast_rules.Rd index a900dac2..fafd15db 100644 --- a/man/eucast_rules.Rd +++ b/man/eucast_rules.Rd @@ -76,11 +76,13 @@ To improve the interpretation of the antibiogram before EUCAST rules are applied The file containing all EUCAST rules is located here: \url{https://github.com/msberends/AMR/blob/main/data-raw/eucast_rules.tsv}. \strong{Note:} Old taxonomic names are replaced with the current taxonomy where applicable. For example, \emph{Ochrobactrum anthropi} was renamed to \emph{Brucella anthropi} in 2020; the original EUCAST rules v3.1 and v3.2 did not yet contain this new taxonomic name. The file used as input for this \code{AMR} package contains the taxonomy updated until \link[=catalogue_of_life]{5 October 2021}. \subsection{Custom Rules}{ -Custom rules can be created using \code{\link[=custom_eucast_rules]{custom_eucast_rules()}}, e.g.:\preformatted{x <- custom_eucast_rules(AMC == "R" & genus == "Klebsiella" ~ aminopenicillins == "R", +Custom rules can be created using \code{\link[=custom_eucast_rules]{custom_eucast_rules()}}, e.g.: + +\if{html}{\out{
    }}\preformatted{x <- custom_eucast_rules(AMC == "R" & genus == "Klebsiella" ~ aminopenicillins == "R", AMC == "I" & genus == "Klebsiella" ~ aminopenicillins == "I") eucast_rules(example_isolates, rules = "custom", custom_rules = x) -} +}\if{html}{\out{
    }} } \subsection{'Other' Rules}{ diff --git a/man/g.test.Rd b/man/g.test.Rd index b815c8d9..886f29ae 100644 --- a/man/g.test.Rd +++ b/man/g.test.Rd @@ -89,8 +89,10 @@ The \emph{G}-test uses the log of the ratio of two likelihoods as the test stati \eqn{G = 2 * sum(x * log(x / E))} -where \code{E} are the expected values. Since this is chi-square distributed, the p value can be calculated in \R with:\preformatted{p <- stats::pchisq(G, df, lower.tail = FALSE) -} +where \code{E} are the expected values. Since this is chi-square distributed, the p value can be calculated in \R with: + +\if{html}{\out{
    }}\preformatted{p <- stats::pchisq(G, df, lower.tail = FALSE) +}\if{html}{\out{
    }} where \code{df} are the degrees of freedom. diff --git a/man/mdro.Rd b/man/mdro.Rd index 9bcbed3e..6d4d1802 100644 --- a/man/mdro.Rd +++ b/man/mdro.Rd @@ -122,35 +122,43 @@ Please suggest your own (country-specific) guidelines by letting us know: \url{h Custom guidelines can be set with the \code{\link[=custom_mdro_guideline]{custom_mdro_guideline()}} function. This is of great importance if you have custom rules to determine MDROs in your hospital, e.g., rules that are dependent on ward, state of contact isolation or other variables in your data. -If you are familiar with the \code{\link[dplyr:case_when]{case_when()}} function of the \code{dplyr} package, you will recognise the input method to set your own rules. Rules must be set using what \R considers to be the 'formula notation'. The rule is written \emph{before} the tilde (\code{~}) and the consequence of the rule is written \emph{after} the tilde:\preformatted{custom <- custom_mdro_guideline(CIP == "R" & age > 60 ~ "Elderly Type A", +If you are familiar with the \code{\link[dplyr:case_when]{case_when()}} function of the \code{dplyr} package, you will recognise the input method to set your own rules. Rules must be set using what \R considers to be the 'formula notation'. The rule is written \emph{before} the tilde (\code{~}) and the consequence of the rule is written \emph{after} the tilde: + +\if{html}{\out{
    }}\preformatted{custom <- custom_mdro_guideline(CIP == "R" & age > 60 ~ "Elderly Type A", ERY == "R" & age > 60 ~ "Elderly Type B") -} +}\if{html}{\out{
    }} If a row/an isolate matches the first rule, the value after the first \code{~} (in this case \emph{'Elderly Type A'}) will be set as MDRO value. Otherwise, the second rule will be tried and so on. The number of rules is unlimited. -You can print the rules set in the console for an overview. Colours will help reading it if your console supports colours.\preformatted{custom +You can print the rules set in the console for an overview. Colours will help reading it if your console supports colours. + +\if{html}{\out{
    }}\preformatted{custom #> A set of custom MDRO rules: #> 1. CIP is "R" and age is higher than 60 -> Elderly Type A #> 2. ERY is "R" and age is higher than 60 -> Elderly Type B #> 3. Otherwise -> Negative #> #> Unmatched rows will return NA. -} +}\if{html}{\out{
    }} -The outcome of the function can be used for the \code{guideline} argument in the \code{\link[=mdro]{mdro()}} function:\preformatted{x <- mdro(example_isolates, +The outcome of the function can be used for the \code{guideline} argument in the \code{\link[=mdro]{mdro()}} function: + +\if{html}{\out{
    }}\preformatted{x <- mdro(example_isolates, guideline = custom) table(x) #> Negative Elderly Type A Elderly Type B #> 1070 198 732 -} +}\if{html}{\out{
    }} -Rules can also be combined with other custom rules by using \code{\link[=c]{c()}}:\preformatted{x <- mdro(example_isolates, +Rules can also be combined with other custom rules by using \code{\link[=c]{c()}}: + +\if{html}{\out{
    }}\preformatted{x <- mdro(example_isolates, guideline = c(custom, custom_mdro_guideline(ERY == "R" & age > 50 ~ "Elderly Type C"))) table(x) #> Negative Elderly Type A Elderly Type B Elderly Type C #> 961 198 732 109 -} +}\if{html}{\out{
    }} The rules set (the \code{custom} object in this case) could be exported to a shared file location using \code{\link[=saveRDS]{saveRDS()}} if you collaborate with multiple users. The custom rules set could then be imported using \code{\link[=readRDS]{readRDS()}}. } diff --git a/man/mo_source.Rd b/man/mo_source.Rd index eb8e1794..74e80972 100644 --- a/man/mo_source.Rd +++ b/man/mo_source.Rd @@ -37,23 +37,29 @@ Reading an Excel file (\code{.xlsx}) with only one row has a size of 8-9 kB. The \section{How to Setup}{ -Imagine this data on a sheet of an Excel file. The first column contains the organisation specific codes, the second column contains valid taxonomic names:\preformatted{ | A | B | +Imagine this data on a sheet of an Excel file. The first column contains the organisation specific codes, the second column contains valid taxonomic names: + +\if{html}{\out{
    }}\preformatted{ | A | B | --|--------------------|-----------------------| 1 | Organisation XYZ | mo | 2 | lab_mo_ecoli | Escherichia coli | 3 | lab_mo_kpneumoniae | Klebsiella pneumoniae | 4 | | | -} +}\if{html}{\out{
    }} -We save it as \code{"home/me/ourcodes.xlsx"}. Now we have to set it as a source:\preformatted{set_mo_source("home/me/ourcodes.xlsx") +We save it as \code{"home/me/ourcodes.xlsx"}. Now we have to set it as a source: + +\if{html}{\out{
    }}\preformatted{set_mo_source("home/me/ourcodes.xlsx") #> NOTE: Created mo_source file '/Users/me/mo_source.rds' (0.3 kB) from #> '/Users/me/Documents/ourcodes.xlsx' (9 kB), columns #> "Organisation XYZ" and "mo" -} +}\if{html}{\out{
    }} It has now created a file \code{"~/mo_source.rds"} with the contents of our Excel file. Only the first column with foreign values and the 'mo' column will be kept when creating the RDS file. -And now we can use it in our functions:\preformatted{as.mo("lab_mo_ecoli") +And now we can use it in our functions: + +\if{html}{\out{
    }}\preformatted{as.mo("lab_mo_ecoli") #> Class #> [1] B_ESCHR_COLI @@ -66,18 +72,22 @@ as.mo(c("Escherichia coli", "E. coli", "lab_mo_ecoli")) #> Use mo_uncertainties() to review it. #> Class #> [1] B_ESCHR_COLI B_ESCHR_COLI B_ESCHR_COLI -} +}\if{html}{\out{
    }} -If we edit the Excel file by, let's say, adding row 4 like this:\preformatted{ | A | B | +If we edit the Excel file by, let's say, adding row 4 like this: + +\if{html}{\out{
    }}\preformatted{ | A | B | --|--------------------|-----------------------| 1 | Organisation XYZ | mo | 2 | lab_mo_ecoli | Escherichia coli | 3 | lab_mo_kpneumoniae | Klebsiella pneumoniae | 4 | lab_Staph_aureus | Staphylococcus aureus | 5 | | | -} +}\if{html}{\out{
    }} -...any new usage of an MO function in this package will update your data file:\preformatted{as.mo("lab_mo_ecoli") +...any new usage of an MO function in this package will update your data file: + +\if{html}{\out{
    }}\preformatted{as.mo("lab_mo_ecoli") #> NOTE: Updated mo_source file '/Users/me/mo_source.rds' (0.3 kB) from #> '/Users/me/Documents/ourcodes.xlsx' (9 kB), columns #> "Organisation XYZ" and "mo" @@ -86,11 +96,13 @@ If we edit the Excel file by, let's say, adding row 4 like this:\preformatted{ mo_genus("lab_Staph_aureus") #> [1] "Staphylococcus" -} +}\if{html}{\out{
    }} -To delete the reference data file, just use \code{""}, \code{NULL} or \code{FALSE} as input for \code{\link[=set_mo_source]{set_mo_source()}}:\preformatted{set_mo_source(NULL) +To delete the reference data file, just use \code{""}, \code{NULL} or \code{FALSE} as input for \code{\link[=set_mo_source]{set_mo_source()}}: + +\if{html}{\out{
    }}\preformatted{set_mo_source(NULL) #> Removed mo_source file '/Users/me/mo_source.rds' -} +}\if{html}{\out{
    }} If the original file (in the previous case an Excel file) is moved or deleted, the \code{mo_source.rds} file will be removed upon the next use of \code{\link[=as.mo]{as.mo()}} or any \code{\link[=mo_property]{mo_*}} function. } diff --git a/man/proportion.Rd b/man/proportion.Rd index 7ecd3b57..7d092a32 100644 --- a/man/proportion.Rd +++ b/man/proportion.Rd @@ -89,7 +89,9 @@ The function \code{\link[=proportion_df]{proportion_df()}} takes any variable fr } \section{Combination Therapy}{ -When using more than one variable for \code{...} (= combination therapy), use \code{only_all_tested} to only count isolates that are tested for all antibiotics/variables that you test them for. See this example for two antibiotics, Drug A and Drug B, about how \code{\link[=susceptibility]{susceptibility()}} works to calculate the \%SI:\preformatted{-------------------------------------------------------------------- +When using more than one variable for \code{...} (= combination therapy), use \code{only_all_tested} to only count isolates that are tested for all antibiotics/variables that you test them for. See this example for two antibiotics, Drug A and Drug B, about how \code{\link[=susceptibility]{susceptibility()}} works to calculate the \%SI: + +\if{html}{\out{
    }}\preformatted{-------------------------------------------------------------------- only_all_tested = FALSE only_all_tested = TRUE ----------------------- ----------------------- Drug A Drug B include as include as include as include as @@ -105,15 +107,19 @@ When using more than one variable for \code{...} (= combination therapy), use \c R - - - - - - - - -------------------------------------------------------------------- -} +}\if{html}{\out{
    }} -Please note that, in combination therapies, for \code{only_all_tested = TRUE} applies that:\preformatted{ count_S() + count_I() + count_R() = count_all() +Please note that, in combination therapies, for \code{only_all_tested = TRUE} applies that: + +\if{html}{\out{
    }}\preformatted{ count_S() + count_I() + count_R() = count_all() proportion_S() + proportion_I() + proportion_R() = 1 -} +}\if{html}{\out{
    }} -and that, in combination therapies, for \code{only_all_tested = FALSE} applies that:\preformatted{ count_S() + count_I() + count_R() >= count_all() +and that, in combination therapies, for \code{only_all_tested = FALSE} applies that: + +\if{html}{\out{
    }}\preformatted{ count_S() + count_I() + count_R() >= count_all() proportion_S() + proportion_I() + proportion_R() >= 1 -} +}\if{html}{\out{
    }} Using \code{only_all_tested} has no impact when only using one antibiotic as input. } diff --git a/man/rsi_translation.Rd b/man/rsi_translation.Rd index 65ea385c..7a467044 100644 --- a/man/rsi_translation.Rd +++ b/man/rsi_translation.Rd @@ -27,8 +27,12 @@ rsi_translation Data set containing reference data to interpret MIC and disk diffusion to R/SI values, according to international guidelines. Currently implemented guidelines are EUCAST (2011-2022) and CLSI (2011-2022). Use \code{\link[=as.rsi]{as.rsi()}} to transform MICs or disks measurements to R/SI values. } \details{ -Overview of the data set:\if{html}{\out{
    }}\preformatted{head(rsi_translation) -}\if{html}{\out{
    }}\preformatted{## guideline method site mo rank_index ab ref_tbl disk_dose +Overview of the data set: + +\if{html}{\out{
    }}\preformatted{head(rsi_translation) +}\if{html}{\out{
    }} + +\if{html}{\out{
    }}\preformatted{## guideline method site mo rank_index ab ref_tbl disk_dose ## 1 EUCAST 2022 MIC F_ASPRG_MGTS 2 AMB Aspergillus ## 2 EUCAST 2022 MIC F_ASPRG_NIGR 2 AMB Aspergillus ## 3 EUCAST 2022 MIC F_CANDD 3 AMB Candida @@ -42,7 +46,7 @@ Overview of the data set:\if{html}{\out{
    }}\preformatte ## 4 1 1 FALSE ## 5 1 1 FALSE ## 6 1 1 FALSE -} +}\if{html}{\out{
    }} The repository of this \code{AMR} package contains a file comprising this exact data set: \url{https://github.com/msberends/AMR/blob/main/data-raw/rsi_translation.txt}. This file \strong{allows for machine reading EUCAST and CLSI guidelines}, which is almost impossible with the Excel and PDF files distributed by EUCAST and CLSI. The file is updated automatically and the \code{mo} and \code{ab} columns have been transformed to contain the full official names instead of codes. }