Functions to plot classes rsi, mic and disk, with support for base R and ggplot2.

# S3 method for mic
plot(
  x,
  main = paste("MIC values of", deparse(substitute(x))),
  ylab = "Frequency",
  xlab = "Minimum Inhibitory Concentration (mg/L)",
  mo = NULL,
  ab = NULL,
  guideline = "EUCAST",
  colours_RSI = c("#ED553B", "#3CAEA3", "#F6D55C"),
  language = get_locale(),
  expand = TRUE,
  ...
)

# S3 method for mic
ggplot(
  data,
  mapping = NULL,
  title = paste("MIC values of", deparse(substitute(data))),
  ylab = "Frequency",
  xlab = "Minimum Inhibitory Concentration (mg/L)",
  mo = NULL,
  ab = NULL,
  guideline = "EUCAST",
  colours_RSI = c("#ED553B", "#3CAEA3", "#F6D55C"),
  language = get_locale(),
  expand = TRUE,
  ...
)

# S3 method for disk
plot(
  x,
  main = paste("Disk zones of", deparse(substitute(x))),
  ylab = "Frequency",
  xlab = "Disk diffusion diameter (mm)",
  mo = NULL,
  ab = NULL,
  guideline = "EUCAST",
  colours_RSI = c("#ED553B", "#3CAEA3", "#F6D55C"),
  language = get_locale(),
  expand = TRUE,
  ...
)

# S3 method for disk
ggplot(
  data,
  mapping = NULL,
  title = paste("Disk zones of", deparse(substitute(data))),
  ylab = "Frequency",
  xlab = "Disk diffusion diameter (mm)",
  mo = NULL,
  ab = NULL,
  guideline = "EUCAST",
  colours_RSI = c("#ED553B", "#3CAEA3", "#F6D55C"),
  language = get_locale(),
  expand = TRUE,
  ...
)

# S3 method for rsi
plot(
  x,
  ylab = "Percentage",
  xlab = "Antimicrobial Interpretation",
  main = paste("Resistance Overview of", deparse(substitute(x))),
  ...
)

# S3 method for rsi
ggplot(
  data,
  mapping = NULL,
  title = paste("Resistance Overview of", deparse(substitute(data))),
  xlab = "Antimicrobial Interpretation",
  ylab = "Frequency",
  colours_RSI = c("#ED553B", "#3CAEA3", "#F6D55C"),
  language = get_locale(),
  ...
)

Arguments

x, data

MIC values created with as.mic() or disk diffusion values created with as.disk()

main, title

title of the plot

xlab, ylab

axis title

mo

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

ab

any (vector of) text that can be coerced to a valid antimicrobial code with as.ab()

guideline

interpretation guideline to use, defaults to the latest included EUCAST guideline, see Details

colours_RSI

colours to use for filling in the bars, must be a vector of three values (in the order R, S and I). The default colours are colour-blind friendly.

language

language to be used to translate 'Susceptible', 'Increased exposure'/'Intermediate' and 'Resistant', defaults to system language (see get_locale()) and can be overwritten by setting the option AMR_locale, e.g. options(AMR_locale = "de"), see translate. Use language = NULL or language = "" to prevent translation.

expand

logical to indicate whether the range on the x axis should be expanded between the lowest and highest value. For MIC values, intermediate values will be factors of 2 starting from the highest MIC value. For disk diameters, the whole diameter range will be filled.

...

arguments passed on to as.rsi()

mapping

aesthetic mappings to use for ggplot()

Value

The ggplot functions return a ggplot model that is extendible with any ggplot2 function.

Details

The interpretation of "I" will be named "Increased exposure" for all EUCAST guidelines since 2019, and will be named "Intermediate" in all other cases.

For interpreting MIC values as well as disk diffusion diameters, supported guidelines to be used as input for the guideline argument are: "EUCAST 2021", "EUCAST 2020", "EUCAST 2019", "EUCAST 2018", "EUCAST 2017", "EUCAST 2016", "EUCAST 2015", "EUCAST 2014", "EUCAST 2013", "EUCAST 2012", "EUCAST 2011", "CLSI 2019", "CLSI 2018", "CLSI 2017", "CLSI 2016", "CLSI 2015", "CLSI 2014", "CLSI 2013", "CLSI 2012", "CLSI 2011" and "CLSI 2010".

Simply using "CLSI" or "EUCAST" as input will automatically select the latest version of that guideline.

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

some_mic_values <- random_mic(size = 100)
some_disk_values <- random_disk(size = 100, mo = "Escherichia coli", ab = "cipro")
some_rsi_values <- random_rsi(50, prob_RSI = c(0.30, 0.55, 0.05))

plot(some_mic_values)
plot(some_disk_values)
plot(some_rsi_values)

# when providing the microorganism and antibiotic, colours will show interpretations:
plot(some_mic_values, mo = "S. aureus", ab = "ampicillin")
plot(some_disk_values, mo = "Escherichia coli", ab = "cipro")

if (require("ggplot2")) {
  ggplot(some_mic_values)
  ggplot(some_disk_values, mo = "Escherichia coli", ab = "cipro")
  ggplot(some_rsi_values)
}