1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-10 15:41:49 +02:00

(v2.1.1.9131) implement testthat

This commit is contained in:
2025-01-27 21:43:10 +01:00
parent 92166c16e8
commit f03933940c
63 changed files with 172 additions and 267 deletions

View File

@ -244,7 +244,7 @@ ggplot_pca <- function(x,
g <- g + ggplot2::geom_path(
data = ell,
ggplot2::aes(colour = groups, group = groups),
size = ellipse_size,
linewidth = ellipse_size,
alpha = points_alpha
)
}

View File

@ -211,8 +211,7 @@ ggplot_sir <- function(data,
meet_criteria(caption, allow_class = "character", has_length = 1, allow_NULL = TRUE)
meet_criteria(x.title, allow_class = "character", has_length = 1, allow_NULL = TRUE)
meet_criteria(y.title, allow_class = "character", has_length = 1, allow_NULL = TRUE)
# we work with aes_string later on
x_deparse <- deparse(substitute(x))
if (x_deparse != "x") {
x <- x_deparse
@ -309,8 +308,7 @@ geom_sir <- function(position = NULL,
if (identical(position, "fill")) {
position <- ggplot2::position_fill(vjust = 0.5, reverse = TRUE)
}
# we work with aes_string later on
x_deparse <- deparse(substitute(x))
if (x_deparse != "x") {
x <- x_deparse
@ -324,7 +322,7 @@ geom_sir <- function(position = NULL,
} else if (tolower(x) %in% tolower(c("SIR", "sir", "interpretations", "result"))) {
x <- "interpretation"
}
ggplot2::geom_col(
data = function(x) {
sir_df(
@ -335,7 +333,7 @@ geom_sir <- function(position = NULL,
combine_SI = combine_SI
)
},
mapping = ggplot2::aes_string(x = x, y = y, fill = fill),
mapping = utils::modifyList(ggplot2::aes(), list(x = str2lang(x), y = str2lang(y), fill = str2lang(fill))),
position = position,
...
)

View File

@ -956,7 +956,6 @@ facet_sir <- function(facet = c("interpretation", "antibiotic"), nrow = NULL) {
meet_criteria(facet, allow_class = "character", has_length = 1)
meet_criteria(nrow, allow_class = c("numeric", "integer"), has_length = 1, allow_NULL = TRUE, is_positive = TRUE, is_finite = TRUE)
# we work with aes_string later on
facet_deparse <- deparse(substitute(facet))
if (facet_deparse != "facet") {
facet <- facet_deparse
@ -1107,13 +1106,10 @@ labels_sir_count <- function(position = NULL,
if (identical(position, "fill")) {
position <- ggplot2::position_fill(vjust = 0.5, reverse = TRUE)
}
x_name <- x
ggplot2::geom_text(
mapping = ggplot2::aes_string(
label = "lbl",
x = x,
y = "value"
),
mapping = utils::modifyList(ggplot2::aes(), list(label = str2lang("lbl"), x = str2lang(x), y = str2lang("value"))),
position = position,
inherit.aes = FALSE,
size = datalabels.size,