1
0
mirror of https://github.com/msberends/AMR.git synced 2025-09-03 05:04:07 +02:00

(v2.1.1.9163) cleanup

This commit is contained in:
2025-02-27 14:04:29 +01:00
parent 68efddab3d
commit 07efc292bc
73 changed files with 2187 additions and 1715 deletions

View File

@@ -201,7 +201,6 @@ some_mic_values <- random_mic(size = 100)
some_disk_values <- random_disk(size = 100, mo = "Escherichia coli", ab = "cipro")
some_sir_values <- random_sir(50, prob_SIR = c(0.55, 0.05, 0.30))
\donttest{
# Plotting using ggplot2's autoplot() for MIC, disk, and SIR -----------
if (require("ggplot2")) {
@@ -213,17 +212,23 @@ if (require("ggplot2")) {
}
if (require("ggplot2")) {
# support for 20 languages, various guidelines, and many options
autoplot(some_disk_values, mo = "Escherichia coli", ab = "cipro",
guideline = "CLSI 2024", language = "no",
title = "Disk diffusion from the North")
autoplot(some_disk_values,
mo = "Escherichia coli", ab = "cipro",
guideline = "CLSI 2024", language = "no",
title = "Disk diffusion from the North"
)
}
# Plotting using scale_x_mic() -----------------------------------------
if (require("ggplot2")) {
mic_plot <- ggplot(data.frame(mics = as.mic(c(0.25, "<=4", 4, 8, 32, ">=32")),
counts = c(1, 1, 2, 2, 3, 3)),
aes(mics, counts)) +
mic_plot <- ggplot(
data.frame(
mics = as.mic(c(0.25, "<=4", 4, 8, 32, ">=32")),
counts = c(1, 1, 2, 2, 3, 3)
),
aes(mics, counts)
) +
geom_col()
mic_plot +
labs(title = "without scale_x_mic()")
@@ -254,17 +259,25 @@ if (require("ggplot2")) {
some_groups <- sample(LETTERS[1:5], 20, replace = TRUE)
if (require("ggplot2")) {
ggplot(data.frame(mic = some_mic_values,
group = some_groups),
aes(group, mic)) +
ggplot(
data.frame(
mic = some_mic_values,
group = some_groups
),
aes(group, mic)
) +
geom_boxplot() +
geom_violin(linetype = 2, colour = "grey", fill = NA) +
scale_y_mic()
}
if (require("ggplot2")) {
ggplot(data.frame(mic = some_mic_values,
group = some_groups),
aes(group, mic)) +
ggplot(
data.frame(
mic = some_mic_values,
group = some_groups
),
aes(group, mic)
) +
geom_boxplot() +
geom_violin(linetype = 2, colour = "grey", fill = NA) +
scale_y_mic(mic_range = c(NA, 0.25))
@@ -273,9 +286,13 @@ if (require("ggplot2")) {
# Plotting using scale_x_sir() -----------------------------------------
if (require("ggplot2")) {
ggplot(data.frame(x = c("I", "R", "S"),
y = c(45,323, 573)),
aes(x, y)) +
ggplot(
data.frame(
x = c("I", "R", "S"),
y = c(45, 323, 573)
),
aes(x, y)
) +
geom_col() +
scale_x_sir()
}
@@ -283,16 +300,21 @@ if (require("ggplot2")) {
# Plotting using scale_y_mic() and scale_colour_sir() ------------------
if (require("ggplot2")) {
plain <- ggplot(data.frame(mic = some_mic_values,
group = some_groups,
sir = as.sir(some_mic_values,
mo = "E. coli",
ab = "cipro")),
aes(x = group, y = mic, colour = sir)) +
plain <- ggplot(
data.frame(
mic = some_mic_values,
group = some_groups,
sir = as.sir(some_mic_values,
mo = "E. coli",
ab = "cipro"
)
),
aes(x = group, y = mic, colour = sir)
) +
theme_minimal() +
geom_boxplot(fill = NA, colour = "grey") +
geom_jitter(width = 0.25)
plain
}
if (require("ggplot2")) {
@@ -304,8 +326,10 @@ if (require("ggplot2")) {
if (require("ggplot2")) {
plain +
scale_y_mic(mic_range = c(0.005, 32), name = "Our MICs!") +
scale_colour_sir(language = "pt",
name = "Support in 20 languages")
scale_colour_sir(
language = "pt",
name = "Support in 20 languages"
)
}
}