diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml
index 9cf9701c..5e55ee43 100644
--- a/.github/workflows/check.yaml
+++ b/.github/workflows/check.yaml
@@ -141,7 +141,7 @@ jobs:
R_LIBS_USER_GH_ACTIONS: ${{ env.R_LIBS_USER }}
R_RUN_TINYTEST: true
run: |
- R CMD check --no-manual AMR
+ R CMD check --no-manual --run-donttest --run-dontrun AMR
shell: bash
- name: Show unit tests output
diff --git a/DESCRIPTION b/DESCRIPTION
index 5673c51d..bf6cc0be 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,5 +1,5 @@
Package: AMR
-Version: 1.6.0.9062
+Version: 1.6.0.9063
Date: 2021-05-24
Title: Antimicrobial Resistance Data Analysis
Authors@R: c(
diff --git a/NEWS.md b/NEWS.md
index acbd2547..e1940676 100755
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,4 +1,4 @@
-# `AMR` 1.6.0.9062
+# `AMR` 1.6.0.9063
## Last updated: 24 May 2021
### Breaking change
diff --git a/R/ab.R b/R/ab.R
index a185133e..9297d3ab 100755
--- a/R/ab.R
+++ b/R/ab.R
@@ -82,7 +82,7 @@
#' # they use as.ab() internally:
#' ab_name("J01FA01") # "Erythromycin"
#' ab_name("eryt") # "Erythromycin"
-#'
+#' \donttest{
#' if (require("dplyr")) {
#'
#' # you can quickly rename columns using dplyr >= 1.0.0:
@@ -90,6 +90,7 @@
#' rename_with(as.ab, where(is.rsi))
#'
#' }
+#' }
as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
meet_criteria(x, allow_class = c("character", "numeric", "integer", "factor"), allow_NA = TRUE)
meet_criteria(flag_multiple_results, allow_class = "logical", has_length = 1)
diff --git a/R/ab_class_selectors.R b/R/ab_class_selectors.R
index 5e18a91e..0e63fae2 100644
--- a/R/ab_class_selectors.R
+++ b/R/ab_class_selectors.R
@@ -70,7 +70,7 @@
#'
#'
#' # dplyr -------------------------------------------------------------------
-#'
+#' \donttest{
#' if (require("dplyr")) {
#'
#' # this will select columns 'IPM' (imipenem) and 'MEM' (meropenem):
@@ -119,6 +119,7 @@
#' example_isolates %>% filter(carbapenems() == "R")
#' example_isolates %>% filter(across(carbapenems(), ~.x == "R"))
#' }
+#' }
ab_class <- function(ab_class,
only_rsi_columns = FALSE) {
ab_selector(ab_class, function_name = "ab_class", only_rsi_columns = only_rsi_columns)
diff --git a/R/age.R b/R/age.R
index 9864bf4a..fb295fbf 100755
--- a/R/age.R
+++ b/R/age.R
@@ -88,13 +88,13 @@ age <- function(x, reference = Sys.Date(), exact = FALSE, na.rm = FALSE, ...) {
# add decimal parts of year
mod <- n_days_x_rest / n_days_reference_year
# negative mods are cases where `x_in_reference_year` > `reference` - so 'add' a year
- mod[mod < 0] <- mod[mod < 0] + 1
+ mod[!is.na(mod) & mod < 0] <- mod[!is.na(mod) & mod < 0] + 1
# and finally add to ages
ages <- ages + mod
}
if (any(ages < 0, na.rm = TRUE)) {
- ages[ages < 0] <- NA
+ ages[!is.na(ages) & ages < 0] <- NA
warning_("NAs introduced for ages below 0.", call = TRUE)
}
if (any(ages > 120, na.rm = TRUE)) {
diff --git a/R/atc_online.R b/R/atc_online.R
index bf72e9e1..9a4709aa 100644
--- a/R/atc_online.R
+++ b/R/atc_online.R
@@ -64,7 +64,7 @@
#' @inheritSection AMR Read more on Our Website!
#' @source
#' @examples
-#' \donttest{
+#' \dontrun{
#' # oral DDD (Defined Daily Dose) of amoxicillin
#' atc_online_property("J01CA04", "DDD", "O")
#'
diff --git a/R/availability.R b/R/availability.R
index 962e3de3..d25116a1 100644
--- a/R/availability.R
+++ b/R/availability.R
@@ -35,13 +35,14 @@
#' @export
#' @examples
#' availability(example_isolates)
-#'
+#' \donttest{
#' if (require("dplyr")) {
#' example_isolates %>%
#' filter(mo == as.mo("E. coli")) %>%
#' select_if(is.rsi) %>%
#' availability()
#' }
+#' }
availability <- function(tbl, width = NULL) {
meet_criteria(tbl, allow_class = "data.frame")
meet_criteria(width, allow_class = c("numeric", "integer"), has_length = 1, allow_NULL = TRUE, is_positive = TRUE, is_finite = TRUE)
diff --git a/R/count.R b/R/count.R
index 8916f2ca..45fb5622 100755
--- a/R/count.R
+++ b/R/count.R
@@ -72,7 +72,7 @@
#' count_susceptible(example_isolates$AMX)
#' susceptibility(example_isolates$AMX) * n_rsi(example_isolates$AMX)
#'
-#'
+#' \donttest{
#' if (require("dplyr")) {
#' example_isolates %>%
#' group_by(hospital_id) %>%
@@ -106,6 +106,7 @@
#' group_by(hospital_id) %>%
#' count_df(translate = FALSE)
#' }
+#' }
count_resistant <- function(..., only_all_tested = FALSE) {
rsi_calc(...,
ab_result = "R",
diff --git a/R/data.R b/R/data.R
index 377b4d6d..8d6f8473 100755
--- a/R/data.R
+++ b/R/data.R
@@ -269,12 +269,14 @@
#' @inheritSection AMR Reference Data Publicly Available
#' @inheritSection AMR Read more on Our Website!
#' @examples
+#' \donttest{
#' if (require("dplyr")) {
#' intrinsic_resistant %>%
#' filter(antibiotic == "Vancomycin", microorganism %like% "Enterococcus") %>%
#' pull(microorganism)
#' # [1] "Enterococcus casseliflavus" "Enterococcus gallinarum"
#' }
+#' }
"intrinsic_resistant"
#' Data Set with Treatment Dosages as Defined by EUCAST
diff --git a/R/ggplot_pca.R b/R/ggplot_pca.R
index fbef45fc..0e8685f0 100755
--- a/R/ggplot_pca.R
+++ b/R/ggplot_pca.R
@@ -65,6 +65,7 @@
#' # See ?example_isolates.
#'
#' # See ?pca for more info about Principal Component Analysis (PCA).
+#' \donttest{
#' if (require("dplyr")) {
#' pca_model <- example_isolates %>%
#' filter(mo_genus(mo) == "Staphylococcus") %>%
@@ -84,6 +85,7 @@
#' labs(title = "Title here")
#' }
#' }
+#' }
ggplot_pca <- function(x,
choices = 1:2,
scale = 1,
diff --git a/R/ggplot_rsi.R b/R/ggplot_rsi.R
index b3ea14d8..16cab8c4 100755
--- a/R/ggplot_rsi.R
+++ b/R/ggplot_rsi.R
@@ -67,6 +67,7 @@
#' @export
#' @inheritSection AMR Read more on Our Website!
#' @examples
+#' \donttest{
#' if (require("ggplot2") & require("dplyr")) {
#'
#' # get antimicrobial results for drugs against a UTI:
@@ -116,7 +117,6 @@
#' scale_rsi_colours(Value4 = "S", Value5 = "I", Value6 = "R")
#' }
#'
-#' \donttest{
#' # resistance of ciprofloxacine per age group
#' example_isolates %>%
#' mutate(first_isolate = first_isolate(.)) %>%
diff --git a/R/italicise_taxonomy.R b/R/italicise_taxonomy.R
index bf4d5c45..14eb7b0c 100644
--- a/R/italicise_taxonomy.R
+++ b/R/italicise_taxonomy.R
@@ -45,12 +45,13 @@
#'
#' # since ggplot2 supports no markdown (yet), use
#' # italicise_taxonomy() and the `ggtext` pkg for titles:
-#'
+#' \donttest{
#' if (require("ggplot2") && require("ggtext")) {
#' ggplot(example_isolates$AMC,
#' title = italicise_taxonomy("Amoxi/clav in E. coli")) +
#' theme(plot.title = ggtext::element_markdown())
#' }
+#' }
italicise_taxonomy <- function(string, type = c("markdown", "ansi")) {
if (missing(type)) {
type <- "markdown"
diff --git a/R/mo_property.R b/R/mo_property.R
index 04fc9903..6fb01a41 100755
--- a/R/mo_property.R
+++ b/R/mo_property.R
@@ -152,6 +152,7 @@
#' mo_is_yeast(c("Candida", "E. coli")) # TRUE, FALSE
#'
#' # gram stains and intrinsic resistance can also be used as a filter in dplyr verbs
+#' \donttest{
#' if (require("dplyr")) {
#' example_isolates %>%
#' filter(mo_is_gram_positive())
@@ -167,6 +168,7 @@
#' # SNOMED codes, and URL to the online database
#' mo_info("E. coli")
#' }
+#' }
mo_name <- function(x, language = get_locale(), ...) {
if (missing(x)) {
# this tries to find the data and an column
diff --git a/R/pca.R b/R/pca.R
index 426be37d..c55f6c4a 100755
--- a/R/pca.R
+++ b/R/pca.R
@@ -42,7 +42,6 @@
#' # See ?example_isolates.
#'
#' \donttest{
-#'
#' if (require("dplyr")) {
#' # calculate the resistance per group first
#' resistance_data <- example_isolates %>%
diff --git a/R/plot.R b/R/plot.R
index 648344a6..0dbc4de5 100644
--- a/R/plot.R
+++ b/R/plot.R
@@ -61,11 +61,13 @@
#' plot(some_mic_values, mo = "S. aureus", ab = "ampicillin")
#' plot(some_disk_values, mo = "Escherichia coli", ab = "cipro")
#'
+#' \donttest{
#' if (require("ggplot2")) {
#' ggplot(some_mic_values)
#' ggplot(some_disk_values, mo = "Escherichia coli", ab = "cipro")
#' ggplot(some_rsi_values)
#' }
+#' }
NULL
#' @method plot mic
diff --git a/R/proportion.R b/R/proportion.R
index ff498c31..99991bbf 100755
--- a/R/proportion.R
+++ b/R/proportion.R
@@ -103,6 +103,7 @@
#' proportion_IR(example_isolates$AMX)
#' proportion_R(example_isolates$AMX)
#'
+#' \donttest{
#' if (require("dplyr")) {
#' example_isolates %>%
#' group_by(hospital_id) %>%
@@ -161,6 +162,7 @@
#' group_by(hospital_id) %>%
#' proportion_df(translate = FALSE)
#' }
+#' }
resistance <- function(...,
minimum = 30,
as_percent = FALSE,
diff --git a/R/resistance_predict.R b/R/resistance_predict.R
index a2d9d1ad..bd1f70fb 100755
--- a/R/resistance_predict.R
+++ b/R/resistance_predict.R
@@ -70,6 +70,7 @@
#' year_min = 2010,
#' model = "binomial")
#' plot(x)
+#' \donttest{
#' if (require("ggplot2")) {
#' ggplot_rsi_predict(x)
#' }
@@ -114,6 +115,7 @@
#' x = "Year") +
#' theme_minimal(base_size = 13)
#' }
+#' }
resistance_predict <- function(x,
col_ab,
col_date = NULL,
diff --git a/R/rsi.R b/R/rsi.R
index 1cf473b7..02001340 100755
--- a/R/rsi.R
+++ b/R/rsi.R
@@ -101,12 +101,12 @@
#' @inheritSection AMR Read more on Our Website!
#' @examples
#' summary(example_isolates) # see all R/SI results at a glance
-#'
+#' \donttest{
#' if (require("skimr")) {
#' # class supported in skim() too:
#' skim(example_isolates)
#' }
-#'
+#' }
#' # For INTERPRETING disk diffusion and MIC values -----------------------
#'
#' # a whole data set, even with combined MIC values and disk zones
diff --git a/cran-comments.md b/cran-comments.md
index cf5b1db7..80a60592 100644
--- a/cran-comments.md
+++ b/cran-comments.md
@@ -1 +1,3 @@
+* This package has been archived on 22 May 2021 because of errors in the dplyr package, causing the skimr package to fail: . This AMR package contains a fix around this error. Nonetheless, an automated email sent to the maintainer with a warning that the AMR package would be archived would have saved us this archiving. Perhaps an idea for future development of CRAN?
+
* This package has a tarball size of over 7 MB and an installation size of over 5 MB, which will return a NOTE on R CMD CHECK. The package size is needed to offer users reference data for the complete taxonomy of microorganisms - one of the most important features of this package. This was written and explained in a manuscript that was accepted for publication in the Journal of Statistical Software 4 weeks ago. We will add the paper as a vignette in the next version. Please allow this exception in package size for CRAN. We already compressed all data sets using `compression = "xz"` to make them as small as possible.
diff --git a/data-raw/AMR_latest.tar.gz b/data-raw/AMR_latest.tar.gz
index 6145c3bf..65d7e478 100644
Binary files a/data-raw/AMR_latest.tar.gz and b/data-raw/AMR_latest.tar.gz differ
diff --git a/data-raw/_install_deps.R b/data-raw/_install_deps.R
index 41d76d4f..42aac100 100644
--- a/data-raw/_install_deps.R
+++ b/data-raw/_install_deps.R
@@ -24,7 +24,7 @@
# ==================================================================== #
# some old R instances have trouble installing tinytest, so we ship it too
-install.packages("data-raw/tinytest_1.2.4.patched.tar.gz")
+install.packages("data-raw/tinytest_1.2.4.10.tar.gz")
install.packages("data-raw/AMR_latest.tar.gz", dependencies = FALSE)
pkg_suggests <- gsub("[^a-zA-Z0-9]+", "", unlist(strsplit(packageDescription("AMR", fields = "Suggests"), ", ?")))
diff --git a/data-raw/tinytest_1.2.4.10.tar.gz b/data-raw/tinytest_1.2.4.10.tar.gz
new file mode 100644
index 00000000..bc71fd65
Binary files /dev/null and b/data-raw/tinytest_1.2.4.10.tar.gz differ
diff --git a/data-raw/tinytest_1.2.4.patched.tar.gz b/data-raw/tinytest_1.2.4.patched.tar.gz
deleted file mode 100644
index 56b8f567..00000000
Binary files a/data-raw/tinytest_1.2.4.patched.tar.gz and /dev/null differ
diff --git a/docs/404.html b/docs/404.html
index 8accef26..407d155c 100644
--- a/docs/404.html
+++ b/docs/404.html
@@ -81,7 +81,7 @@
AMR (for R)
- 1.6.0.9062
+ 1.6.0.9063
diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html
index c662a42c..74834e13 100644
--- a/docs/LICENSE-text.html
+++ b/docs/LICENSE-text.html
@@ -81,7 +81,7 @@
AMR (for R)
- 1.6.0.9062
+ 1.6.0.9063
diff --git a/docs/articles/datasets.html b/docs/articles/datasets.html
index 02aebe2c..1792c21d 100644
--- a/docs/articles/datasets.html
+++ b/docs/articles/datasets.html
@@ -39,7 +39,7 @@
AMR (for R)
- 1.6.0.9062
+ 1.6.0.9063
diff --git a/docs/articles/index.html b/docs/articles/index.html
index 877d35e2..c056d918 100644
--- a/docs/articles/index.html
+++ b/docs/articles/index.html
@@ -81,7 +81,7 @@
AMR (for R)
- 1.6.0.9062
+ 1.6.0.9063
diff --git a/docs/authors.html b/docs/authors.html
index fd8f40a9..da9235de 100644
--- a/docs/authors.html
+++ b/docs/authors.html
@@ -81,7 +81,7 @@
AMR (for R)
- 1.6.0.9062
+ 1.6.0.9063
diff --git a/docs/index.html b/docs/index.html
index f9ad8d26..ebda3708 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -42,7 +42,7 @@
AMR (for R)
- 1.6.0.9062
+ 1.6.0.9063
diff --git a/docs/news/index.html b/docs/news/index.html
index 114a77ed..05ece7a0 100644
--- a/docs/news/index.html
+++ b/docs/news/index.html
@@ -81,7 +81,7 @@
AMR (for R)
- 1.6.0.9062
+ 1.6.0.9063
@@ -236,9 +236,9 @@
Source: NEWS.md
-
-
+
+
@@ -387,7 +387,7 @@
#> Filtering on oxazolidinones: value in column `LNZ` (linezolid) is either "R", "S" or "I"
Support for custom MDRO guidelines, using the new custom_mdro_guideline()
function, please see mdro()
for additional info
-
ggplot()
generics for classes <mic>
and <disk>
+
ggplot()
generics for classes <mic>
and <disk>
Function mo_is_yeast()
, which determines whether a microorganism is a member of the taxonomic class Saccharomycetes or the taxonomic order Saccharomycetales:
@@ -444,7 +444,7 @@
Plotting of MIC and disk diffusion values now support interpretation colouring if you supply the microorganism and antimicrobial agent
All colours were updated to colour-blind friendly versions for values R, S and I for all plot methods (also applies to tibble printing)
Interpretation of MIC and disk diffusion values to R/SI will now be translated if the system language is German, Dutch or Spanish (see translate
)
-
Plotting is now possible with base R using plot()
and with ggplot2 using ggplot()
on any vector of MIC and disk diffusion values
+
Plotting is now possible with base R using plot()
and with ggplot2 using ggplot()
on any vector of MIC and disk diffusion values
Updated SNOMED codes to US Edition of SNOMED CT from 1 September 2020 and added the source to the help page of the microorganisms
data set
@@ -461,7 +461,7 @@
is.rsi.eligible()
now detects if the column name resembles an antibiotic name or code and now returns
TRUE
immediately if the input contains any of the values “R”, “S” or “I”. This drastically improves speed, also for a lot of other functions that rely on automatic determination of antibiotic columns.
Functions get_episode()
and is_new_episode()
now support less than a day as value for argument episode_days
(e.g., to include one patient/test per hour)
Argument ampc_cephalosporin_resistance
in eucast_rules()
now also applies to value “I” (not only “S”)
-
Functions print()
and summary()
on a Principal Components Analysis object (pca()
) now print additional group info if the original data was grouped using dplyr::group_by()
+Functions print()
and summary()
on a Principal Components Analysis object (pca()
) now print additional group info if the original data was grouped using dplyr::group_by()
Improved speed and reliability of guess_ab_col()
. As this also internally improves the reliability of first_isolate()
and mdro()
, this might have a slight impact on the results of those functions.
Fix for mo_name()
when used in other languages than English
diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml
index 2e8f5574..015f95e8 100644
--- a/docs/pkgdown.yml
+++ b/docs/pkgdown.yml
@@ -12,7 +12,7 @@ articles:
datasets: datasets.html
resistance_predict: resistance_predict.html
welcome_to_AMR: welcome_to_AMR.html
-last_built: 2021-05-23T22:05Z
+last_built: 2021-05-24T06:56Z
urls:
reference: https://msberends.github.io/AMR//reference
article: https://msberends.github.io/AMR//articles
diff --git a/docs/reference/antibiotic_class_selectors.html b/docs/reference/antibiotic_class_selectors.html
index 9ec2e887..5b1084fa 100644
--- a/docs/reference/antibiotic_class_selectors.html
+++ b/docs/reference/antibiotic_class_selectors.html
@@ -83,7 +83,7 @@
AMR (for R)
- 1.6.0.9062
+ 1.6.0.9063
@@ -342,7 +342,7 @@ The lifecycle of this function is stable# dplyr -------------------------------------------------------------------
-
+# \donttest{
if (require("dplyr")) {
# this will select columns 'IPM' (imipenem) and 'MEM' (meropenem):
@@ -391,6 +391,7 @@ The lifecycle of this function is stableexample_isolates %>% filter(carbapenems() == "R")
example_isolates %>% filter(across(carbapenems(), ~.x == "R"))
}
+# }
@@ -347,7 +347,7 @@ This package contains all ~550 antibiotic, antimycotic and antiviral dru
# they use as.ab() internally:
ab_name("J01FA01") # "Erythromycin"
ab_name("eryt") # "Erythromycin"
-
+# \donttest{
if (require("dplyr")) {
# you can quickly rename <rsi> columns using dplyr >= 1.0.0:
@@ -355,6 +355,7 @@ This package contains all ~550 antibiotic, antimycotic and antiviral dru
rename_with(as.ab, where(is.rsi))
}
+# }
@@ -419,12 +419,12 @@ The lifecycle of this function is stableExamples
summary(example_isolates) # see all R/SI results at a glance
-
+# \donttest{
if (require("skimr")) {
# class <rsi> supported in skim() too:
skim(example_isolates)
}
-
+# }
# For INTERPRETING disk diffusion and MIC values -----------------------
# a whole data set, even with combined MIC values and disk zones
diff --git a/docs/reference/atc_online.html b/docs/reference/atc_online.html
index dbe0d59b..dee60e49 100644
--- a/docs/reference/atc_online.html
+++ b/docs/reference/atc_online.html
@@ -82,7 +82,7 @@
AMR (for R)
- 1.6.0.9055
+ 1.6.0.9063
@@ -327,7 +327,7 @@ The lifecycle of this function is stableOn our website https://msberends.github.io/AMR/ you can find a comprehensive tutorial about how to conduct AMR data analysis, the complete documentation of all functions and an example analysis using WHONET data. As we would like to better understand the backgrounds and needs of our users, please participate in our survey!
Examples
- # \donttest{
+ if (FALSE) {
# oral DDD (Defined Daily Dose) of amoxicillin
atc_online_property("J01CA04", "DDD", "O")
@@ -335,7 +335,7 @@ The lifecycle of this function is stableatc_online_property("J01CA04", "DDD", "P")
atc_online_property("J01CA04", property = "groups") # search hierarchical groups of amoxicillin
-# }
+}
@@ -90,14 +90,14 @@