mirror of
https://github.com/msberends/AMR.git
synced 2025-04-15 13:10:32 +02:00
(v2.1.1.9224) skip tests on cran
This commit is contained in:
parent
bb110646db
commit
8deaf2c8eb
@ -1,5 +1,5 @@
|
||||
Package: AMR
|
||||
Version: 2.1.1.9223
|
||||
Version: 2.1.1.9224
|
||||
Date: 2025-03-20
|
||||
Title: Antimicrobial Resistance Data Analysis
|
||||
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
|
||||
|
2
NEWS.md
2
NEWS.md
@ -1,4 +1,4 @@
|
||||
# AMR 2.1.1.9223
|
||||
# AMR 2.1.1.9224
|
||||
|
||||
*(this beta version will eventually become v3.0. We're happy to reach a new major milestone soon, which will be all about the new One Health support! Install this beta using [the instructions here](https://msberends.github.io/AMR/#latest-development-version).)*
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
This knowledge base contains all context you must know about the AMR package for R. You are a GPT trained to be an assistant for the AMR package in R. You are an incredible R specialist, especially trained in this package and in the tidyverse.
|
||||
|
||||
First and foremost, you are trained on version 2.1.1.9223. Remember this whenever someone asks which AMR package version you’re at.
|
||||
First and foremost, you are trained on version 2.1.1.9224. Remember this whenever someone asks which AMR package version you’re at.
|
||||
|
||||
Below are the contents of the NAMESPACE file, the index.md file, and all the man/*.Rd files (documentation) in the package. Every file content is split using 100 hypens.
|
||||
----------------------------------------------------------------------------------------------------
|
Binary file not shown.
Before Width: | Height: | Size: 20 KiB |
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-_deprecated.R", {
|
||||
skip_on_cran()
|
||||
|
||||
expect_warning(example_isolates[, ab_class("mycobact")])
|
||||
expect_warning(example_isolates[, ab_selector(name %like% "trim")])
|
||||
})
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-misc.R", {
|
||||
skip_on_cran()
|
||||
|
||||
expect_equal(AMR:::percentage(0.25), "25%")
|
||||
expect_equal(AMR:::percentage(0.5), "50%")
|
||||
expect_equal(AMR:::percentage(0.500, digits = 1), "50.0%")
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-ab.R", {
|
||||
skip_on_cran()
|
||||
|
||||
ab_reset_session()
|
||||
|
||||
expect_equal(
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-ab_from_text.R", {
|
||||
skip_on_cran()
|
||||
|
||||
ab_reset_session()
|
||||
|
||||
expect_identical(
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-ab_property.R", {
|
||||
skip_on_cran()
|
||||
|
||||
ab_reset_session()
|
||||
|
||||
expect_identical(ab_name("AMX", language = NULL), "Amoxicillin")
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-age.R", {
|
||||
skip_on_cran()
|
||||
|
||||
expect_equal(
|
||||
age(
|
||||
x = c("1980-01-01", "1985-01-01", "1990-01-01"),
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-amr selectors.R", {
|
||||
skip_on_cran()
|
||||
|
||||
# antibiotic class selectors
|
||||
expect_equal(ncol(example_isolates[, aminoglycosides(), drop = FALSE]), 4, tolerance = 0.5)
|
||||
expect_equal(ncol(example_isolates[, aminopenicillins(), drop = FALSE]), 2, tolerance = 0.5)
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-antibiogram.R", {
|
||||
skip_on_cran()
|
||||
|
||||
# Traditional antibiogram ----------------------------------------------
|
||||
|
||||
ab1 <- antibiogram(example_isolates,
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-atc_online.R", {
|
||||
skip_on_cran()
|
||||
|
||||
if (AMR:::pkg_is_available("curl") &&
|
||||
AMR:::pkg_is_available("rvest") &&
|
||||
AMR:::pkg_is_available("xml2") &&
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-av.R", {
|
||||
skip_on_cran()
|
||||
|
||||
expect_equal(
|
||||
as.character(as.av(c(
|
||||
"J05AB01",
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-av_from_text.R", {
|
||||
skip_on_cran()
|
||||
|
||||
expect_identical(
|
||||
av_from_text("28/03/2020 regular aciclovir 500mg po tds")[[1]],
|
||||
as.av("Aciclovir")
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-ab_property.R", {
|
||||
skip_on_cran()
|
||||
|
||||
expect_identical(av_name("ACI", language = NULL), "Aciclovir")
|
||||
expect_identical(av_atc("ACI"), "J05AB01")
|
||||
expect_identical(av_cid("ACI"), as.integer(135398513))
|
||||
|
@ -28,5 +28,7 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-availibility.R", {
|
||||
skip_on_cran()
|
||||
|
||||
expect_inherits(availability(example_isolates), "data.frame")
|
||||
})
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-bug/drug.R", {
|
||||
skip_on_cran()
|
||||
|
||||
b <- suppressWarnings(bug_drug_combinations(example_isolates))
|
||||
expect_inherits(b, "bug_drug_combinations")
|
||||
expect_output(suppressMessages(print(b)))
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-count.R", {
|
||||
skip_on_cran()
|
||||
|
||||
expect_equal(count_resistant(example_isolates$AMX), count_R(example_isolates$AMX))
|
||||
expect_equal(count_susceptible(example_isolates$AMX), count_SI(example_isolates$AMX))
|
||||
expect_equal(count_all(example_isolates$AMX), n_sir(example_isolates$AMX))
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-custom ab.R", {
|
||||
skip_on_cran()
|
||||
|
||||
ab_reset_session()
|
||||
|
||||
expect_message(as.ab("testab", info = TRUE))
|
||||
|
@ -29,6 +29,8 @@
|
||||
|
||||
|
||||
test_that("test-custom mo.R", {
|
||||
skip_on_cran()
|
||||
|
||||
expect_identical(
|
||||
as.mo("Enterobacter asburiae/cloacae"),
|
||||
as.mo("Enterobacter asburiae")
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-data.R", {
|
||||
skip_on_cran()
|
||||
|
||||
# IDs should always be unique
|
||||
expect_identical(nrow(microorganisms), length(unique(microorganisms$mo)))
|
||||
expect_identical(class(microorganisms$mo), c("mo", "character"))
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-disk.R", {
|
||||
skip_on_cran()
|
||||
|
||||
expect_true(as.disk(8) == as.disk("8"))
|
||||
expect_true(is.disk(as.disk(8)))
|
||||
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-eucast_rules.R", {
|
||||
skip_on_cran()
|
||||
|
||||
# thoroughly check input table
|
||||
expect_equal(
|
||||
colnames(AMR:::EUCAST_RULES_DF),
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-first_isolate.R", {
|
||||
skip_on_cran()
|
||||
|
||||
# all four methods
|
||||
expect_equal(
|
||||
sum(first_isolate(x = example_isolates, method = "isolate-based", info = TRUE), na.rm = TRUE),
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-g.test.R", {
|
||||
skip_on_cran()
|
||||
|
||||
# GOODNESS-OF-FIT
|
||||
|
||||
# example 1: clearfield rice vs. red rice
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-get_episode.R", {
|
||||
skip_on_cran()
|
||||
|
||||
x <- data.frame(dates = as.Date(c("2021-01-01", "2021-01-02", "2021-01-05", "2021-01-08", "2021-02-21", "2021-02-22", "2021-02-23", "2021-02-24", "2021-03-01", "2021-03-01")))
|
||||
x$absolute <- get_episode(x$dates, episode_days = 7)
|
||||
x$relative <- get_episode(x$dates, case_free_days = 7)
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-ggplot_sir.R", {
|
||||
skip_on_cran()
|
||||
|
||||
if (AMR:::pkg_is_available("dplyr", min_version = "1.0.0", also_load = TRUE) &&
|
||||
AMR:::pkg_is_available("ggplot2", also_load = TRUE)) {
|
||||
pdf(NULL) # prevent Rplots.pdf being created
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-guess_ab_col.R", {
|
||||
skip_on_cran()
|
||||
|
||||
expect_equal(
|
||||
guess_ab_col(example_isolates, "amox"),
|
||||
"AMX"
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-italicise_taxonomy.R", {
|
||||
skip_on_cran()
|
||||
|
||||
expect_identical(
|
||||
italicise_taxonomy("test for E. coli"),
|
||||
"test for *E. coli*"
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-join_microorganisms.R", {
|
||||
skip_on_cran()
|
||||
|
||||
unjoined <- example_isolates
|
||||
inner <- inner_join_microorganisms(example_isolates)
|
||||
left <- left_join_microorganisms(example_isolates)
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-key_antimicrobials.R", {
|
||||
skip_on_cran()
|
||||
|
||||
expect_equal(length(key_antimicrobials(example_isolates, antifungal = NULL)), nrow(example_isolates))
|
||||
expect_false(all(is.na(key_antimicrobials(example_isolates, antifungal = NULL))))
|
||||
expect_true(antimicrobials_equal("SSS", "SSS", type = "points"))
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-kurtosis.R", {
|
||||
skip_on_cran()
|
||||
|
||||
expect_equal(kurtosis(example_isolates$age),
|
||||
5.227999,
|
||||
tolerance = 0.00001
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-like.R", {
|
||||
skip_on_cran()
|
||||
|
||||
expect_true(sum("test" %like% c("^t", "^s")) == 1)
|
||||
|
||||
expect_true("test" %like% "test")
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-mdro.R", {
|
||||
skip_on_cran()
|
||||
|
||||
expect_error(mdro(example_isolates, guideline = c("BRMO", "MRGN"), info = TRUE))
|
||||
expect_error(mdro(example_isolates, col_mo = "invalid", info = TRUE))
|
||||
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-mean_amr_distance.R", {
|
||||
skip_on_cran()
|
||||
|
||||
vctr_disk <- as.disk(c(20:25))
|
||||
vctr_mic <- as.mic(2^c(0:5))
|
||||
vctr_sir <- as.sir(c("S", "S", "I", "I", "R", "R"))
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-mic.R", {
|
||||
skip_on_cran()
|
||||
|
||||
# used in multiple functions, also in plotting
|
||||
expect_true(all(as.mic(AMR:::COMMON_MIC_VALUES) %in% AMR:::VALID_MIC_LEVELS))
|
||||
expect_true(all(paste0("<=", as.mic(AMR:::COMMON_MIC_VALUES)) %in% AMR:::VALID_MIC_LEVELS))
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-mo.R", {
|
||||
skip_on_cran()
|
||||
|
||||
MOs <- subset(microorganisms, !is.na(mo) & nchar(mo) > 3)
|
||||
expect_identical(as.character(MOs$mo), as.character(as.mo(MOs$mo, keep_synonyms = TRUE)))
|
||||
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-mo_property.R", {
|
||||
skip_on_cran()
|
||||
|
||||
expect_equal(mo_kingdom("Escherichia coli"), "Bacteria")
|
||||
expect_equal(mo_kingdom("Escherichia coli"), mo_domain("Escherichia coli"))
|
||||
expect_equal(mo_phylum("Escherichia coli"), "Pseudomonadota")
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-pca.R", {
|
||||
skip_on_cran()
|
||||
|
||||
resistance_data <- structure(
|
||||
list(
|
||||
order = c("Bacillales", "Enterobacterales", "Enterobacterales"),
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-plotting.R", {
|
||||
skip_on_cran()
|
||||
|
||||
if (AMR:::pkg_is_available("ggplot2", also_load = TRUE)) {
|
||||
pdf(NULL) # prevent Rplots.pdf being created
|
||||
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-proportion.R", {
|
||||
skip_on_cran()
|
||||
|
||||
expect_equal(proportion_R(example_isolates$AMX), resistance(example_isolates$AMX))
|
||||
expect_equal(proportion_SI(example_isolates$AMX), susceptibility(example_isolates$AMX))
|
||||
# AMX resistance in `example_isolates`
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-random.R", {
|
||||
skip_on_cran()
|
||||
|
||||
expect_inherits(random_mic(100), "mic")
|
||||
expect_inherits(random_mic(100, mo = "Klebsiella pneumoniae"), "mic")
|
||||
expect_inherits(random_mic(100, mo = "Klebsiella pneumoniae", ab = "meropenem"), "mic")
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-resistance_predict.R", {
|
||||
skip_on_cran()
|
||||
|
||||
if (AMR:::pkg_is_available("dplyr", min_version = "1.0.0", also_load = TRUE)) {
|
||||
expect_output(AMX_R <- example_isolates %>%
|
||||
filter(mo == "B_ESCHR_COLI") %>%
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-sir.R", {
|
||||
skip_on_cran()
|
||||
|
||||
# Existing SIR ------------------------------------------------------------
|
||||
|
||||
# we must only have EUCAST and CLSI, because otherwise the rules in as.sir() will fail
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-skewness.R", {
|
||||
skip_on_cran()
|
||||
|
||||
expect_equal(skewness(example_isolates$age),
|
||||
-1.212888,
|
||||
tolerance = 0.00001
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-top_n_microorganisms.R", {
|
||||
skip_on_cran()
|
||||
|
||||
out1 <- top_n_microorganisms(example_isolates, n = 3)
|
||||
out2 <- top_n_microorganisms(example_isolates, n = 5, property = "genus")
|
||||
out3 <- top_n_microorganisms(example_isolates, n = 5, property = "genus", n_for_each = 3)
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-translate.R", {
|
||||
skip_on_cran()
|
||||
|
||||
expect_identical(mo_genus("B_GRAMP", language = "pt"), "(gênero desconhecido)")
|
||||
|
||||
expect_identical(mo_fullname("CoNS", "cs"), "Koaguláza-negativní stafylokok (KNS)")
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-vctrs.R", {
|
||||
skip_on_cran()
|
||||
|
||||
# extra tests for {vctrs} pkg support
|
||||
if (AMR:::pkg_is_available("tibble")) {
|
||||
test <- tibble::tibble(
|
||||
|
@ -28,6 +28,8 @@
|
||||
# ==================================================================== #
|
||||
|
||||
test_that("test-zzz.R", {
|
||||
skip_on_cran()
|
||||
|
||||
# Check if these functions still exist in their package (all are in Suggests field)
|
||||
# Since GitHub Actions runs every night, we will get emailed when a dependency fails based on this unit test
|
||||
|
||||
|
@ -43,6 +43,7 @@ if (identical(Sys.getenv("R_RUN_TINYTEST"), "true")) {
|
||||
code
|
||||
}
|
||||
expect_output <- tinytest::expect_stdout
|
||||
skip_on_cran <- function() invisible(NULL)
|
||||
|
||||
# set language
|
||||
set_AMR_locale("English")
|
||||
|
Loading…
x
Reference in New Issue
Block a user