mirror of
https://github.com/msberends/AMR.git
synced 2025-07-09 06:51:48 +02:00
added vignette of freq
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
context("eucast.R")
|
||||
|
||||
test_that("EUCAST rules work", {
|
||||
a <- EUCAST_rules(septic_patients)
|
||||
a <- suppressWarnings(EUCAST_rules(septic_patients))
|
||||
|
||||
a <- data.frame(bactid = c("KLEPNE", # Klebsiella pneumoniae
|
||||
"PSEAER", # Pseudomonas aeruginosa
|
||||
|
@ -1,12 +1,12 @@
|
||||
context("freq.R")
|
||||
|
||||
test_that("frequency table works", {
|
||||
expect_equal(nrow(freq(c(1, 1, 2, 2, 3, 3, 4, 4, 5, 5), toConsole = FALSE)), 5)
|
||||
expect_equal(nrow(frequency_tbl(c(1, 1, 2, 2, 3, 3, 4, 4, 5, 5), toConsole = FALSE)), 5)
|
||||
expect_equal(nrow(freq(c(1, 1, 2, 2, 3, 3, 4, 4, 5, 5), as.data.frame = TRUE)), 5)
|
||||
expect_equal(nrow(frequency_tbl(c(1, 1, 2, 2, 3, 3, 4, 4, 5, 5), as.data.frame = TRUE)), 5)
|
||||
|
||||
# date column of septic_patients should contain 1662 unique dates
|
||||
expect_equal(nrow(freq(septic_patients$date, toConsole = FALSE)), 1662)
|
||||
expect_equal(nrow(freq(septic_patients$date, toConsole = FALSE)),
|
||||
expect_equal(nrow(freq(septic_patients$date, as.data.frame = TRUE)), 1662)
|
||||
expect_equal(nrow(freq(septic_patients$date, as.data.frame = TRUE)),
|
||||
length(unique(septic_patients$date)))
|
||||
|
||||
expect_output(freq(septic_patients$age))
|
||||
|
@ -13,7 +13,7 @@ test_that("MDRO works", {
|
||||
expect_equal(outcome %>% class(), c('ordered', 'factor'))
|
||||
|
||||
# septic_patients should have these finding using Dutch guidelines
|
||||
expect_equal(outcome %>% freq(toConsole = FALSE) %>% pull(Count), c(3, 21))
|
||||
expect_equal(outcome %>% freq(as.data.frame = TRUE) %>% pull(count), c(3, 21))
|
||||
|
||||
expect_equal(BRMO(septic_patients, info = FALSE), MDRO(septic_patients, "nl", info = FALSE))
|
||||
|
||||
|
Reference in New Issue
Block a user