AMR/inst/tinytest/test-_deprecated.R

65 lines
3.9 KiB
R
Raw Normal View History

# ==================================================================== #
# TITLE #
2022-10-05 09:12:22 +02:00
# AMR: An R Package for Working with Antimicrobial Resistance Data #
# #
2019-01-02 23:24:07 +01:00
# SOURCE #
2020-07-08 14:48:06 +02:00
# https://github.com/msberends/AMR #
# #
2022-10-05 09:12:22 +02:00
# CITE AS #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
# Data. Journal of Statistical Software, 104(3), 1-31. #
2023-05-27 10:39:22 +02:00
# https://doi.org/10.18637/jss.v104.i03 #
2022-10-05 09:12:22 +02:00
# #
2022-12-27 15:16:15 +01:00
# Developed at the University of Groningen and the University Medical #
# Center Groningen in The Netherlands, in collaboration with many #
# colleagues from around the world, see our website. #
# #
2019-01-02 23:24:07 +01:00
# 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. #
2020-10-08 11:16:03 +02:00
# #
# Visit our website for the full manual and a complete tutorial about #
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
# ==================================================================== #
2023-01-24 10:20:27 +01:00
sir <- random_sir(100)
rsi <- sir
class(rsi) <- gsub("sir", "rsi", class(rsi))
mic <- random_mic(100)
disk <- random_disk(100)
expect_identical(summary(sir), summary(rsi))
expect_identical(c(sir), c(rsi))
expect_identical(suppressWarnings(suppressMessages(as.rsi(as.character(rsi)))),
suppressWarnings(suppressMessages(as.sir(as.character(sir)))))
expect_identical(suppressWarnings(suppressMessages(as.rsi(mic, mo = "Escherichia coli", ab = "CIP"))),
suppressWarnings(suppressMessages(as.sir(mic, mo = "Escherichia coli", ab = "CIP"))))
expect_identical(suppressWarnings(suppressMessages(as.rsi(disk, mo = "Escherichia coli", ab = "CIP"))),
suppressWarnings(suppressMessages(as.sir(disk, mo = "Escherichia coli", ab = "CIP"))))
expect_identical(suppressWarnings(suppressMessages(as.rsi(data.frame(CIP = mic, mo = "Escherichia coli")))),
suppressWarnings(suppressMessages(as.sir(data.frame(CIP = mic, mo = "Escherichia coli")))))
expect_identical(suppressWarnings(n_rsi(example_isolates$CIP)),
suppressWarnings(n_sir(example_isolates$CIP)))
2023-01-24 14:52:15 +01:00
expect_identical(suppressWarnings(rsi_df(example_isolates)),
suppressWarnings(sir_df(example_isolates)))
2023-01-24 10:20:27 +01:00
expect_identical(suppressWarnings(is.rsi.eligible(example_isolates)),
suppressWarnings(is_sir_eligible(example_isolates)))
2023-02-18 14:56:06 +01:00
if (AMR:::pkg_is_available("ggplot2")) {
2023-01-24 16:31:00 +01:00
expect_equal(suppressWarnings(ggplot_rsi(example_isolates[, c("CIP", "GEN", "TOB")])),
suppressWarnings(ggplot_sir(example_isolates[, c("CIP", "GEN", "TOB")])))
2023-01-24 10:20:27 +01:00
p <- ggplot2::ggplot(example_isolates[, c("CIP", "GEN", "TOB")])
expect_equal(suppressWarnings(p + geom_rsi() + scale_rsi_colours() + labels_rsi_count() + facet_rsi() + theme_rsi()),
2023-01-24 16:31:00 +01:00
suppressWarnings(p + geom_sir() + scale_sir_colours() + labels_sir_count() + facet_sir() + theme_sir()))
2023-01-24 10:20:27 +01:00
}