1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-09 04:02:19 +02:00

(v1.3.0.9022) mo_matching_score(), poorman update, as.rsi() fix

This commit is contained in:
2020-09-18 16:05:53 +02:00
parent 89401ede9f
commit 4e40e42011
138 changed files with 2923 additions and 1472 deletions

View File

@ -0,0 +1,37 @@
# ==================================================================== #
# TITLE #
# Antimicrobial Resistance (AMR) Analysis #
# #
# SOURCE #
# https://github.com/msberends/AMR #
# #
# LICENCE #
# (c) 2018-2020 Berends MS, Luz CF et al. #
# #
# This R package is free software; you can freely use and distribute #
# it for both personal and commercial purposes under the terms of the #
# GNU General Public License version 2.0 (GNU GPL-2), as published by #
# the Free Software Foundation. #
# #
# We created this package for both routine data analysis and academic #
# research and it was publicly released in the hope that it will be #
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.github.io/AMR. #
# ==================================================================== #
# context("All examples")
#
# # run all examples (will take forever)
# exported_functions <- ls("package:AMR")
#
# for (i in seq_len(length(exported_functions))) {
# test_that(paste(exported_functions[i], "works"), {
# skip_on_cran()
# expect_output(suppressWarnings(example(exported_functions[i],
# package = "AMR",
# give.lines = TRUE,
# run.dontrun = TRUE,
# run.donttest = TRUE)),
# label = paste0("Examples of function ", exported_functions[i]))
# })
# }

View File

@ -37,7 +37,7 @@ test_that("as.ab works", {
rep("ERY", 10))
expect_identical(class(as.ab("amox")), c("ab", "character"))
expect_identical(class(pull(antibiotics, ab)), c("ab", "character"))
expect_identical(class(antibiotics$ab), c("ab", "character"))
expect_true(is.ab(as.ab("amox")))
expect_output(print(as.ab("amox")))
expect_output(print(data.frame(a = as.ab("amox"))))

View File

@ -41,7 +41,7 @@ test_that("ab_property works", {
expect_identical(ab_name(21319, language = NULL), "Flucloxacillin")
expect_identical(ab_name("J01CF05", language = NULL), "Flucloxacillin")
expect_identical(ab_ddd("AMX", "oral"), 1)
expect_identical(ab_ddd("AMX", "oral"), 1.5)
expect_identical(ab_ddd("AMX", "oral", units = TRUE), "g")
expect_identical(ab_ddd("AMX", "iv"), 1)
expect_identical(ab_ddd("AMX", "iv", units = TRUE), "g")

View File

@ -42,9 +42,10 @@ test_that("mic works", {
barplot(as.mic(c(1, 2, 4, 8)))
plot(as.mic(c(1, 2, 4, 8)))
print(as.mic(c(1, 2, 4, 8)))
expect_equal(summary(as.mic(c(2, 8))), c("Class" = "mic",
"<NA>" = "0",
"Min." = "2",
"Max." = "8"))
expect_equal(summary(as.mic(c(2, 8))),
structure(c("Class" = "mic",
"<NA>" = "0",
"Min." = "2",
"Max." = "8"), class = c("summaryDefault", "table")))
})

View File

@ -81,7 +81,7 @@ test_that("mic2rsi works", {
mo = "B_STRPT_PNMN",
ab = "AMX",
guideline = "EUCAST")),
"R")
"I")
expect_true(example_isolates %>%
mutate(amox_mic = as.mic(2)) %>%