mirror of
https://github.com/msberends/AMR.git
synced 2025-07-08 21:22:01 +02:00
(v0.6.1.9044) first_isolate fix for species
This commit is contained in:
@ -26,6 +26,12 @@ test_that("age works", {
|
||||
reference = "2019-01-01"),
|
||||
c(39, 34, 29))
|
||||
|
||||
expect_equal(age(x = c("2019-01-01", "2019-04-01", "2019-07-01"),
|
||||
reference = "2019-09-01",
|
||||
exact = TRUE),
|
||||
c(0.6656393, 0.4191781, 0.1698630),
|
||||
tolerance = 0.000001)
|
||||
|
||||
expect_error(age(x = c("1980-01-01", "1985-01-01", "1990-01-01"),
|
||||
reference = c("2019-01-01", "2019-01-01")))
|
||||
|
||||
|
@ -31,7 +31,7 @@ test_that("first isolates work", {
|
||||
col_mo = "mo",
|
||||
info = TRUE),
|
||||
na.rm = TRUE),
|
||||
1274)
|
||||
1317)
|
||||
|
||||
# first *weighted* isolates
|
||||
expect_equal(
|
||||
@ -46,7 +46,7 @@ test_that("first isolates work", {
|
||||
type = "keyantibiotics",
|
||||
info = TRUE),
|
||||
na.rm = TRUE)),
|
||||
1369)
|
||||
1413)
|
||||
# should be same for tibbles
|
||||
expect_equal(
|
||||
suppressWarnings(
|
||||
@ -60,7 +60,7 @@ test_that("first isolates work", {
|
||||
type = "keyantibiotics",
|
||||
info = TRUE),
|
||||
na.rm = TRUE)),
|
||||
1369)
|
||||
1413)
|
||||
# when not ignoring I
|
||||
expect_equal(
|
||||
suppressWarnings(
|
||||
@ -74,7 +74,7 @@ test_that("first isolates work", {
|
||||
type = "keyantibiotics",
|
||||
info = TRUE),
|
||||
na.rm = TRUE)),
|
||||
1392)
|
||||
1436)
|
||||
# when using points
|
||||
expect_equal(
|
||||
suppressWarnings(
|
||||
@ -87,7 +87,7 @@ test_that("first isolates work", {
|
||||
type = "points",
|
||||
info = TRUE),
|
||||
na.rm = TRUE)),
|
||||
1372)
|
||||
1417)
|
||||
|
||||
# first non-ICU isolates
|
||||
expect_equal(
|
||||
@ -100,7 +100,7 @@ test_that("first isolates work", {
|
||||
info = TRUE,
|
||||
icu_exclude = TRUE),
|
||||
na.rm = TRUE),
|
||||
1129)
|
||||
1163)
|
||||
|
||||
# set 1500 random observations to be of specimen type 'Urine'
|
||||
random_rows <- sample(x = 1:2000, size = 1500, replace = FALSE)
|
||||
@ -175,6 +175,7 @@ test_that("first isolates work", {
|
||||
col_mo = "mo",
|
||||
col_patient_id = "patient_id"))
|
||||
|
||||
# missing dates should be no problem
|
||||
df <- septic_patients
|
||||
df[1:100, "date"] <- NA
|
||||
expect_equal(
|
||||
@ -185,6 +186,6 @@ test_that("first isolates work", {
|
||||
col_mo = "mo",
|
||||
info = TRUE),
|
||||
na.rm = TRUE),
|
||||
1279)
|
||||
1322)
|
||||
|
||||
})
|
||||
|
Reference in New Issue
Block a user