1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-18 11:33:18 +02:00

unit test read.4d, unselecting freq cols

This commit is contained in:
2018-11-19 13:00:22 +01:00
parent 83c7da85ab
commit a8132922af
7 changed files with 127 additions and 22 deletions

View File

@ -11,6 +11,8 @@ test_that("frequency table works", {
expect_equal(nrow(freq(septic_patients$date)),
length(unique(septic_patients$date)))
expect_output(print(septic_patients %>% freq(age)))
expect_output(print(septic_patients %>% freq(age, nmax = 5)))
expect_output(print(septic_patients %>% freq(age, nmax = Inf)))
expect_output(print(freq(septic_patients$age, nmax = Inf)))
expect_output(print(freq(septic_patients$age, nmax = NA)))
@ -123,6 +125,12 @@ test_that("frequency table works", {
expect_error(septic_patients %>% freq(peni, oxac, clox, amox, amcl,
ampi, pita, czol, cfep, cfur))
# (un)select columns
expect_equal(septic_patients %>% freq(hospital_id) %>% select(item) %>% ncol(),
1)
expect_equal(septic_patients %>% freq(hospital_id) %>% select(-item) %>% ncol(),
4)
# run diff
expect_output(print(
diff(freq(septic_patients$amcl),