diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 9cf9701c6..5e55ee432 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 5673c51d8..bf6cc0be5 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 acbd25479..e1940676d 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 a185133e4..9297d3ab1 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 5e18a91e7..0e63fae24 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 9864bf4a9..fb295fbfb 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 bf72e9e14..9a4709aad 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 962e3de37..d25116a13 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 8916f2ca2..45fb5622c 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 377b4d6d3..8d6f8473c 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 fbef45fc9..0e8685f0a 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 b3ea14d8e..16cab8c46 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 bf4d5c453..14eb7b0cb 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 04fc99038..6fb01a414 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 426be37dd..c55f6c4a7 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 648344a6b..0dbc4de59 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 ff498c315..99991bbfc 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 a2d9d1ad8..bd1f70fb1 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 1cf473b7b..020013407 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 cf5b1db70..80a605922 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 6145c3bfc..65d7e4787 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 41d76d4f6..42aac100e 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 000000000..bc71fd65f 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 56b8f567c..000000000 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 8accef26f..407d155c2 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 c662a42cc..74834e130 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 02aebe2c2..1792c21d0 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 877d35e2c..c056d9189 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 fd8f40a9a..da9235de2 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 f9ad8d263..ebda3708f 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 114a77ed6..05ece7a0c 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 -
-

- Unreleased AMR 1.6.0.9062

+
+

+ Unreleased AMR 1.6.0.9063

Last updated: 24 May 2021 @@ -288,7 +288,7 @@
  • Function betalactams() as additional antbiotic column selector and function filter_betalactams() as additional antbiotic column filter. The group of betalactams consists of all carbapenems, cephalosporins and penicillins.
  • -
  • A ggplot() method for resistance_predict() +
  • A ggplot() method for resistance_predict()
  • @@ -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 2e8f55748..015f95e80 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 9ec2e8874..5b1084fa1 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 dbe0d59b9..dee60e497 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 @@
    @@ -397,6 +397,7 @@ The lifecycle of this function is stable# 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") %>% @@ -416,6 +417,7 @@ The lifecycle of this function is stablelabs(title = "Title here") } } +# }
    @@ -429,7 +429,8 @@ 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

    -
    if (require("ggplot2") & require("dplyr")) {
    +    
    # \donttest{
    +if (require("ggplot2") & require("dplyr")) {
      
       # get antimicrobial results for drugs against a UTI:
       ggplot(example_isolates %>% select(AMX, NIT, FOS, TMP, CIP)) +
    @@ -478,7 +479,6 @@ The lifecycle of this function is stablescale_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/docs/reference/index.html b/docs/reference/index.html
    index 4029fbd27..466b2f313 100644
    --- a/docs/reference/index.html
    +++ b/docs/reference/index.html
    @@ -81,7 +81,7 @@
           
           
             AMR (for R)
    -        1.6.0.9062
    +        1.6.0.9063
           
         
     
    diff --git a/docs/reference/intrinsic_resistant.html b/docs/reference/intrinsic_resistant.html
    index e0d7698f1..23b0a5af1 100644
    --- a/docs/reference/intrinsic_resistant.html
    +++ b/docs/reference/intrinsic_resistant.html
    @@ -82,7 +82,7 @@
           
           
             AMR (for R)
    -        1.6.0.9011
    +        1.6.0.9063
           
         
     
    @@ -90,14 +90,14 @@
           
    @@ -329,7 +329,6 @@ The lifecycle of this function is stable# See ?example_isolates. # \donttest{ - if (require("dplyr")) { # calculate the resistance per group first resistance_data <- example_isolates %>% diff --git a/docs/reference/plot.html b/docs/reference/plot.html index 6d811391f..f46e7e89d 100644 --- a/docs/reference/plot.html +++ b/docs/reference/plot.html @@ -82,7 +82,7 @@ AMR (for R) - 1.6.0.9055 + 1.6.0.9063 @@ -408,11 +408,13 @@ The lifecycle of this function is stableplot(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) } +# }
    @@ -406,6 +406,7 @@ A microorganism is categorised as Susceptible, Increased exposure when proportion_IR(example_isolates$AMX) proportion_R(example_isolates$AMX) +# \donttest{ if (require("dplyr")) { example_isolates %>% group_by(hospital_id) %>% @@ -464,6 +465,7 @@ A microorganism is categorised as Susceptible, Increased exposure when group_by(hospital_id) %>% proportion_df(translate = FALSE) } +# } @@ -404,6 +404,7 @@ A microorganism is categorised as Susceptible, Increased exposure when year_min = 2010, model = "binomial") plot(x) +# \donttest{ if (require("ggplot2")) { ggplot_rsi_predict(x) } @@ -448,6 +449,7 @@ A microorganism is categorised as Susceptible, Increased exposure when x = "Year") + theme_minimal(base_size = 13) } +# } diff --git a/man/antibiotic_class_selectors.Rd b/man/antibiotic_class_selectors.Rd index 181cc9bbb..7257e8c89 100644 --- a/man/antibiotic_class_selectors.Rd +++ b/man/antibiotic_class_selectors.Rd @@ -115,7 +115,7 @@ example_isolates[any(carbapenems() == "R"), penicillins()] # dplyr ------------------------------------------------------------------- - +\donttest{ if (require("dplyr")) { # this will select columns 'IPM' (imipenem) and 'MEM' (meropenem): @@ -165,3 +165,4 @@ if (require("dplyr")) { example_isolates \%>\% filter(across(carbapenems(), ~.x == "R")) } } +} diff --git a/man/as.ab.Rd b/man/as.ab.Rd index 936a441cb..50673d094 100644 --- a/man/as.ab.Rd +++ b/man/as.ab.Rd @@ -102,13 +102,14 @@ ab_atc("seephthriaaksone") # and even this works # 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: example_isolates \%>\% rename_with(as.ab, where(is.rsi)) +} } } \seealso{ diff --git a/man/as.rsi.Rd b/man/as.rsi.Rd index 53e270e80..7edab8ccc 100755 --- a/man/as.rsi.Rd +++ b/man/as.rsi.Rd @@ -161,12 +161,12 @@ On our website \url{https://msberends.github.io/AMR/} you can find \href{https:/ \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/man/atc_online.Rd b/man/atc_online.Rd index 190b4cfe7..2e02f580e 100644 --- a/man/atc_online.Rd +++ b/man/atc_online.Rd @@ -80,7 +80,7 @@ On our website \url{https://msberends.github.io/AMR/} you can find \href{https:/ } \examples{ -\donttest{ +\dontrun{ # oral DDD (Defined Daily Dose) of amoxicillin atc_online_property("J01CA04", "DDD", "O") diff --git a/man/availability.Rd b/man/availability.Rd index 010c1edd3..166a59a5f 100644 --- a/man/availability.Rd +++ b/man/availability.Rd @@ -35,7 +35,7 @@ On our website \url{https://msberends.github.io/AMR/} you can find \href{https:/ \examples{ availability(example_isolates) - +\donttest{ if (require("dplyr")) { example_isolates \%>\% filter(mo == as.mo("E. coli")) \%>\% @@ -43,3 +43,4 @@ if (require("dplyr")) { availability() } } +} diff --git a/man/count.Rd b/man/count.Rd index 20dfd3284..6ad485e71 100644 --- a/man/count.Rd +++ b/man/count.Rd @@ -157,7 +157,7 @@ n_rsi(example_isolates$AMX) count_susceptible(example_isolates$AMX) susceptibility(example_isolates$AMX) * n_rsi(example_isolates$AMX) - +\donttest{ if (require("dplyr")) { example_isolates \%>\% group_by(hospital_id) \%>\% @@ -192,6 +192,7 @@ if (require("dplyr")) { count_df(translate = FALSE) } } +} \seealso{ \code{\link[=proportion]{proportion_*}} to calculate microbial resistance and susceptibility. } diff --git a/man/ggplot_pca.Rd b/man/ggplot_pca.Rd index cf4faf3fc..789f1d759 100644 --- a/man/ggplot_pca.Rd +++ b/man/ggplot_pca.Rd @@ -121,6 +121,7 @@ If the unlying code needs breaking changes, they will occur gradually. For examp # 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") \%>\% @@ -141,3 +142,4 @@ if (require("dplyr")) { } } } +} diff --git a/man/ggplot_rsi.Rd b/man/ggplot_rsi.Rd index 5246e6c52..cfb1356ba 100644 --- a/man/ggplot_rsi.Rd +++ b/man/ggplot_rsi.Rd @@ -154,6 +154,7 @@ On our website \url{https://msberends.github.io/AMR/} you can find \href{https:/ } \examples{ +\donttest{ if (require("ggplot2") & require("dplyr")) { # get antimicrobial results for drugs against a UTI: @@ -203,7 +204,6 @@ if (require("ggplot2") & require("dplyr")) { 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/man/intrinsic_resistant.Rd b/man/intrinsic_resistant.Rd index 771c24885..1c8e65824 100644 --- a/man/intrinsic_resistant.Rd +++ b/man/intrinsic_resistant.Rd @@ -33,6 +33,7 @@ On our website \url{https://msberends.github.io/AMR/} you can find \href{https:/ } \examples{ +\donttest{ if (require("dplyr")) { intrinsic_resistant \%>\% filter(antibiotic == "Vancomycin", microorganism \%like\% "Enterococcus") \%>\% @@ -40,4 +41,5 @@ if (require("dplyr")) { # [1] "Enterococcus casseliflavus" "Enterococcus gallinarum" } } +} \keyword{datasets} diff --git a/man/italicise_taxonomy.Rd b/man/italicise_taxonomy.Rd index f709376ec..1917ce39d 100644 --- a/man/italicise_taxonomy.Rd +++ b/man/italicise_taxonomy.Rd @@ -43,10 +43,11 @@ cat(italicise_taxonomy("An overview of S. aureus isolates", type = "ansi")) # 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()) } } +} diff --git a/man/mo_property.Rd b/man/mo_property.Rd index ec02a333d..dff64267d 100644 --- a/man/mo_property.Rd +++ b/man/mo_property.Rd @@ -280,6 +280,7 @@ mo_fullname("S. pyogenes", 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()) @@ -296,6 +297,7 @@ mo_taxonomy("E. coli") mo_info("E. coli") } } +} \seealso{ \link{microorganisms} } diff --git a/man/pca.Rd b/man/pca.Rd index dc411169d..d44c68838 100644 --- a/man/pca.Rd +++ b/man/pca.Rd @@ -77,7 +77,6 @@ On our website \url{https://msberends.github.io/AMR/} you can find \href{https:/ # See ?example_isolates. \donttest{ - if (require("dplyr")) { # calculate the resistance per group first resistance_data <- example_isolates \%>\% diff --git a/man/plot.Rd b/man/plot.Rd index 4c810d01b..1f70323ab 100644 --- a/man/plot.Rd +++ b/man/plot.Rd @@ -149,9 +149,11 @@ plot(some_rsi_values) 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) } } +} diff --git a/man/proportion.Rd b/man/proportion.Rd index 3c4325238..8fdec034e 100644 --- a/man/proportion.Rd +++ b/man/proportion.Rd @@ -160,6 +160,7 @@ proportion_I(example_isolates$AMX) proportion_IR(example_isolates$AMX) proportion_R(example_isolates$AMX) +\donttest{ if (require("dplyr")) { example_isolates \%>\% group_by(hospital_id) \%>\% @@ -219,6 +220,7 @@ if (require("dplyr")) { proportion_df(translate = FALSE) } } +} \seealso{ \code{\link[=count]{count()}} to count resistant and susceptible isolates. } diff --git a/man/resistance_predict.Rd b/man/resistance_predict.Rd index e178ff798..fcc8174b1 100644 --- a/man/resistance_predict.Rd +++ b/man/resistance_predict.Rd @@ -137,6 +137,7 @@ x <- resistance_predict(example_isolates, year_min = 2010, model = "binomial") plot(x) +\donttest{ if (require("ggplot2")) { ggplot_rsi_predict(x) } @@ -182,6 +183,7 @@ if (require("dplyr") & require("ggplot2")) { theme_minimal(base_size = 13) } } +} \seealso{ The \code{\link[=proportion]{proportion()}} functions to calculate resistance