(v1.5.0.9027) website update
@ -1,6 +1,6 @@
|
|||||||
Package: AMR
|
Package: AMR
|
||||||
Version: 1.5.0.9026
|
Version: 1.5.0.9027
|
||||||
Date: 2021-02-25
|
Date: 2021-02-26
|
||||||
Title: Antimicrobial Resistance Data Analysis
|
Title: Antimicrobial Resistance Data Analysis
|
||||||
Authors@R: c(
|
Authors@R: c(
|
||||||
person(role = c("aut", "cre"),
|
person(role = c("aut", "cre"),
|
||||||
|
4
NEWS.md
@ -1,5 +1,5 @@
|
|||||||
# AMR 1.5.0.9026
|
# AMR 1.5.0.9027
|
||||||
## <small>Last updated: 25 February 2021</small>
|
## <small>Last updated: 26 February 2021</small>
|
||||||
|
|
||||||
### New
|
### New
|
||||||
* Support for EUCAST Clinical Breakpoints v11.0 (2021), effective in the `eucast_rules()` function and in `as.rsi()` to interpret MIC and disk diffusion values. This is now the default guideline in this package.
|
* Support for EUCAST Clinical Breakpoints v11.0 (2021), effective in the `eucast_rules()` function and in `as.rsi()` to interpret MIC and disk diffusion values. This is now the default guideline in this package.
|
||||||
|
@ -36,8 +36,8 @@
|
|||||||
#' @param facet variable to split plots by, either `"interpretation"` (default) or `"antibiotic"` or a grouping variable
|
#' @param facet variable to split plots by, either `"interpretation"` (default) or `"antibiotic"` or a grouping variable
|
||||||
#' @inheritParams proportion
|
#' @inheritParams proportion
|
||||||
#' @param nrow (when using `facet`) number of rows
|
#' @param nrow (when using `facet`) number of rows
|
||||||
#' @param colours a named vector with colours for the bars. The names must be one or more of: S, SI, I, IR, R or be `FALSE` for standard [ggplot2][ggplot2::ggplot()] colours. The default colours are colour-blind friendly, while maintaining the convention that e.g. 'susceptible' should be green and 'resistant' should be red.
|
#' @param colours a named vactor with colour to be used for filling. The default colours are colour-blind friendly.
|
||||||
#' @param aesthetics aesthetics to apply the colours to, defaults to "fill" but can also be "colour" or "both"
|
#' @param aesthetics aesthetics to apply the colours to, defaults to "fill" but can also be (a combination of) "alpha", "colour", "fill", "linetype", "shape" or "size"
|
||||||
#' @param datalabels show datalabels using [labels_rsi_count()]
|
#' @param datalabels show datalabels using [labels_rsi_count()]
|
||||||
#' @param datalabels.size size of the datalabels
|
#' @param datalabels.size size of the datalabels
|
||||||
#' @param datalabels.colour colour of the datalabels
|
#' @param datalabels.colour colour of the datalabels
|
||||||
@ -46,7 +46,7 @@
|
|||||||
#' @param caption text to show as caption of the plot
|
#' @param caption text to show as caption of the plot
|
||||||
#' @param x.title text to show as x axis description
|
#' @param x.title text to show as x axis description
|
||||||
#' @param y.title text to show as y axis description
|
#' @param y.title text to show as y axis description
|
||||||
#' @param ... other arguments passed on to [geom_rsi()]
|
#' @param ... other arguments passed on to [geom_rsi()] or, in case of [scale_rsi_colours()], named values to set colours. The default colours are colour-blind friendly, while maintaining the convention that e.g. 'susceptible' should be green and 'resistant' should be red. See *Examples*.
|
||||||
#' @details At default, the names of antibiotics will be shown on the plots using [ab_name()]. This can be set with the `translate_ab` argument. See [count_df()].
|
#' @details At default, the names of antibiotics will be shown on the plots using [ab_name()]. This can be set with the `translate_ab` argument. See [count_df()].
|
||||||
#'
|
#'
|
||||||
#' ## The Functions
|
#' ## The Functions
|
||||||
@ -56,7 +56,7 @@
|
|||||||
#'
|
#'
|
||||||
#' [scale_y_percent()] transforms the y axis to a 0 to 100% range using [ggplot2::scale_y_continuous()].
|
#' [scale_y_percent()] transforms the y axis to a 0 to 100% range using [ggplot2::scale_y_continuous()].
|
||||||
#'
|
#'
|
||||||
#' [scale_rsi_colours()] sets colours to the bars: pastel blue for S, pastel turquoise for I and pastel red for R, using [ggplot2::scale_fill_manual()].
|
#' [scale_rsi_colours()] sets colours to the bars (green for S, yellow for I, and red for R). with multilingual support. The default colours are colour-blind friendly, while maintaining the convention that e.g. 'susceptible' should be green and 'resistant' should be red.
|
||||||
#'
|
#'
|
||||||
#' [theme_rsi()] is a [ggplot2 theme][[ggplot2::theme()] with minimal distraction.
|
#' [theme_rsi()] is a [ggplot2 theme][[ggplot2::theme()] with minimal distraction.
|
||||||
#'
|
#'
|
||||||
@ -219,11 +219,6 @@ ggplot_rsi <- function(data,
|
|||||||
theme_rsi()
|
theme_rsi()
|
||||||
|
|
||||||
if (fill == "interpretation") {
|
if (fill == "interpretation") {
|
||||||
# set RSI colours
|
|
||||||
if (isFALSE(colours) & missing(datalabels.colour)) {
|
|
||||||
# set datalabel colour to middle grey
|
|
||||||
datalabels.colour <- "grey50"
|
|
||||||
}
|
|
||||||
p <- p + scale_rsi_colours(colours = colours)
|
p <- p + scale_rsi_colours(colours = colours)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -362,28 +357,50 @@ scale_y_percent <- function(breaks = seq(0, 1, 0.1), limits = NULL) {
|
|||||||
|
|
||||||
#' @rdname ggplot_rsi
|
#' @rdname ggplot_rsi
|
||||||
#' @export
|
#' @export
|
||||||
scale_rsi_colours <- function(colours = c(S = "#3CAEA3",
|
scale_rsi_colours <- function(...,
|
||||||
SI = "#3CAEA3",
|
|
||||||
I = "#F6D55C",
|
|
||||||
IR = "#ED553B",
|
|
||||||
R = "#ED553B"),
|
|
||||||
aesthetics = "fill") {
|
aesthetics = "fill") {
|
||||||
stop_ifnot_installed("ggplot2")
|
stop_ifnot_installed("ggplot2")
|
||||||
meet_criteria(colours, allow_class = c("character", "logical"))
|
meet_criteria(aesthetics, allow_class = c("character"), has_length = c(1, 2), is_in = c("alpha", "colour", "color", "fill", "linetype", "shape", "size"))
|
||||||
meet_criteria(aesthetics, allow_class = c("character"), has_length = c(1, 2), is_in = c("colour", "color", "fill", "both"))
|
|
||||||
|
|
||||||
if (!identical(colours, FALSE)) {
|
# behaviour until AMR pkg v1.5.0 and also when coming from ggplot_rsi()
|
||||||
if ("both" %in% aesthetics) {
|
if ("colours" %in% names(list(...))) {
|
||||||
aesthetics <- c("colour", "fill")
|
|
||||||
}
|
|
||||||
original_cols <- c(S = "#3CAEA3",
|
original_cols <- c(S = "#3CAEA3",
|
||||||
SI = "#3CAEA3",
|
SI = "#3CAEA3",
|
||||||
I = "#F6D55C",
|
I = "#F6D55C",
|
||||||
IR = "#ED553B",
|
IR = "#ED553B",
|
||||||
R = "#ED553B")
|
R = "#ED553B")
|
||||||
colours <- replace(original_cols, names(colours), colours)
|
colours <- replace(original_cols, names(list(...)$colours), list(...)$colours)
|
||||||
ggplot2::scale_fill_manual(values = colours, aesthetics = aesthetics)
|
return(ggplot2::scale_fill_manual(values = colours))
|
||||||
}
|
}
|
||||||
|
if (identical(unlist(list(...)), FALSE)) {
|
||||||
|
return(invisible())
|
||||||
|
}
|
||||||
|
|
||||||
|
names_susceptible <- c("S", "SI", "IS", "S+I", "I+S", "susceptible",
|
||||||
|
unique(translations_file[which(translations_file$pattern == "susceptible"),
|
||||||
|
"replacement", drop = TRUE]))
|
||||||
|
names_incr_exposure <- c("I", "intermediate", "increased exposure", "incr. exposure",
|
||||||
|
unique(translations_file[which(translations_file$pattern == "intermediate"),
|
||||||
|
"replacement", drop = TRUE]))
|
||||||
|
names_resistant <- c("R", "IR", "RI", "R+I", "I+R", "resistant",
|
||||||
|
unique(translations_file[which(translations_file$pattern == "resistant"),
|
||||||
|
"replacement", drop = TRUE]))
|
||||||
|
|
||||||
|
susceptible <- rep("#3CAEA3", length(names_susceptible))
|
||||||
|
names(susceptible) <- names_susceptible
|
||||||
|
incr_exposure <- rep("#F6D55C", length(names_incr_exposure))
|
||||||
|
names(incr_exposure) <- names_incr_exposure
|
||||||
|
resistant <- rep("#ED553B", length(names_resistant))
|
||||||
|
names(resistant) <- names_resistant
|
||||||
|
|
||||||
|
original_cols = c(susceptible, incr_exposure, resistant)
|
||||||
|
dots <- c(...)
|
||||||
|
# replace S, I, R as colours: scale_rsi_colours(mydatavalue = "S")
|
||||||
|
dots[dots == "S"] <- "#3CAEA3"
|
||||||
|
dots[dots == "I"] <- "#F6D55C"
|
||||||
|
dots[dots == "R"] <- "#ED553B"
|
||||||
|
colours <- replace(original_cols, names(dots), dots)
|
||||||
|
ggplot2::scale_discrete_manual(aesthetics = aesthetics, values = colours)
|
||||||
}
|
}
|
||||||
|
|
||||||
#' @rdname ggplot_rsi
|
#' @rdname ggplot_rsi
|
||||||
|
55
R/plot.R
@ -50,9 +50,11 @@
|
|||||||
#' @examples
|
#' @examples
|
||||||
#' some_mic_values <- random_mic(size = 100)
|
#' some_mic_values <- random_mic(size = 100)
|
||||||
#' some_disk_values <- random_disk(size = 100, mo = "Escherichia coli", ab = "cipro")
|
#' 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_mic_values)
|
||||||
#' plot(some_disk_values)
|
#' plot(some_disk_values)
|
||||||
|
#' plot(some_rsi_values)
|
||||||
#'
|
#'
|
||||||
#' # when providing the microorganism and antibiotic, colours will show interpretations:
|
#' # when providing the microorganism and antibiotic, colours will show interpretations:
|
||||||
#' plot(some_mic_values, mo = "S. aureus", ab = "ampicillin")
|
#' plot(some_mic_values, mo = "S. aureus", ab = "ampicillin")
|
||||||
@ -61,6 +63,7 @@
|
|||||||
#' if (require("ggplot2")) {
|
#' if (require("ggplot2")) {
|
||||||
#' ggplot(some_mic_values)
|
#' ggplot(some_mic_values)
|
||||||
#' ggplot(some_disk_values, mo = "Escherichia coli", ab = "cipro")
|
#' ggplot(some_disk_values, mo = "Escherichia coli", ab = "cipro")
|
||||||
|
#' ggplot(some_rsi_values)
|
||||||
#' }
|
#' }
|
||||||
NULL
|
NULL
|
||||||
|
|
||||||
@ -229,7 +232,7 @@ ggplot.mic <- function(data,
|
|||||||
name = NULL)
|
name = NULL)
|
||||||
} else {
|
} else {
|
||||||
p <- p +
|
p <- p +
|
||||||
ggplot2::geom_col(aes(x = mic, y = count))
|
ggplot2::geom_col(ggplot2::aes(x = mic, y = count))
|
||||||
}
|
}
|
||||||
|
|
||||||
p +
|
p +
|
||||||
@ -242,7 +245,7 @@ ggplot.mic <- function(data,
|
|||||||
#' @importFrom graphics barplot axis mtext legend
|
#' @importFrom graphics barplot axis mtext legend
|
||||||
#' @rdname plot
|
#' @rdname plot
|
||||||
plot.disk <- function(x,
|
plot.disk <- function(x,
|
||||||
main = paste("Disk zones values of", deparse(substitute(x))),
|
main = paste("Disk zones of", deparse(substitute(x))),
|
||||||
ylab = "Frequency",
|
ylab = "Frequency",
|
||||||
xlab = "Disk diffusion diameter (mm)",
|
xlab = "Disk diffusion diameter (mm)",
|
||||||
mo = NULL,
|
mo = NULL,
|
||||||
@ -315,7 +318,7 @@ plot.disk <- function(x,
|
|||||||
#' @export
|
#' @export
|
||||||
#' @noRd
|
#' @noRd
|
||||||
barplot.disk <- function(height,
|
barplot.disk <- function(height,
|
||||||
main = paste("Disk zones values of", deparse(substitute(height))),
|
main = paste("Disk zones of", deparse(substitute(height))),
|
||||||
ylab = "Frequency",
|
ylab = "Frequency",
|
||||||
xlab = "Disk diffusion diameter (mm)",
|
xlab = "Disk diffusion diameter (mm)",
|
||||||
mo = NULL,
|
mo = NULL,
|
||||||
@ -350,7 +353,7 @@ barplot.disk <- function(height,
|
|||||||
# will be exported using s3_register() in R/zzz.R
|
# will be exported using s3_register() in R/zzz.R
|
||||||
ggplot.disk <- function(data,
|
ggplot.disk <- function(data,
|
||||||
mapping = NULL,
|
mapping = NULL,
|
||||||
title = paste("Disk zones values of", deparse(substitute(data))),
|
title = paste("Disk zones of", deparse(substitute(data))),
|
||||||
ylab = "Frequency",
|
ylab = "Frequency",
|
||||||
xlab = "Disk diffusion diameter (mm)",
|
xlab = "Disk diffusion diameter (mm)",
|
||||||
mo = NULL,
|
mo = NULL,
|
||||||
@ -395,7 +398,7 @@ ggplot.disk <- function(data,
|
|||||||
|
|
||||||
if (any(colours_RSI %in% cols_sub$cols)) {
|
if (any(colours_RSI %in% cols_sub$cols)) {
|
||||||
p <- p +
|
p <- p +
|
||||||
ggplot2::geom_col(aes(x = disk, y = count, fill = cols)) +
|
ggplot2::geom_col(ggplot2::aes(x = disk, y = count, fill = cols)) +
|
||||||
ggplot2::scale_fill_manual(values = c("Resistant" = colours_RSI[1],
|
ggplot2::scale_fill_manual(values = c("Resistant" = colours_RSI[1],
|
||||||
"Susceptible" = colours_RSI[2],
|
"Susceptible" = colours_RSI[2],
|
||||||
"Incr. exposure" = colours_RSI[3],
|
"Incr. exposure" = colours_RSI[3],
|
||||||
@ -403,7 +406,7 @@ ggplot.disk <- function(data,
|
|||||||
name = NULL)
|
name = NULL)
|
||||||
} else {
|
} else {
|
||||||
p <- p +
|
p <- p +
|
||||||
ggplot2::geom_col(aes(x = disk, y = count))
|
ggplot2::geom_col(ggplot2::aes(x = disk, y = count))
|
||||||
}
|
}
|
||||||
|
|
||||||
p +
|
p +
|
||||||
@ -514,7 +517,7 @@ plot.rsi <- function(x,
|
|||||||
stringsAsFactors = FALSE)
|
stringsAsFactors = FALSE)
|
||||||
}
|
}
|
||||||
|
|
||||||
data$x <- factor(data$x, levels = c("R", "S", "I"), ordered = TRUE)
|
data$x <- factor(data$x, levels = c("S", "I", "R"), ordered = TRUE)
|
||||||
|
|
||||||
ymax <- pm_if_else(max(data$s) > 95, 105, 100)
|
ymax <- pm_if_else(max(data$s) > 95, 105, 100)
|
||||||
|
|
||||||
@ -558,7 +561,7 @@ barplot.rsi <- function(height,
|
|||||||
main <- gsub(" +", " ", paste0(main, collapse = " "))
|
main <- gsub(" +", " ", paste0(main, collapse = " "))
|
||||||
|
|
||||||
x <- table(height)
|
x <- table(height)
|
||||||
x <- x[c(3, 1, 2)]
|
x <- x[c(1, 2, 3)]
|
||||||
barplot(x,
|
barplot(x,
|
||||||
col = colours_RSI,
|
col = colours_RSI,
|
||||||
xlab = xlab,
|
xlab = xlab,
|
||||||
@ -567,3 +570,39 @@ barplot.rsi <- function(height,
|
|||||||
axes = FALSE)
|
axes = FALSE)
|
||||||
axis(2, seq(0, max(x)))
|
axis(2, seq(0, max(x)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#' @method ggplot rsi
|
||||||
|
#' @rdname plot
|
||||||
|
# will be exported using s3_register() in R/zzz.R
|
||||||
|
ggplot.rsi <- function(data,
|
||||||
|
mapping = NULL,
|
||||||
|
title = paste("Resistance Overview of", deparse(substitute(data))),
|
||||||
|
xlab = "Antimicrobial Interpretation",
|
||||||
|
ylab = "Frequency",
|
||||||
|
colours_RSI = c("#ED553B", "#3CAEA3", "#F6D55C"),
|
||||||
|
...) {
|
||||||
|
stop_ifnot_installed("ggplot2")
|
||||||
|
meet_criteria(title, allow_class = "character")
|
||||||
|
meet_criteria(ylab, allow_class = "character", has_length = 1)
|
||||||
|
meet_criteria(xlab, allow_class = "character", has_length = 1)
|
||||||
|
meet_criteria(colours_RSI, allow_class = "character", has_length = c(1, 3))
|
||||||
|
if (length(colours_RSI) == 1) {
|
||||||
|
colours_RSI <- rep(colours_RSI, 3)
|
||||||
|
}
|
||||||
|
|
||||||
|
df <- as.data.frame(table(data), stringsAsFactors = TRUE)
|
||||||
|
colnames(df) <- c("rsi", "count")
|
||||||
|
if (!is.null(mapping)) {
|
||||||
|
p <- ggplot2::ggplot(df, mapping = mapping)
|
||||||
|
} else {
|
||||||
|
p <- ggplot2::ggplot(df)
|
||||||
|
}
|
||||||
|
|
||||||
|
p +
|
||||||
|
ggplot2::geom_col(ggplot2::aes(x = rsi, y = count, fill = rsi)) +
|
||||||
|
ggplot2::scale_fill_manual(values = c("R" = colours_RSI[1],
|
||||||
|
"S" = colours_RSI[2],
|
||||||
|
"I" = colours_RSI[3])) +
|
||||||
|
ggplot2::labs(title = title, x = xlab, y = ylab) +
|
||||||
|
ggplot2::theme(legend.position = "none")
|
||||||
|
}
|
||||||
|
1
R/zzz.R
@ -50,6 +50,7 @@ pkg_env$mo_failed <- character(0)
|
|||||||
s3_register("skimr::get_skimmers", "rsi")
|
s3_register("skimr::get_skimmers", "rsi")
|
||||||
s3_register("skimr::get_skimmers", "mic")
|
s3_register("skimr::get_skimmers", "mic")
|
||||||
s3_register("skimr::get_skimmers", "disk")
|
s3_register("skimr::get_skimmers", "disk")
|
||||||
|
s3_register("ggplot2::ggplot", "rsi")
|
||||||
s3_register("ggplot2::ggplot", "mic")
|
s3_register("ggplot2::ggplot", "mic")
|
||||||
s3_register("ggplot2::ggplot", "disk")
|
s3_register("ggplot2::ggplot", "disk")
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="https://msberends.github.io/AMR//index.html">AMR (for R)</a>
|
<a class="navbar-link" href="https://msberends.github.io/AMR//index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9026</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9027</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9026</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9027</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
BIN
docs/articles/AMR_files/figure-html/disk_plots-1.png
Normal file
After Width: | Height: | Size: 41 KiB |
BIN
docs/articles/AMR_files/figure-html/disk_plots_mo_ab-1.png
Normal file
After Width: | Height: | Size: 55 KiB |
BIN
docs/articles/AMR_files/figure-html/mic_plots-1.png
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
docs/articles/AMR_files/figure-html/mic_plots-2.png
Normal file
After Width: | Height: | Size: 36 KiB |
BIN
docs/articles/AMR_files/figure-html/mic_plots_mo_ab-1.png
Normal file
After Width: | Height: | Size: 41 KiB |
BIN
docs/articles/AMR_files/figure-html/mic_plots_mo_ab-2.png
Normal file
After Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 68 KiB |
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 45 KiB |
Before Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 43 KiB |
Before Width: | Height: | Size: 54 KiB |
@ -39,7 +39,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9025</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9027</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -226,19 +226,19 @@
|
|||||||
times <span class="op">=</span> <span class="fl">25</span><span class="op">)</span>
|
times <span class="op">=</span> <span class="fl">25</span><span class="op">)</span>
|
||||||
<span class="fu"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op">(</span><span class="va">S.aureus</span>, unit <span class="op">=</span> <span class="st">"ms"</span>, signif <span class="op">=</span> <span class="fl">2</span><span class="op">)</span>
|
<span class="fu"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op">(</span><span class="va">S.aureus</span>, unit <span class="op">=</span> <span class="st">"ms"</span>, signif <span class="op">=</span> <span class="fl">2</span><span class="op">)</span>
|
||||||
<span class="co"># Unit: milliseconds</span>
|
<span class="co"># Unit: milliseconds</span>
|
||||||
<span class="co"># expr min lq mean median uq max neval</span>
|
<span class="co"># expr min lq mean median uq max neval</span>
|
||||||
<span class="co"># as.mo("sau") 10 11.0 15 11.0 13.0 47 25</span>
|
<span class="co"># as.mo("sau") 9.9 11.0 13.0 11.0 12.0 43 25</span>
|
||||||
<span class="co"># as.mo("stau") 56 57.0 75 62.0 95.0 100 25</span>
|
<span class="co"># as.mo("stau") 52.0 55.0 68.0 58.0 86.0 95 25</span>
|
||||||
<span class="co"># as.mo("STAU") 54 56.0 67 58.0 66.0 110 25</span>
|
<span class="co"># as.mo("STAU") 53.0 56.0 73.0 62.0 93.0 100 25</span>
|
||||||
<span class="co"># as.mo("staaur") 10 11.0 12 11.0 12.0 13 25</span>
|
<span class="co"># as.mo("staaur") 10.0 11.0 17.0 11.0 12.0 48 25</span>
|
||||||
<span class="co"># as.mo("STAAUR") 10 11.0 16 11.0 12.0 50 25</span>
|
<span class="co"># as.mo("STAAUR") 10.0 11.0 14.0 11.0 13.0 48 25</span>
|
||||||
<span class="co"># as.mo("S. aureus") 28 31.0 46 33.0 65.0 71 25</span>
|
<span class="co"># as.mo("S. aureus") 27.0 28.0 41.0 33.0 60.0 73 25</span>
|
||||||
<span class="co"># as.mo("S aureus") 29 30.0 42 33.0 64.0 67 25</span>
|
<span class="co"># as.mo("S aureus") 27.0 28.0 49.0 34.0 64.0 160 25</span>
|
||||||
<span class="co"># as.mo("Staphylococcus aureus") 3 3.2 5 3.3 3.7 40 25</span>
|
<span class="co"># as.mo("Staphylococcus aureus") 2.9 3.2 4.8 3.4 3.7 36 25</span>
|
||||||
<span class="co"># as.mo("Staphylococcus aureus (MRSA)") 240 260.0 270 270.0 280.0 290 25</span>
|
<span class="co"># as.mo("Staphylococcus aureus (MRSA)") 250.0 260.0 270.0 270.0 280.0 320 25</span>
|
||||||
<span class="co"># as.mo("Sthafilokkockus aaureuz") 170 200.0 210 200.0 210.0 280 25</span>
|
<span class="co"># as.mo("Sthafilokkockus aaureuz") 170.0 200.0 210.0 210.0 210.0 310 25</span>
|
||||||
<span class="co"># as.mo("MRSA") 10 11.0 17 11.0 13.0 51 25</span>
|
<span class="co"># as.mo("MRSA") 10.0 11.0 16.0 12.0 12.0 50 25</span>
|
||||||
<span class="co"># as.mo("VISA") 19 20.0 36 21.0 50.0 150 25</span></code></pre></div>
|
<span class="co"># as.mo("VISA") 19.0 20.0 27.0 21.0 23.0 60 25</span></code></pre></div>
|
||||||
<p><img src="benchmarks_files/figure-html/unnamed-chunk-4-1.png" width="750"></p>
|
<p><img src="benchmarks_files/figure-html/unnamed-chunk-4-1.png" width="750"></p>
|
||||||
<p>In the table above, all measurements are shown in milliseconds (thousands of seconds). A value of 5 milliseconds means it can determine 200 input values per second. It case of 200 milliseconds, this is only 5 input values per second. It is clear that accepted taxonomic names are extremely fast, but some variations are up to 200 times slower to determine.</p>
|
<p>In the table above, all measurements are shown in milliseconds (thousands of seconds). A value of 5 milliseconds means it can determine 200 input values per second. It case of 200 milliseconds, this is only 5 input values per second. It is clear that accepted taxonomic names are extremely fast, but some variations are up to 200 times slower to determine.</p>
|
||||||
<p>To improve performance, we implemented two important algorithms to save unnecessary calculations: <strong>repetitive results</strong> and <strong>already precalculated results</strong>.</p>
|
<p>To improve performance, we implemented two important algorithms to save unnecessary calculations: <strong>repetitive results</strong> and <strong>already precalculated results</strong>.</p>
|
||||||
@ -260,8 +260,8 @@
|
|||||||
<span class="co"># what do these values look like? They are of class <mo>:</span>
|
<span class="co"># what do these values look like? They are of class <mo>:</span>
|
||||||
<span class="fu"><a href="https://rdrr.io/r/utils/head.html">head</a></span><span class="op">(</span><span class="va">x</span><span class="op">)</span>
|
<span class="fu"><a href="https://rdrr.io/r/utils/head.html">head</a></span><span class="op">(</span><span class="va">x</span><span class="op">)</span>
|
||||||
<span class="co"># Class <mo></span>
|
<span class="co"># Class <mo></span>
|
||||||
<span class="co"># [1] B_ESCHR_COLI B_PROTS_MRBL B_PROTS_MRBL B_PROTS_MRBL B_STPHY_CONS</span>
|
<span class="co"># [1] B_STRPT_PYGN B_STPHY_HMNS B_STPHY_CONS B_STRPT_SLVR B_ENTRBC_CLOC</span>
|
||||||
<span class="co"># [6] B_ENTRC</span>
|
<span class="co"># [6] B_STPHY_CONS</span>
|
||||||
|
|
||||||
<span class="co"># as the example_isolates data set has 2,000 rows, we should have 2 million items</span>
|
<span class="co"># as the example_isolates data set has 2,000 rows, we should have 2 million items</span>
|
||||||
<span class="fu"><a href="https://rdrr.io/r/base/length.html">length</a></span><span class="op">(</span><span class="va">x</span><span class="op">)</span>
|
<span class="fu"><a href="https://rdrr.io/r/base/length.html">length</a></span><span class="op">(</span><span class="va">x</span><span class="op">)</span>
|
||||||
@ -277,8 +277,8 @@
|
|||||||
<span class="fu"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op">(</span><span class="va">run_it</span>, unit <span class="op">=</span> <span class="st">"ms"</span>, signif <span class="op">=</span> <span class="fl">3</span><span class="op">)</span>
|
<span class="fu"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op">(</span><span class="va">run_it</span>, unit <span class="op">=</span> <span class="st">"ms"</span>, signif <span class="op">=</span> <span class="fl">3</span><span class="op">)</span>
|
||||||
<span class="co"># Unit: milliseconds</span>
|
<span class="co"># Unit: milliseconds</span>
|
||||||
<span class="co"># expr min lq mean median uq max neval</span>
|
<span class="co"># expr min lq mean median uq max neval</span>
|
||||||
<span class="co"># mo_name(x) 160 189 224 201 228 356 10</span></code></pre></div>
|
<span class="co"># mo_name(x) 161 194 224 204 229 368 10</span></code></pre></div>
|
||||||
<p>So getting official taxonomic names of 2,000,000 (!!) items consisting of 90 unique values only takes 0.201 seconds. That is 101 nanoseconds on average. You only lose time on your unique input values.</p>
|
<p>So getting official taxonomic names of 2,000,000 (!!) items consisting of 90 unique values only takes 0.204 seconds. That is 102 nanoseconds on average. You only lose time on your unique input values.</p>
|
||||||
</div>
|
</div>
|
||||||
<div id="precalculated-results" class="section level3">
|
<div id="precalculated-results" class="section level3">
|
||||||
<h3 class="hasAnchor">
|
<h3 class="hasAnchor">
|
||||||
@ -291,10 +291,10 @@
|
|||||||
times <span class="op">=</span> <span class="fl">10</span><span class="op">)</span>
|
times <span class="op">=</span> <span class="fl">10</span><span class="op">)</span>
|
||||||
<span class="fu"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op">(</span><span class="va">run_it</span>, unit <span class="op">=</span> <span class="st">"ms"</span>, signif <span class="op">=</span> <span class="fl">3</span><span class="op">)</span>
|
<span class="fu"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op">(</span><span class="va">run_it</span>, unit <span class="op">=</span> <span class="st">"ms"</span>, signif <span class="op">=</span> <span class="fl">3</span><span class="op">)</span>
|
||||||
<span class="co"># Unit: milliseconds</span>
|
<span class="co"># Unit: milliseconds</span>
|
||||||
<span class="co"># expr min lq mean median uq max neval</span>
|
<span class="co"># expr min lq mean median uq max neval</span>
|
||||||
<span class="co"># A 6.80 7.17 7.46 7.54 7.81 8.0 10</span>
|
<span class="co"># A 7.45 7.84 12.70 8.62 9.16 51.10 10</span>
|
||||||
<span class="co"># B 24.30 25.80 31.60 26.20 28.80 75.6 10</span>
|
<span class="co"># B 23.80 24.50 30.60 26.30 28.80 70.20 10</span>
|
||||||
<span class="co"># C 1.59 1.70 1.89 1.84 2.02 2.5 10</span></code></pre></div>
|
<span class="co"># C 1.66 1.74 1.85 1.79 1.92 2.24 10</span></code></pre></div>
|
||||||
<p>So going from <code><a href="../reference/mo_property.html">mo_name("Staphylococcus aureus")</a></code> to <code>"Staphylococcus aureus"</code> takes 0.0018 seconds - it doesn’t even start calculating <em>if the result would be the same as the expected resulting value</em>. That goes for all helper functions:</p>
|
<p>So going from <code><a href="../reference/mo_property.html">mo_name("Staphylococcus aureus")</a></code> to <code>"Staphylococcus aureus"</code> takes 0.0018 seconds - it doesn’t even start calculating <em>if the result would be the same as the expected resulting value</em>. That goes for all helper functions:</p>
|
||||||
<div class="sourceCode" id="cb5"><pre class="downlit sourceCode r">
|
<div class="sourceCode" id="cb5"><pre class="downlit sourceCode r">
|
||||||
<code class="sourceCode R"><span class="va">run_it</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/pkg/microbenchmark/man/microbenchmark.html">microbenchmark</a></span><span class="op">(</span>A <span class="op">=</span> <span class="fu"><a href="../reference/mo_property.html">mo_species</a></span><span class="op">(</span><span class="st">"aureus"</span><span class="op">)</span>,
|
<code class="sourceCode R"><span class="va">run_it</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/pkg/microbenchmark/man/microbenchmark.html">microbenchmark</a></span><span class="op">(</span>A <span class="op">=</span> <span class="fu"><a href="../reference/mo_property.html">mo_species</a></span><span class="op">(</span><span class="st">"aureus"</span><span class="op">)</span>,
|
||||||
@ -309,14 +309,14 @@
|
|||||||
<span class="fu"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op">(</span><span class="va">run_it</span>, unit <span class="op">=</span> <span class="st">"ms"</span>, signif <span class="op">=</span> <span class="fl">3</span><span class="op">)</span>
|
<span class="fu"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op">(</span><span class="va">run_it</span>, unit <span class="op">=</span> <span class="st">"ms"</span>, signif <span class="op">=</span> <span class="fl">3</span><span class="op">)</span>
|
||||||
<span class="co"># Unit: milliseconds</span>
|
<span class="co"># Unit: milliseconds</span>
|
||||||
<span class="co"># expr min lq mean median uq max neval</span>
|
<span class="co"># expr min lq mean median uq max neval</span>
|
||||||
<span class="co"># A 1.25 1.28 1.39 1.39 1.50 1.56 10</span>
|
<span class="co"># A 1.59 1.60 1.91 1.97 2.15 2.28 10</span>
|
||||||
<span class="co"># B 1.17 1.19 1.41 1.43 1.48 1.92 10</span>
|
<span class="co"># B 1.58 1.61 1.87 1.86 1.96 2.39 10</span>
|
||||||
<span class="co"># C 1.20 1.33 1.43 1.46 1.50 1.61 10</span>
|
<span class="co"># C 1.55 1.57 1.64 1.63 1.69 1.79 10</span>
|
||||||
<span class="co"># D 1.43 1.45 1.50 1.49 1.53 1.61 10</span>
|
<span class="co"># D 1.57 1.60 1.83 1.72 1.92 2.73 10</span>
|
||||||
<span class="co"># E 1.26 1.40 1.45 1.43 1.49 1.81 10</span>
|
<span class="co"># E 1.50 1.74 1.86 1.86 2.03 2.24 10</span>
|
||||||
<span class="co"># F 1.15 1.17 1.32 1.26 1.44 1.69 10</span>
|
<span class="co"># F 1.49 1.55 1.75 1.67 1.90 2.24 10</span>
|
||||||
<span class="co"># G 1.19 1.25 1.37 1.35 1.47 1.58 10</span>
|
<span class="co"># G 1.54 1.59 1.69 1.65 1.77 1.95 10</span>
|
||||||
<span class="co"># H 1.20 1.25 1.46 1.31 1.53 2.33 10</span></code></pre></div>
|
<span class="co"># H 1.57 1.58 1.75 1.72 1.78 2.21 10</span></code></pre></div>
|
||||||
<p>Of course, when running <code><a href="../reference/mo_property.html">mo_phylum("Firmicutes")</a></code> the function has zero knowledge about the actual microorganism, namely <em>S. aureus</em>. But since the result would be <code>"Firmicutes"</code> anyway, there is no point in calculating the result. And because this package contains all phyla of all known bacteria, it can just return the initial value immediately.</p>
|
<p>Of course, when running <code><a href="../reference/mo_property.html">mo_phylum("Firmicutes")</a></code> the function has zero knowledge about the actual microorganism, namely <em>S. aureus</em>. But since the result would be <code>"Firmicutes"</code> anyway, there is no point in calculating the result. And because this package contains all phyla of all known bacteria, it can just return the initial value immediately.</p>
|
||||||
</div>
|
</div>
|
||||||
<div id="results-in-other-languages" class="section level3">
|
<div id="results-in-other-languages" class="section level3">
|
||||||
@ -343,14 +343,14 @@
|
|||||||
times <span class="op">=</span> <span class="fl">100</span><span class="op">)</span>
|
times <span class="op">=</span> <span class="fl">100</span><span class="op">)</span>
|
||||||
<span class="fu"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op">(</span><span class="va">run_it</span>, unit <span class="op">=</span> <span class="st">"ms"</span>, signif <span class="op">=</span> <span class="fl">4</span><span class="op">)</span>
|
<span class="fu"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op">(</span><span class="va">run_it</span>, unit <span class="op">=</span> <span class="st">"ms"</span>, signif <span class="op">=</span> <span class="fl">4</span><span class="op">)</span>
|
||||||
<span class="co"># Unit: milliseconds</span>
|
<span class="co"># Unit: milliseconds</span>
|
||||||
<span class="co"># expr min lq mean median uq max neval</span>
|
<span class="co"># expr min lq mean median uq max neval</span>
|
||||||
<span class="co"># en 17.05 17.38 21.26 17.74 18.50 97.23 100</span>
|
<span class="co"># en 17.33 18.21 21.97 19.06 20.40 68.32 100</span>
|
||||||
<span class="co"># de 19.90 20.33 24.80 20.67 21.06 93.34 100</span>
|
<span class="co"># de 20.44 21.37 30.49 22.33 24.97 78.42 100</span>
|
||||||
<span class="co"># nl 24.86 25.30 31.21 25.65 26.34 102.20 100</span>
|
<span class="co"># nl 25.13 26.10 31.91 27.11 28.50 86.00 100</span>
|
||||||
<span class="co"># es 19.83 20.22 26.56 20.49 21.20 97.59 100</span>
|
<span class="co"># es 20.28 21.16 26.37 22.03 23.67 74.74 100</span>
|
||||||
<span class="co"># it 19.79 20.20 26.82 20.63 21.31 94.85 100</span>
|
<span class="co"># it 20.06 21.00 26.05 21.95 23.42 94.16 100</span>
|
||||||
<span class="co"># fr 19.61 19.87 24.26 20.21 20.68 92.42 100</span>
|
<span class="co"># fr 19.90 20.63 24.40 21.85 22.82 69.07 100</span>
|
||||||
<span class="co"># pt 19.64 20.06 23.78 20.40 21.05 92.91 100</span></code></pre></div>
|
<span class="co"># pt 20.22 21.03 25.63 21.89 23.24 76.63 100</span></code></pre></div>
|
||||||
<p>Currently supported non-English languages are German, Dutch, Spanish, Italian, French and Portuguese.</p>
|
<p>Currently supported non-English languages are German, Dutch, Spanish, Italian, French and Portuguese.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 81 KiB |
@ -81,7 +81,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9026</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9027</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9026</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9027</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -207,10 +207,11 @@ div[id^=last-updated] h2 {
|
|||||||
.table thead th {
|
.table thead th {
|
||||||
text-align: inherit;
|
text-align: inherit;
|
||||||
}
|
}
|
||||||
.table a:not(.btn) {
|
/* all tables, including argument lists */
|
||||||
|
table a:not(.btn) {
|
||||||
text-decoration: inherit;
|
text-decoration: inherit;
|
||||||
}
|
}
|
||||||
.table a:not(.btn):hover {
|
table a:not(.btn):hover {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9026</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9027</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9026</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9027</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -236,13 +236,13 @@
|
|||||||
<small>Source: <a href='https://github.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small>
|
<small>Source: <a href='https://github.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="amr-1509026" class="section level1">
|
<div id="amr-1509027" class="section level1">
|
||||||
<h1 class="page-header" data-toc-text="1.5.0.9026">
|
<h1 class="page-header" data-toc-text="1.5.0.9027">
|
||||||
<a href="#amr-1509026" class="anchor"></a>AMR 1.5.0.9026<small> Unreleased </small>
|
<a href="#amr-1509027" class="anchor"></a>AMR 1.5.0.9027<small> Unreleased </small>
|
||||||
</h1>
|
</h1>
|
||||||
<div id="last-updated-25-february-2021" class="section level2">
|
<div id="last-updated-26-february-2021" class="section level2">
|
||||||
<h2 class="hasAnchor">
|
<h2 class="hasAnchor">
|
||||||
<a href="#last-updated-25-february-2021" class="anchor"></a><small>Last updated: 25 February 2021</small>
|
<a href="#last-updated-26-february-2021" class="anchor"></a><small>Last updated: 26 February 2021</small>
|
||||||
</h2>
|
</h2>
|
||||||
<div id="new" class="section level3">
|
<div id="new" class="section level3">
|
||||||
<h3 class="hasAnchor">
|
<h3 class="hasAnchor">
|
||||||
|
@ -12,7 +12,7 @@ articles:
|
|||||||
datasets: datasets.html
|
datasets: datasets.html
|
||||||
resistance_predict: resistance_predict.html
|
resistance_predict: resistance_predict.html
|
||||||
welcome_to_AMR: welcome_to_AMR.html
|
welcome_to_AMR: welcome_to_AMR.html
|
||||||
last_built: 2021-02-25T11:30Z
|
last_built: 2021-02-26T11:10Z
|
||||||
urls:
|
urls:
|
||||||
reference: https://msberends.github.io/AMR//reference
|
reference: https://msberends.github.io/AMR//reference
|
||||||
article: https://msberends.github.io/AMR//articles
|
article: https://msberends.github.io/AMR//articles
|
||||||
|
@ -82,7 +82,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9025</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9027</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9026</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9027</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -285,11 +285,7 @@
|
|||||||
|
|
||||||
<span class='fu'>scale_y_percent</span><span class='op'>(</span>breaks <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/seq.html'>seq</a></span><span class='op'>(</span><span class='fl'>0</span>, <span class='fl'>1</span>, <span class='fl'>0.1</span><span class='op'>)</span>, limits <span class='op'>=</span> <span class='cn'>NULL</span><span class='op'>)</span>
|
<span class='fu'>scale_y_percent</span><span class='op'>(</span>breaks <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/seq.html'>seq</a></span><span class='op'>(</span><span class='fl'>0</span>, <span class='fl'>1</span>, <span class='fl'>0.1</span><span class='op'>)</span>, limits <span class='op'>=</span> <span class='cn'>NULL</span><span class='op'>)</span>
|
||||||
|
|
||||||
<span class='fu'>scale_rsi_colours</span><span class='op'>(</span>
|
<span class='fu'>scale_rsi_colours</span><span class='op'>(</span><span class='va'>...</span>, aesthetics <span class='op'>=</span> <span class='st'>"fill"</span><span class='op'>)</span>
|
||||||
colours <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span>S <span class='op'>=</span> <span class='st'>"#3CAEA3"</span>, SI <span class='op'>=</span> <span class='st'>"#3CAEA3"</span>, I <span class='op'>=</span> <span class='st'>"#F6D55C"</span>, IR <span class='op'>=</span> <span class='st'>"#ED553B"</span>, R <span class='op'>=</span>
|
|
||||||
<span class='st'>"#ED553B"</span><span class='op'>)</span>,
|
|
||||||
aesthetics <span class='op'>=</span> <span class='st'>"fill"</span>
|
|
||||||
<span class='op'>)</span>
|
|
||||||
|
|
||||||
<span class='fu'>theme_rsi</span><span class='op'>(</span><span class='op'>)</span>
|
<span class='fu'>theme_rsi</span><span class='op'>(</span><span class='op'>)</span>
|
||||||
|
|
||||||
@ -362,7 +358,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>colours</th>
|
<th>colours</th>
|
||||||
<td><p>a named vector with colours for the bars. The names must be one or more of: S, SI, I, IR, R or be <code>FALSE</code> for standard <a href='https://ggplot2.tidyverse.org/reference/ggplot.html'>ggplot2</a> colours. The default colours are colour-blind friendly, while maintaining the convention that e.g. 'susceptible' should be green and 'resistant' should be red.</p></td>
|
<td><p>a named vactor with colour to be used for filling. The default colours are colour-blind friendly.</p></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>datalabels</th>
|
<th>datalabels</th>
|
||||||
@ -398,11 +394,11 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>...</th>
|
<th>...</th>
|
||||||
<td><p>other arguments passed on to <code>geom_rsi()</code></p></td>
|
<td><p>other arguments passed on to <code>geom_rsi()</code> or, in case of <code>scale_rsi_colours()</code>, named values to set colours. The default colours are colour-blind friendly, while maintaining the convention that e.g. 'susceptible' should be green and 'resistant' should be red. See <em>Examples</em>.</p></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>aesthetics</th>
|
<th>aesthetics</th>
|
||||||
<td><p>aesthetics to apply the colours to, defaults to "fill" but can also be "colour" or "both"</p></td>
|
<td><p>aesthetics to apply the colours to, defaults to "fill" but can also be (a combination of) "alpha", "colour", "fill", "linetype", "shape" or "size"</p></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
@ -414,7 +410,7 @@
|
|||||||
<p><code>geom_rsi()</code> will take any variable from the data that has an <code><a href='as.rsi.html'>rsi</a></code> class (created with <code><a href='as.rsi.html'>as.rsi()</a></code>) using <code><a href='proportion.html'>rsi_df()</a></code> and will plot bars with the percentage R, I and S. The default behaviour is to have the bars stacked and to have the different antibiotics on the x axis.</p>
|
<p><code>geom_rsi()</code> will take any variable from the data that has an <code><a href='as.rsi.html'>rsi</a></code> class (created with <code><a href='as.rsi.html'>as.rsi()</a></code>) using <code><a href='proportion.html'>rsi_df()</a></code> and will plot bars with the percentage R, I and S. The default behaviour is to have the bars stacked and to have the different antibiotics on the x axis.</p>
|
||||||
<p><code>facet_rsi()</code> creates 2d plots (at default based on S/I/R) using <code><a href='https://ggplot2.tidyverse.org/reference/facet_wrap.html'>ggplot2::facet_wrap()</a></code>.</p>
|
<p><code>facet_rsi()</code> creates 2d plots (at default based on S/I/R) using <code><a href='https://ggplot2.tidyverse.org/reference/facet_wrap.html'>ggplot2::facet_wrap()</a></code>.</p>
|
||||||
<p><code>scale_y_percent()</code> transforms the y axis to a 0 to 100% range using <code><a href='https://ggplot2.tidyverse.org/reference/scale_continuous.html'>ggplot2::scale_y_continuous()</a></code>.</p>
|
<p><code>scale_y_percent()</code> transforms the y axis to a 0 to 100% range using <code><a href='https://ggplot2.tidyverse.org/reference/scale_continuous.html'>ggplot2::scale_y_continuous()</a></code>.</p>
|
||||||
<p><code>scale_rsi_colours()</code> sets colours to the bars: pastel blue for S, pastel turquoise for I and pastel red for R, using <code><a href='https://ggplot2.tidyverse.org/reference/scale_manual.html'>ggplot2::scale_fill_manual()</a></code>.</p>
|
<p><code>scale_rsi_colours()</code> sets colours to the bars (green for S, yellow for I, and red for R). with multilingual support. The default colours are colour-blind friendly, while maintaining the convention that e.g. 'susceptible' should be green and 'resistant' should be red.</p>
|
||||||
<p><code>theme_rsi()</code> is a [ggplot2 theme][<code><a href='https://ggplot2.tidyverse.org/reference/theme.html'>ggplot2::theme()</a></code> with minimal distraction.</p>
|
<p><code>theme_rsi()</code> is a [ggplot2 theme][<code><a href='https://ggplot2.tidyverse.org/reference/theme.html'>ggplot2::theme()</a></code> with minimal distraction.</p>
|
||||||
<p><code>labels_rsi_count()</code> print datalabels on the bars with percentage and amount of isolates using <code><a href='https://ggplot2.tidyverse.org/reference/geom_text.html'>ggplot2::geom_text()</a></code>.</p>
|
<p><code>labels_rsi_count()</code> print datalabels on the bars with percentage and amount of isolates using <code><a href='https://ggplot2.tidyverse.org/reference/geom_text.html'>ggplot2::geom_text()</a></code>.</p>
|
||||||
<p><code>ggplot_rsi()</code> is a wrapper around all above functions that uses data as first input. This makes it possible to use this function after a pipe (<code>%>%</code>). See <em>Examples</em>.</p>
|
<p><code>ggplot_rsi()</code> is a wrapper around all above functions that uses data as first input. This makes it possible to use this function after a pipe (<code>%>%</code>). See <em>Examples</em>.</p>
|
||||||
|
@ -81,7 +81,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9026</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9027</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -453,7 +453,7 @@
|
|||||||
</tr><tr>
|
</tr><tr>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<p><code><a href="plot.html">plot(<i><mic></i>)</a></code> <code><a href="plot.html">ggplot(<i><mic></i>)</a></code> <code><a href="plot.html">plot(<i><disk></i>)</a></code> <code><a href="plot.html">ggplot(<i><disk></i>)</a></code> <code><a href="plot.html">plot(<i><rsi></i>)</a></code> </p>
|
<p><code><a href="plot.html">plot(<i><mic></i>)</a></code> <code><a href="plot.html">ggplot(<i><mic></i>)</a></code> <code><a href="plot.html">plot(<i><disk></i>)</a></code> <code><a href="plot.html">ggplot(<i><disk></i>)</a></code> <code><a href="plot.html">plot(<i><rsi></i>)</a></code> <code><a href="plot.html">ggplot(<i><rsi></i>)</a></code> </p>
|
||||||
</td>
|
</td>
|
||||||
<td><p>Plotting for Classes <code>rsi</code>, <code>mic</code> and <code>disk</code></p></td>
|
<td><p>Plotting for Classes <code>rsi</code>, <code>mic</code> and <code>disk</code></p></td>
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
|
@ -82,7 +82,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9025</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9027</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9026</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9027</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -274,7 +274,7 @@
|
|||||||
<span class='co'># S3 method for disk</span>
|
<span class='co'># S3 method for disk</span>
|
||||||
<span class='fu'>plot</span><span class='op'>(</span>
|
<span class='fu'>plot</span><span class='op'>(</span>
|
||||||
<span class='va'>x</span>,
|
<span class='va'>x</span>,
|
||||||
main <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/paste.html'>paste</a></span><span class='op'>(</span><span class='st'>"Disk zones values of"</span>, <span class='fu'><a href='https://rdrr.io/r/base/deparse.html'>deparse</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/substitute.html'>substitute</a></span><span class='op'>(</span><span class='va'>x</span><span class='op'>)</span><span class='op'>)</span><span class='op'>)</span>,
|
main <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/paste.html'>paste</a></span><span class='op'>(</span><span class='st'>"Disk zones of"</span>, <span class='fu'><a href='https://rdrr.io/r/base/deparse.html'>deparse</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/substitute.html'>substitute</a></span><span class='op'>(</span><span class='va'>x</span><span class='op'>)</span><span class='op'>)</span><span class='op'>)</span>,
|
||||||
ylab <span class='op'>=</span> <span class='st'>"Frequency"</span>,
|
ylab <span class='op'>=</span> <span class='st'>"Frequency"</span>,
|
||||||
xlab <span class='op'>=</span> <span class='st'>"Disk diffusion diameter (mm)"</span>,
|
xlab <span class='op'>=</span> <span class='st'>"Disk diffusion diameter (mm)"</span>,
|
||||||
mo <span class='op'>=</span> <span class='cn'>NULL</span>,
|
mo <span class='op'>=</span> <span class='cn'>NULL</span>,
|
||||||
@ -289,7 +289,7 @@
|
|||||||
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/ggplot.html'>ggplot</a></span><span class='op'>(</span>
|
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/ggplot.html'>ggplot</a></span><span class='op'>(</span>
|
||||||
<span class='va'>data</span>,
|
<span class='va'>data</span>,
|
||||||
mapping <span class='op'>=</span> <span class='cn'>NULL</span>,
|
mapping <span class='op'>=</span> <span class='cn'>NULL</span>,
|
||||||
title <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/paste.html'>paste</a></span><span class='op'>(</span><span class='st'>"Disk zones values of"</span>, <span class='fu'><a href='https://rdrr.io/r/base/deparse.html'>deparse</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/substitute.html'>substitute</a></span><span class='op'>(</span><span class='va'>data</span><span class='op'>)</span><span class='op'>)</span><span class='op'>)</span>,
|
title <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/paste.html'>paste</a></span><span class='op'>(</span><span class='st'>"Disk zones of"</span>, <span class='fu'><a href='https://rdrr.io/r/base/deparse.html'>deparse</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/substitute.html'>substitute</a></span><span class='op'>(</span><span class='va'>data</span><span class='op'>)</span><span class='op'>)</span><span class='op'>)</span>,
|
||||||
ylab <span class='op'>=</span> <span class='st'>"Frequency"</span>,
|
ylab <span class='op'>=</span> <span class='st'>"Frequency"</span>,
|
||||||
xlab <span class='op'>=</span> <span class='st'>"Disk diffusion diameter (mm)"</span>,
|
xlab <span class='op'>=</span> <span class='st'>"Disk diffusion diameter (mm)"</span>,
|
||||||
mo <span class='op'>=</span> <span class='cn'>NULL</span>,
|
mo <span class='op'>=</span> <span class='cn'>NULL</span>,
|
||||||
@ -307,6 +307,17 @@
|
|||||||
xlab <span class='op'>=</span> <span class='st'>"Antimicrobial Interpretation"</span>,
|
xlab <span class='op'>=</span> <span class='st'>"Antimicrobial Interpretation"</span>,
|
||||||
main <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/paste.html'>paste</a></span><span class='op'>(</span><span class='st'>"Resistance Overview of"</span>, <span class='fu'><a href='https://rdrr.io/r/base/deparse.html'>deparse</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/substitute.html'>substitute</a></span><span class='op'>(</span><span class='va'>x</span><span class='op'>)</span><span class='op'>)</span><span class='op'>)</span>,
|
main <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/paste.html'>paste</a></span><span class='op'>(</span><span class='st'>"Resistance Overview of"</span>, <span class='fu'><a href='https://rdrr.io/r/base/deparse.html'>deparse</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/substitute.html'>substitute</a></span><span class='op'>(</span><span class='va'>x</span><span class='op'>)</span><span class='op'>)</span><span class='op'>)</span>,
|
||||||
<span class='va'>...</span>
|
<span class='va'>...</span>
|
||||||
|
<span class='op'>)</span>
|
||||||
|
|
||||||
|
<span class='co'># S3 method for rsi</span>
|
||||||
|
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/ggplot.html'>ggplot</a></span><span class='op'>(</span>
|
||||||
|
<span class='va'>data</span>,
|
||||||
|
mapping <span class='op'>=</span> <span class='cn'>NULL</span>,
|
||||||
|
title <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/paste.html'>paste</a></span><span class='op'>(</span><span class='st'>"Resistance Overview of"</span>, <span class='fu'><a href='https://rdrr.io/r/base/deparse.html'>deparse</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/substitute.html'>substitute</a></span><span class='op'>(</span><span class='va'>data</span><span class='op'>)</span><span class='op'>)</span><span class='op'>)</span>,
|
||||||
|
xlab <span class='op'>=</span> <span class='st'>"Antimicrobial Interpretation"</span>,
|
||||||
|
ylab <span class='op'>=</span> <span class='st'>"Frequency"</span>,
|
||||||
|
colours_RSI <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span><span class='st'>"#ED553B"</span>, <span class='st'>"#3CAEA3"</span>, <span class='st'>"#F6D55C"</span><span class='op'>)</span>,
|
||||||
|
<span class='va'>...</span>
|
||||||
<span class='op'>)</span></pre>
|
<span class='op'>)</span></pre>
|
||||||
|
|
||||||
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
|
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
|
||||||
@ -378,9 +389,11 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
|
|||||||
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
||||||
<pre class="examples"><span class='va'>some_mic_values</span> <span class='op'><-</span> <span class='fu'><a href='random.html'>random_mic</a></span><span class='op'>(</span>size <span class='op'>=</span> <span class='fl'>100</span><span class='op'>)</span>
|
<pre class="examples"><span class='va'>some_mic_values</span> <span class='op'><-</span> <span class='fu'><a href='random.html'>random_mic</a></span><span class='op'>(</span>size <span class='op'>=</span> <span class='fl'>100</span><span class='op'>)</span>
|
||||||
<span class='va'>some_disk_values</span> <span class='op'><-</span> <span class='fu'><a href='random.html'>random_disk</a></span><span class='op'>(</span>size <span class='op'>=</span> <span class='fl'>100</span>, mo <span class='op'>=</span> <span class='st'>"Escherichia coli"</span>, ab <span class='op'>=</span> <span class='st'>"cipro"</span><span class='op'>)</span>
|
<span class='va'>some_disk_values</span> <span class='op'><-</span> <span class='fu'><a href='random.html'>random_disk</a></span><span class='op'>(</span>size <span class='op'>=</span> <span class='fl'>100</span>, mo <span class='op'>=</span> <span class='st'>"Escherichia coli"</span>, ab <span class='op'>=</span> <span class='st'>"cipro"</span><span class='op'>)</span>
|
||||||
|
<span class='va'>some_rsi_values</span> <span class='op'><-</span> <span class='fu'><a href='random.html'>random_rsi</a></span><span class='op'>(</span><span class='fl'>50</span>, prob_RSI <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span><span class='fl'>0.30</span>, <span class='fl'>0.55</span>, <span class='fl'>0.05</span><span class='op'>)</span><span class='op'>)</span>
|
||||||
|
|
||||||
<span class='fu'>plot</span><span class='op'>(</span><span class='va'>some_mic_values</span><span class='op'>)</span>
|
<span class='fu'>plot</span><span class='op'>(</span><span class='va'>some_mic_values</span><span class='op'>)</span>
|
||||||
<span class='fu'>plot</span><span class='op'>(</span><span class='va'>some_disk_values</span><span class='op'>)</span>
|
<span class='fu'>plot</span><span class='op'>(</span><span class='va'>some_disk_values</span><span class='op'>)</span>
|
||||||
|
<span class='fu'>plot</span><span class='op'>(</span><span class='va'>some_rsi_values</span><span class='op'>)</span>
|
||||||
|
|
||||||
<span class='co'># when providing the microorganism and antibiotic, colours will show interpretations:</span>
|
<span class='co'># when providing the microorganism and antibiotic, colours will show interpretations:</span>
|
||||||
<span class='fu'>plot</span><span class='op'>(</span><span class='va'>some_mic_values</span>, mo <span class='op'>=</span> <span class='st'>"S. aureus"</span>, ab <span class='op'>=</span> <span class='st'>"ampicillin"</span><span class='op'>)</span>
|
<span class='fu'>plot</span><span class='op'>(</span><span class='va'>some_mic_values</span>, mo <span class='op'>=</span> <span class='st'>"S. aureus"</span>, ab <span class='op'>=</span> <span class='st'>"ampicillin"</span><span class='op'>)</span>
|
||||||
@ -389,6 +402,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
|
|||||||
<span class='kw'>if</span> <span class='op'>(</span><span class='kw'><a href='https://rdrr.io/r/base/library.html'>require</a></span><span class='op'>(</span><span class='st'><a href='http://ggplot2.tidyverse.org'>"ggplot2"</a></span><span class='op'>)</span><span class='op'>)</span> <span class='op'>{</span>
|
<span class='kw'>if</span> <span class='op'>(</span><span class='kw'><a href='https://rdrr.io/r/base/library.html'>require</a></span><span class='op'>(</span><span class='st'><a href='http://ggplot2.tidyverse.org'>"ggplot2"</a></span><span class='op'>)</span><span class='op'>)</span> <span class='op'>{</span>
|
||||||
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/ggplot.html'>ggplot</a></span><span class='op'>(</span><span class='va'>some_mic_values</span><span class='op'>)</span>
|
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/ggplot.html'>ggplot</a></span><span class='op'>(</span><span class='va'>some_mic_values</span><span class='op'>)</span>
|
||||||
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/ggplot.html'>ggplot</a></span><span class='op'>(</span><span class='va'>some_disk_values</span>, mo <span class='op'>=</span> <span class='st'>"Escherichia coli"</span>, ab <span class='op'>=</span> <span class='st'>"cipro"</span><span class='op'>)</span>
|
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/ggplot.html'>ggplot</a></span><span class='op'>(</span><span class='va'>some_disk_values</span>, mo <span class='op'>=</span> <span class='st'>"Escherichia coli"</span>, ab <span class='op'>=</span> <span class='st'>"cipro"</span><span class='op'>)</span>
|
||||||
|
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/ggplot.html'>ggplot</a></span><span class='op'>(</span><span class='va'>some_rsi_values</span><span class='op'>)</span>
|
||||||
<span class='op'>}</span>
|
<span class='op'>}</span>
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
@ -82,7 +82,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9025</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9027</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9026</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9027</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -53,11 +53,7 @@ facet_rsi(facet = c("interpretation", "antibiotic"), nrow = NULL)
|
|||||||
|
|
||||||
scale_y_percent(breaks = seq(0, 1, 0.1), limits = NULL)
|
scale_y_percent(breaks = seq(0, 1, 0.1), limits = NULL)
|
||||||
|
|
||||||
scale_rsi_colours(
|
scale_rsi_colours(..., aesthetics = "fill")
|
||||||
colours = c(S = "#3CAEA3", SI = "#3CAEA3", I = "#F6D55C", IR = "#ED553B", R =
|
|
||||||
"#ED553B"),
|
|
||||||
aesthetics = "fill"
|
|
||||||
)
|
|
||||||
|
|
||||||
theme_rsi()
|
theme_rsi()
|
||||||
|
|
||||||
@ -100,7 +96,7 @@ labels_rsi_count(
|
|||||||
|
|
||||||
\item{nrow}{(when using \code{facet}) number of rows}
|
\item{nrow}{(when using \code{facet}) number of rows}
|
||||||
|
|
||||||
\item{colours}{a named vector with colours for the bars. The names must be one or more of: S, SI, I, IR, R or be \code{FALSE} for standard \link[ggplot2:ggplot]{ggplot2} colours. The default colours are colour-blind friendly, while maintaining the convention that e.g. 'susceptible' should be green and 'resistant' should be red.}
|
\item{colours}{a named vactor with colour to be used for filling. The default colours are colour-blind friendly.}
|
||||||
|
|
||||||
\item{datalabels}{show datalabels using \code{\link[=labels_rsi_count]{labels_rsi_count()}}}
|
\item{datalabels}{show datalabels using \code{\link[=labels_rsi_count]{labels_rsi_count()}}}
|
||||||
|
|
||||||
@ -118,9 +114,9 @@ labels_rsi_count(
|
|||||||
|
|
||||||
\item{y.title}{text to show as y axis description}
|
\item{y.title}{text to show as y axis description}
|
||||||
|
|
||||||
\item{...}{other arguments passed on to \code{\link[=geom_rsi]{geom_rsi()}}}
|
\item{...}{other arguments passed on to \code{\link[=geom_rsi]{geom_rsi()}} or, in case of \code{\link[=scale_rsi_colours]{scale_rsi_colours()}}, named values to set colours. The default colours are colour-blind friendly, while maintaining the convention that e.g. 'susceptible' should be green and 'resistant' should be red. See \emph{Examples}.}
|
||||||
|
|
||||||
\item{aesthetics}{aesthetics to apply the colours to, defaults to "fill" but can also be "colour" or "both"}
|
\item{aesthetics}{aesthetics to apply the colours to, defaults to "fill" but can also be (a combination of) "alpha", "colour", "fill", "linetype", "shape" or "size"}
|
||||||
}
|
}
|
||||||
\description{
|
\description{
|
||||||
Use these functions to create bar plots for AMR data analysis. All functions rely on \link[ggplot2:ggplot]{ggplot2} functions.
|
Use these functions to create bar plots for AMR data analysis. All functions rely on \link[ggplot2:ggplot]{ggplot2} functions.
|
||||||
@ -135,7 +131,7 @@ At default, the names of antibiotics will be shown on the plots using \code{\lin
|
|||||||
|
|
||||||
\code{\link[=scale_y_percent]{scale_y_percent()}} transforms the y axis to a 0 to 100\% range using \code{\link[ggplot2:scale_continuous]{ggplot2::scale_y_continuous()}}.
|
\code{\link[=scale_y_percent]{scale_y_percent()}} transforms the y axis to a 0 to 100\% range using \code{\link[ggplot2:scale_continuous]{ggplot2::scale_y_continuous()}}.
|
||||||
|
|
||||||
\code{\link[=scale_rsi_colours]{scale_rsi_colours()}} sets colours to the bars: pastel blue for S, pastel turquoise for I and pastel red for R, using \code{\link[ggplot2:scale_manual]{ggplot2::scale_fill_manual()}}.
|
\code{\link[=scale_rsi_colours]{scale_rsi_colours()}} sets colours to the bars (green for S, yellow for I, and red for R). with multilingual support. The default colours are colour-blind friendly, while maintaining the convention that e.g. 'susceptible' should be green and 'resistant' should be red.
|
||||||
|
|
||||||
\code{\link[=theme_rsi]{theme_rsi()}} is a [ggplot2 theme][\code{\link[ggplot2:theme]{ggplot2::theme()}} with minimal distraction.
|
\code{\link[=theme_rsi]{theme_rsi()}} is a [ggplot2 theme][\code{\link[ggplot2:theme]{ggplot2::theme()}} with minimal distraction.
|
||||||
|
|
||||||
|
18
man/plot.Rd
@ -7,6 +7,7 @@
|
|||||||
\alias{plot.disk}
|
\alias{plot.disk}
|
||||||
\alias{ggplot.disk}
|
\alias{ggplot.disk}
|
||||||
\alias{plot.rsi}
|
\alias{plot.rsi}
|
||||||
|
\alias{ggplot.rsi}
|
||||||
\title{Plotting for Classes \code{rsi}, \code{mic} and \code{disk}}
|
\title{Plotting for Classes \code{rsi}, \code{mic} and \code{disk}}
|
||||||
\usage{
|
\usage{
|
||||||
\method{plot}{mic}(
|
\method{plot}{mic}(
|
||||||
@ -38,7 +39,7 @@
|
|||||||
|
|
||||||
\method{plot}{disk}(
|
\method{plot}{disk}(
|
||||||
x,
|
x,
|
||||||
main = paste("Disk zones values of", deparse(substitute(x))),
|
main = paste("Disk zones of", deparse(substitute(x))),
|
||||||
ylab = "Frequency",
|
ylab = "Frequency",
|
||||||
xlab = "Disk diffusion diameter (mm)",
|
xlab = "Disk diffusion diameter (mm)",
|
||||||
mo = NULL,
|
mo = NULL,
|
||||||
@ -52,7 +53,7 @@
|
|||||||
\method{ggplot}{disk}(
|
\method{ggplot}{disk}(
|
||||||
data,
|
data,
|
||||||
mapping = NULL,
|
mapping = NULL,
|
||||||
title = paste("Disk zones values of", deparse(substitute(data))),
|
title = paste("Disk zones of", deparse(substitute(data))),
|
||||||
ylab = "Frequency",
|
ylab = "Frequency",
|
||||||
xlab = "Disk diffusion diameter (mm)",
|
xlab = "Disk diffusion diameter (mm)",
|
||||||
mo = NULL,
|
mo = NULL,
|
||||||
@ -70,6 +71,16 @@
|
|||||||
main = paste("Resistance Overview of", deparse(substitute(x))),
|
main = paste("Resistance Overview of", deparse(substitute(x))),
|
||||||
...
|
...
|
||||||
)
|
)
|
||||||
|
|
||||||
|
\method{ggplot}{rsi}(
|
||||||
|
data,
|
||||||
|
mapping = NULL,
|
||||||
|
title = paste("Resistance Overview of", deparse(substitute(data))),
|
||||||
|
xlab = "Antimicrobial Interpretation",
|
||||||
|
ylab = "Frequency",
|
||||||
|
colours_RSI = c("#ED553B", "#3CAEA3", "#F6D55C"),
|
||||||
|
...
|
||||||
|
)
|
||||||
}
|
}
|
||||||
\arguments{
|
\arguments{
|
||||||
\item{x, data}{MIC values created with \code{\link[=as.mic]{as.mic()}} or disk diffusion values created with \code{\link[=as.disk]{as.disk()}}}
|
\item{x, data}{MIC values created with \code{\link[=as.mic]{as.mic()}} or disk diffusion values created with \code{\link[=as.disk]{as.disk()}}}
|
||||||
@ -121,9 +132,11 @@ On our website \url{https://msberends.github.io/AMR/} you can find \href{https:/
|
|||||||
\examples{
|
\examples{
|
||||||
some_mic_values <- random_mic(size = 100)
|
some_mic_values <- random_mic(size = 100)
|
||||||
some_disk_values <- random_disk(size = 100, mo = "Escherichia coli", ab = "cipro")
|
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_mic_values)
|
||||||
plot(some_disk_values)
|
plot(some_disk_values)
|
||||||
|
plot(some_rsi_values)
|
||||||
|
|
||||||
# when providing the microorganism and antibiotic, colours will show interpretations:
|
# when providing the microorganism and antibiotic, colours will show interpretations:
|
||||||
plot(some_mic_values, mo = "S. aureus", ab = "ampicillin")
|
plot(some_mic_values, mo = "S. aureus", ab = "ampicillin")
|
||||||
@ -132,5 +145,6 @@ plot(some_disk_values, mo = "Escherichia coli", ab = "cipro")
|
|||||||
if (require("ggplot2")) {
|
if (require("ggplot2")) {
|
||||||
ggplot(some_mic_values)
|
ggplot(some_mic_values)
|
||||||
ggplot(some_disk_values, mo = "Escherichia coli", ab = "cipro")
|
ggplot(some_disk_values, mo = "Escherichia coli", ab = "cipro")
|
||||||
|
ggplot(some_rsi_values)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -207,10 +207,11 @@ div[id^=last-updated] h2 {
|
|||||||
.table thead th {
|
.table thead th {
|
||||||
text-align: inherit;
|
text-align: inherit;
|
||||||
}
|
}
|
||||||
.table a:not(.btn) {
|
/* all tables, including argument lists */
|
||||||
|
table a:not(.btn) {
|
||||||
text-decoration: inherit;
|
text-decoration: inherit;
|
||||||
}
|
}
|
||||||
.table a:not(.btn):hover {
|
table a:not(.btn):hover {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,6 +42,7 @@ test_that("rsi works", {
|
|||||||
pdf(NULL) # prevent Rplots.pdf being created
|
pdf(NULL) # prevent Rplots.pdf being created
|
||||||
expect_silent(barplot(as.rsi(c("S", "I", "R"))))
|
expect_silent(barplot(as.rsi(c("S", "I", "R"))))
|
||||||
expect_silent(plot(as.rsi(c("S", "I", "R"))))
|
expect_silent(plot(as.rsi(c("S", "I", "R"))))
|
||||||
|
if (require("ggplot2")) expect_s3_class(ggplot(as.rsi(c("S", "I", "R"))), "gg")
|
||||||
expect_output(print(as.rsi(c("S", "I", "R"))))
|
expect_output(print(as.rsi(c("S", "I", "R"))))
|
||||||
|
|
||||||
expect_equal(as.character(as.rsi(c(1:3))), c("S", "I", "R"))
|
expect_equal(as.character(as.rsi(c(1:3))), c("S", "I", "R"))
|
||||||
|
@ -510,7 +510,7 @@ mic_values <- random_mic(size = 100)
|
|||||||
mic_values
|
mic_values
|
||||||
```
|
```
|
||||||
|
|
||||||
```{r}
|
```{r mic_plots}
|
||||||
# base R:
|
# base R:
|
||||||
plot(mic_values)
|
plot(mic_values)
|
||||||
# ggplot2:
|
# ggplot2:
|
||||||
@ -520,39 +520,36 @@ ggplot(mic_values)
|
|||||||
But we could also be more specific, by generating MICs that are likely to be found in *E. coli* for ciprofloxacin:
|
But we could also be more specific, by generating MICs that are likely to be found in *E. coli* for ciprofloxacin:
|
||||||
|
|
||||||
```{r, results = 'markup', message = FALSE, warning = FALSE}
|
```{r, results = 'markup', message = FALSE, warning = FALSE}
|
||||||
# this will generate MICs that are likely to be found in E. coli for ciprofloxacin:
|
mic_values <- random_mic(size = 100, mo = "E. coli", ab = "cipro")
|
||||||
mic_values_specific <- random_mic(size = 100, mo = "E. coli", ab = "cipro")
|
|
||||||
```
|
```
|
||||||
|
|
||||||
For the `plot()` and `ggplot()` function, we can define the microorganism and an antimicrobial agent the same way. This will add the interpretation of those values according to a chosen guidelines (defaults to the latest EUCAST guideline).
|
For the `plot()` and `ggplot()` function, we can define the microorganism and an antimicrobial agent the same way. This will add the interpretation of those values according to a chosen guidelines (defaults to the latest EUCAST guideline).
|
||||||
|
|
||||||
Default colours are colour-blind friendly, while maintaining the convention that e.g. 'susceptible' should be green and 'resistant' should be red:
|
Default colours are colour-blind friendly, while maintaining the convention that e.g. 'susceptible' should be green and 'resistant' should be red:
|
||||||
|
|
||||||
```{r, message = FALSE, warning = FALSE}
|
```{r mic_plots_mo_ab, message = FALSE, warning = FALSE}
|
||||||
# base R:
|
# base R:
|
||||||
plot(mic_values_specific, mo = "E. coli", ab = "cipro")
|
plot(mic_values, mo = "E. coli", ab = "cipro")
|
||||||
# ggplot2:
|
# ggplot2:
|
||||||
ggplot(mic_values_specific, mo = "E. coli", ab = "cipro")
|
ggplot(mic_values, mo = "E. coli", ab = "cipro")
|
||||||
```
|
```
|
||||||
|
|
||||||
For disk diffusion values, there is not much of a difference in plotting:
|
For disk diffusion values, there is not much of a difference in plotting:
|
||||||
|
|
||||||
```{r, results = 'markup'}
|
```{r, results = 'markup'}
|
||||||
# this will generate disks that are likely to be found in E. coli for ciprofloxacin:
|
disk_values <- random_disk(size = 100, mo = "E. coli", ab = "cipro")
|
||||||
disk_values_specific <- random_disk(size = 100, mo = "E. coli", ab = "cipro")
|
disk_values
|
||||||
disk_values_specific
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```{r, message = FALSE, warning = FALSE}
|
```{r disk_plots, message = FALSE, warning = FALSE}
|
||||||
# base R:
|
# base R:
|
||||||
plot(disk_values_specific, mo = "E. coli", ab = "cipro")
|
plot(disk_values, mo = "E. coli", ab = "cipro")
|
||||||
```
|
```
|
||||||
|
|
||||||
And when using the `ggplot2` package, but now choosing the latest implemented CLSI guideline (notice that the EUCAST-specific term "Incr. exposure" has changed to "Intermediate"):
|
And when using the `ggplot2` package, but now choosing the latest implemented CLSI guideline (notice that the EUCAST-specific term "Incr. exposure" has changed to "Intermediate"):
|
||||||
|
|
||||||
```{r, message = FALSE, warning = FALSE}
|
```{r disk_plots_mo_ab, message = FALSE, warning = FALSE}
|
||||||
# and ggplot2, but now choosing an old CLSI guideline:
|
ggplot(disk_values,
|
||||||
ggplot(disk_values_specific,
|
|
||||||
mo = "E. coli",
|
mo = "E. coli",
|
||||||
ab = "cipro",
|
ab = "cipro",
|
||||||
guideline = "CLSI")
|
guideline = "CLSI")
|
||||||
|