Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

random

Random MIC Values/Disk Zones/RSI Generation


Description

These functions can be used for generating random MIC values and disk diffusion diameters, for AMR data analysis practice. By providing a microorganism and antimicrobial agent, the generated results will reflect reality as much as possible.

Usage

random_mic(size, mo = NULL, ab = NULL, ...)

random_disk(size, mo = NULL, ab = NULL, ...)

random_rsi(size, prob_RSI = c(0.33, 0.33, 0.33), ...)

Arguments

size

desired size of the returned vector

mo

any character that can be coerced to a valid microorganism code with as.mo()

ab

any character that can be coerced to a valid antimicrobial agent code with as.ab()

...

extension for future versions, not used at the moment

prob_RSI

a vector of length 3: the probabilities for R (1st value), S (2nd value) and I (3rd value)

Details

The base R function sample() is used for generating values.

Generated values are based on the latest EUCAST guideline implemented in the rsi_translation data set. To create specific generated values per bug or drug, set the mo and/or ab argument.

Value

class <mic> for random_mic() (see as.mic()) and class <disk> for random_disk() (see as.disk())

Stable Lifecycle


The lifecycle of this function is stable. In a stable function, major changes are unlikely. This means that the unlying code will generally evolve by adding new arguments; removing arguments or changing the meaning of existing arguments will be avoided.

If the unlying code needs breaking changes, they will occur gradually. For example, a argument will be deprecated and first continue to work, but will emit an message informing you of the change. Next, typically after at least one newly released version on CRAN, the message will be transformed to an error.

Read more on Our Website!

On our website https://msberends.github.io/AMR/ you can find a comprehensive tutorial about how to conduct AMR data analysis, the complete documentation of all functions and an example analysis using WHONET data. As we would like to better understand the backgrounds and needs of our users, please participate in our survey!

Examples

random_mic(100)
random_disk(100)
random_rsi(100)


# make the random generation more realistic by setting a bug and/or drug:
random_mic(100, "Klebsiella pneumoniae")                 # range 0.0625-64
random_mic(100, "Klebsiella pneumoniae", "meropenem")    # range 0.0625-16
random_mic(100, "Streptococcus pneumoniae", "meropenem") # range 0.0625-4

random_disk(100, "Klebsiella pneumoniae")                  # range 8-50
random_disk(100, "Klebsiella pneumoniae", "ampicillin")    # range 11-17
random_disk(100, "Streptococcus pneumoniae", "ampicillin") # range 12-27

AMR

Antimicrobial Resistance Data Analysis

v1.6.0
GPL-2 | file LICENSE
Authors
Matthijs S. Berends [aut, cre] (<https://orcid.org/0000-0001-7620-1800>), Christian F. Luz [aut, ctb] (<https://orcid.org/0000-0001-5809-5995>), Alexander W. Friedrich [aut, ths] (<https://orcid.org/0000-0003-4881-038X>), Bhanu N. M. Sinha [aut, ths] (<https://orcid.org/0000-0003-1634-0010>), Casper J. Albers [aut, ths] (<https://orcid.org/0000-0002-9213-6743>), Corinna Glasner [aut, ths] (<https://orcid.org/0000-0003-1241-1328>), Judith M. Fonville [ctb], Erwin E. A. Hassing [ctb], Eric H. L. C. M. Hazenberg [ctb], Gwen Knight [ctb], Annick Lenglet [ctb], Bart C. Meijer [ctb], Sofia Ny [ctb], Rogier P. Schade [ctb], Dennis Souverein [ctb], Anthony Underwood [ctb]
Initial release
2021-03-14

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.