1
0
mirror of https://github.com/msberends/AMR.git synced 2025-12-15 09:10:25 +01:00

(v0.7.1.9005) new rsi calculations, atc class removal

This commit is contained in:
2019-07-01 14:03:15 +02:00
parent 65c6702b21
commit 156d550895
78 changed files with 1169 additions and 911 deletions

View File

@@ -32,14 +32,14 @@ test_that("portions works", {
expect_equal(portion_S(septic_patients$AMX) + portion_I(septic_patients$AMX),
portion_SI(septic_patients$AMX))
expect_equal(septic_patients %>% portion_S(AMC),
0.7142097,
expect_equal(septic_patients %>% portion_SI(AMC),
0.7626397,
tolerance = 0.0001)
expect_equal(septic_patients %>% portion_S(AMC, GEN),
0.9232481,
expect_equal(septic_patients %>% portion_SI(AMC, GEN),
0.9408,
tolerance = 0.0001)
expect_equal(septic_patients %>% portion_S(AMC, GEN, also_single_tested = TRUE),
0.926045,
expect_equal(septic_patients %>% portion_SI(AMC, GEN, only_all_tested = TRUE),
0.9382647,
tolerance = 0.0001)
# percentages
@@ -57,14 +57,14 @@ test_that("portions works", {
# count of cases
expect_equal(septic_patients %>%
group_by(hospital_id) %>%
summarise(CIPo_p = portion_S(CIP, as_percent = TRUE),
CIPo_n = n_rsi(CIP),
GENa_p = portion_S(GEN, as_percent = TRUE),
GENa_n = n_rsi(GEN),
combination_p = portion_S(CIP, GEN, as_percent = TRUE),
summarise(cipro_p = portion_SI(CIP, as_percent = TRUE),
cipro_n = n_rsi(CIP),
genta_p = portion_SI(GEN, as_percent = TRUE),
genta_n = n_rsi(GEN),
combination_p = portion_SI(CIP, GEN, as_percent = TRUE),
combination_n = n_rsi(CIP, GEN)) %>%
pull(combination_n),
c(202, 488, 201, 499))
c(305, 617, 241, 711))
expect_warning(portion_R(as.character(septic_patients$AMC)))
expect_warning(portion_S(as.character(septic_patients$AMC)))
@@ -83,7 +83,7 @@ test_that("portions works", {
expect_error(portion_I("test", as_percent = "test"))
expect_error(portion_S("test", minimum = "test"))
expect_error(portion_S("test", as_percent = "test"))
expect_error(portion_S("test", also_single_tested = "test"))
expect_error(portion_S("test", also_single_tested = TRUE))
# check too low amount of isolates
expect_identical(suppressWarnings(portion_R(septic_patients$AMX, minimum = nrow(septic_patients) + 1)),