1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-08 14:01:55 +02:00

geom_rsi - any parameter

This commit is contained in:
2018-08-23 21:27:15 +02:00
parent eee122825c
commit febd0ca885
9 changed files with 72 additions and 39 deletions

View File

@ -6,10 +6,18 @@ test_that("as.bactid works", {
c("ESCCOL", "HAEINF"))
expect_equal(as.character(as.bactid("Escherichia coli")), "ESCCOL")
expect_equal(as.character(as.bactid("Escherichia coli")), "ESCCOL")
expect_equal(as.character(as.bactid("Escherichia species")), "ESC")
expect_equal(as.character(as.bactid(" ESCCOL ")), "ESCCOL")
expect_equal(as.character(as.bactid("klpn")), "KLEPNE")
expect_equal(as.character(as.bactid("P. aer")), "PSEAER") # not Pasteurella aerogenes
expect_equal(as.character(as.bactid("Negative rods")), "GNR")
# GLIMS
expect_equal(as.character(as.bactid("shiboy")), "SHIBOY")
expect_equal(as.character(as.bactid("MRSE")), "STAEPI")
expect_equal(as.character(as.bactid("VRE")), "ENC")
expect_equal(as.character(as.bactid("MRPA")), "PSEAER")

View File

@ -85,4 +85,11 @@ test_that("first isolates work", {
info = TRUE),
na.rm = TRUE),
1501)
expect_message(septic_patients %>%
mutate(specimen = "test") %>%
mutate(first = first_isolate(., "date", "patient_id",
col_bactid = "bactid", col_specimen = "specimen",
filter_specimen = "something_unexisting")))
expect_error(first_isolate("date", "patient_id", col_bactid = "bactid"))
})

View File

@ -9,6 +9,15 @@ test_that("frequency table works", {
expect_equal(nrow(freq(septic_patients$date)),
length(unique(septic_patients$date)))
expect_output(print(freq(septic_patients$age, nmax = Inf)))
expect_output(print(freq(septic_patients$age, nmax = NA)))
expect_output(print(freq(septic_patients$age, nmax = NULL)))
expect_output(print(freq(septic_patients$age, sort.count = FALSE)))
expect_output(print(freq(septic_patients$age, markdown = TRUE)))
expect_output(print(freq(septic_patients$age, markdown = TRUE), markdown = FALSE))
expect_output(print(freq(septic_patients$age, markdown = TRUE), markdown = TRUE))
expect_output(print(freq(septic_patients$age[0])))
# character
expect_output(print(freq(septic_patients$bactid)))
# integer
@ -21,6 +30,8 @@ test_that("frequency table works", {
expect_output(print(freq(table(septic_patients$sex, septic_patients$age))))
# rsi
expect_output(print(freq(septic_patients$amcl)))
# hms
expect_output(print(freq(hms::as.hms(sample(c(0:86399), 50)))))
library(dplyr)
expect_output(septic_patients %>% select(1:2) %>% freq() %>% print())