mirror of
https://github.com/msberends/AMR.git
synced 2026-11-16 03:40:48 +01:00
(v3.0.1.9137) Add the guideline argument to count_df(), proportion_df(), sir_df(), ggplot_sir(), geom_sir(), and labels_sir_count(), so that with CLSI the 'I' category is merged with R, and describe in the documentation of get_AMR_locale() that LANG takes precedence over LANGUAGE
This commit is contained in:
1 parent
46f5de1d36
commit
dbd95ffa46
17 files changed
+118
-40
No files matched your search
@@ -89,14 +89,28 @@ test_that("test-count.R", {
|
||||
c(946, 428, 94)
|
||||
)
|
||||
|
||||
# count_df, which always combines S and I, as with EUCAST
|
||||
# count_df, which combines 'I' with S for EUCAST and with R for CLSI
|
||||
expect_equal(
|
||||
example_isolates %>% select(AMX) %>% count_df() %>% pull(value),
|
||||
example_isolates %>% select(AMX) %>% count_df(guideline = "EUCAST") %>% pull(value),
|
||||
c(
|
||||
example_isolates$AMX %>% count_susceptible(guideline = "EUCAST"),
|
||||
example_isolates$AMX %>% count_resistant(guideline = "EUCAST")
|
||||
)
|
||||
)
|
||||
expect_equal(
|
||||
example_isolates %>% select(AMX) %>% count_df(guideline = "CLSI") %>% pull(value),
|
||||
c(
|
||||
example_isolates$AMX %>% count_susceptible(guideline = "CLSI"),
|
||||
example_isolates$AMX %>% count_resistant(guideline = "CLSI")
|
||||
)
|
||||
)
|
||||
expect_identical(
|
||||
levels(count_df(example_isolates[, "AMX"], guideline = "CLSI")$interpretation),
|
||||
c("S", "IR")
|
||||
)
|
||||
old_opts <- options(AMR_guideline = "CLSI")
|
||||
expect_identical(count_df(example_isolates[, "AMX"]), count_df(example_isolates[, "AMX"], guideline = "CLSI"))
|
||||
options(old_opts)
|
||||
expect_equal(
|
||||
example_isolates %>% select(AMX) %>% count_df(combine_SI = FALSE) %>% pull(value),
|
||||
c(
|
||||
|
||||
@@ -96,6 +96,12 @@ test_that("test-ggplot_sir.R", {
|
||||
as.double()
|
||||
)
|
||||
|
||||
# the 'I' category is merged with R for CLSI
|
||||
expect_identical(
|
||||
levels(ggplot_sir(example_isolates[, c("AMC", "CIP")], guideline = "CLSI")$layers[[1]]$data(example_isolates[, c("AMC", "CIP")])$interpretation),
|
||||
c("S", "IR")
|
||||
)
|
||||
|
||||
# support for scale_type ab and mo
|
||||
expect_inherits(
|
||||
(data.frame(
|
||||
|
||||
@@ -99,14 +99,28 @@ test_that("test-proportion.R", {
|
||||
c(1181, 577, 116)
|
||||
)
|
||||
|
||||
# proportion_df
|
||||
# proportion_df, which combines 'I' with S for EUCAST and with R for CLSI
|
||||
expect_equal(
|
||||
example_isolates %>% select(AMX) %>% proportion_df() %>% pull(value),
|
||||
example_isolates %>% select(AMX) %>% proportion_df(guideline = "EUCAST") %>% pull(value),
|
||||
c(
|
||||
example_isolates$AMX %>% proportion_SI(),
|
||||
example_isolates$AMX %>% proportion_R()
|
||||
)
|
||||
)
|
||||
expect_equal(
|
||||
example_isolates %>% select(AMX) %>% proportion_df(guideline = "CLSI") %>% pull(value),
|
||||
c(
|
||||
example_isolates$AMX %>% proportion_S(),
|
||||
example_isolates$AMX %>% proportion_IR()
|
||||
)
|
||||
)
|
||||
expect_equal(
|
||||
example_isolates %>% select(AMX) %>% sir_df(guideline = "CLSI") %>% pull(isolates),
|
||||
c(
|
||||
example_isolates$AMX %>% count_S(),
|
||||
example_isolates$AMX %>% count_IR()
|
||||
)
|
||||
)
|
||||
expect_equal(
|
||||
example_isolates %>% select(AMX) %>% proportion_df(combine_SI = FALSE) %>% pull(value),
|
||||
c(
|
||||
|
||||
Reference in new issue
Block a user