mirror of
https://github.com/msberends/AMR.git
synced 2025-09-15 15:09:41 +02:00
@@ -96,6 +96,14 @@ test_that("test-ab.R", {
|
||||
rep("GEH", 8)
|
||||
)
|
||||
|
||||
# skimr
|
||||
if (AMR:::pkg_is_available("skimr", min_version = "2.0.0", also_load = TRUE)) {
|
||||
expect_named(
|
||||
skim(clinical_breakpoints$ab),
|
||||
c("skim_type", "skim_variable", "n_missing", "complete_rate", "ab.n_unique", "ab.top_ab", "ab.top_ab_name", "ab.top_group")
|
||||
)
|
||||
}
|
||||
|
||||
# assigning and subsetting
|
||||
x <- AMR::antimicrobials$ab
|
||||
expect_inherits(x[1], "ab")
|
||||
|
@@ -60,4 +60,12 @@ test_that("test-disk.R", {
|
||||
if (AMR:::pkg_is_available("tibble")) {
|
||||
expect_output(print(tibble::tibble(d = as.disk(12))))
|
||||
}
|
||||
|
||||
# skimr
|
||||
if (AMR:::pkg_is_available("skimr", min_version = "2.0.0", also_load = TRUE)) {
|
||||
expect_named(
|
||||
skim(random_disk(100)),
|
||||
c("skim_type", "skim_variable", "n_missing", "complete_rate", "disk.p0", "disk.p25", "disk.p50", "disk.p75", "disk.p100", "disk.hist")
|
||||
)
|
||||
}
|
||||
})
|
||||
|
@@ -81,6 +81,14 @@ test_that("test-mic.R", {
|
||||
expect_output(print(tibble::tibble(m = as.mic(2:4))))
|
||||
}
|
||||
|
||||
# skimr
|
||||
if (AMR:::pkg_is_available("skimr", min_version = "2.0.0", also_load = TRUE)) {
|
||||
expect_named(
|
||||
skim(random_mic(100)),
|
||||
c("skim_type", "skim_variable", "n_missing", "complete_rate", "mic.p0", "mic.p25", "mic.p50", "mic.p75", "mic.p100", "mic.hist")
|
||||
)
|
||||
}
|
||||
|
||||
# all mathematical operations
|
||||
x <- random_mic(50)
|
||||
x_double <- as.double(gsub("[<=>]+", "", as.character(x)))
|
||||
|
@@ -321,4 +321,12 @@ test_that("test-mo.R", {
|
||||
if (AMR:::pkg_is_available("cleaner")) {
|
||||
expect_inherits(cleaner::freq(example_isolates$mo), "freq")
|
||||
}
|
||||
|
||||
# skimr
|
||||
if (AMR:::pkg_is_available("skimr", min_version = "2.0.0", also_load = TRUE)) {
|
||||
expect_named(
|
||||
skim(example_isolates$mo),
|
||||
c("skim_type", "skim_variable", "n_missing", "complete_rate", "mo.n_unique", "mo.gram_negative", "mo.gram_positive", "mo.yeast", "mo.top_genus", "mo.top_species")
|
||||
)
|
||||
}
|
||||
})
|
||||
|
@@ -103,22 +103,13 @@ test_that("test-sir.R", {
|
||||
pull(MEM) %>%
|
||||
is.sir())
|
||||
}
|
||||
|
||||
# skimr
|
||||
if (AMR:::pkg_is_available("skimr", min_version = "2.0.0", also_load = TRUE)) {
|
||||
expect_inherits(
|
||||
skim(example_isolates),
|
||||
"data.frame"
|
||||
expect_named(
|
||||
skim(example_isolates$PEN),
|
||||
c("skim_type", "skim_variable", "n_missing", "complete_rate", "sir.count_S", "sir.count_I", "sir.count_R", "sir.prop_S", "sir.prop_I", "sir.prop_R", "sir.hist")
|
||||
)
|
||||
if (AMR:::pkg_is_available("dplyr", min_version = "1.0.0", also_load = TRUE)) {
|
||||
expect_inherits(
|
||||
example_isolates %>%
|
||||
mutate(
|
||||
m = as.mic(2),
|
||||
d = as.disk(20)
|
||||
) %>%
|
||||
skim(),
|
||||
"data.frame"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
expect_equal(as.sir(c("", "-", NA, "NULL")), c(NA_sir_, NA_sir_, NA_sir_, NA_sir_))
|
||||
|
Reference in New Issue
Block a user