1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-08 13:21:50 +02:00

(v1.7.1.9023) Removed filter_ functions, new set_ab_names(), ATC code update, ab selector update, fixes #46 and fixed #47

This commit is contained in:
2021-08-16 21:54:34 +02:00
parent 4e1efd902c
commit a2d249962f
248 changed files with 2377 additions and 12201 deletions

View File

@ -46,6 +46,7 @@ expect_true(ncol(example_isolates[, polymyxins(), drop = FALSE]) < ncol(example_
expect_true(ncol(example_isolates[, streptogramins(), drop = FALSE]) < ncol(example_isolates))
expect_true(ncol(example_isolates[, quinolones(), drop = FALSE]) < ncol(example_isolates))
expect_true(ncol(example_isolates[, tetracyclines(), drop = FALSE]) < ncol(example_isolates))
expect_true(ncol(example_isolates[, trimethoprims(), drop = FALSE]) < ncol(example_isolates))
expect_true(ncol(example_isolates[, ureidopenicillins(), drop = FALSE]) < ncol(example_isolates))
# Examples:
@ -53,6 +54,9 @@ expect_true(ncol(example_isolates[, ureidopenicillins(), drop = FALSE]) < ncol(e
# select columns 'mo', 'AMK', 'GEN', 'KAN' and 'TOB'
expect_equal(ncol(example_isolates[, c("mo", aminoglycosides())]), 5, tolerance = 0.5)
expect_equal(ncol(example_isolates[, c(administerable_per_os() & penicillins())]), 5, tolerance = 0.5)
expect_equal(ncol(example_isolates[, c(administerable_iv() & penicillins())]), 7, tolerance = 0.5)
# filter using any() or all()
expect_equal(nrow(example_isolates[any(carbapenems() == "R"), ]), 55, tolerance = 0.5)
expect_equal(nrow(subset(example_isolates, any(carbapenems() == "R"))), 55, tolerance = 0.5)

View File

@ -42,9 +42,10 @@ expect_identical(ab_name(21319, language = NULL), "Flucloxacillin")
expect_identical(ab_name("J01CF05", language = NULL), "Flucloxacillin")
expect_identical(ab_ddd("AMX", "oral"), 1.5)
expect_identical(ab_ddd("AMX", "oral", units = TRUE), "g")
expect_warning(ab_ddd("AMX", "oral", units = TRUE)) # old behaviour
expect_identical(ab_ddd_units("AMX", "iv"), "g")
expect_identical(ab_ddd("AMX", "iv"), 3)
expect_identical(ab_ddd("AMX", "iv", units = TRUE), "g")
expect_identical(ab_ddd_units("AMX", "iv"), "g")
expect_identical(ab_name(x = c("AMC", "PLB"), language = NULL), c("Amoxicillin/clavulanic acid", "Polymyxin B"))
expect_identical(ab_name(x = c("AMC", "PLB"), tolower = TRUE, language = NULL),
@ -62,3 +63,8 @@ expect_equal(ab_loinc("ampicillin"),
expect_true(ab_url("AMX") %like% "whocc.no")
expect_warning(ab_url("ASP"))
expect_identical(colnames(set_ab_names(example_isolates[, 20:25])),
c("cefoxitin", "cefotaxime", "ceftazidime", "ceftriaxone", "gentamicin", "tobramycin"))
expect_identical(colnames(set_ab_names(example_isolates[, 20:25], "atc")),
c("J01DC01", "J01DD01", "J01DD02", "J01DD04", "J01GB03", "J01GB01"))