diff --git a/DESCRIPTION b/DESCRIPTION index 787073fb..29954dc8 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: AMR -Version: 1.5.0.9008 +Version: 1.5.0.9009 Date: 2021-01-22 Title: Antimicrobial Resistance Analysis Authors@R: c( diff --git a/NEWS.md b/NEWS.md index 5cbbc5b5..c31e390f 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# AMR 1.5.0.9008 +# AMR 1.5.0.9009 ## Last updated: 22 January 2021 ### New diff --git a/R/aa_helper_functions.R b/R/aa_helper_functions.R index 15b470ef..fc5dbbb0 100755 --- a/R/aa_helper_functions.R +++ b/R/aa_helper_functions.R @@ -479,10 +479,13 @@ format_class <- function(class, plural) { if ("matrix" %in% class) { class <- "a matrix" } - if (any(c("mo", "ab", "rsi", "disk", "mic") %in% class)) { - class <- paste0("a class <", class[1L], ">") + if ("isolate_identifier" %in% class) { + class <- "created with isolate_identifier()" } - class[class == class.bak] <- paste0("a class <", class[class == class.bak], ">") + if (any(c("mo", "ab", "rsi", "disk", "mic") %in% class)) { + class <- paste0("of class <", class[1L], ">") + } + class[class == class.bak] <- paste0("of class <", class[class == class.bak], ">") # output vector_or(class, quotes = FALSE) } @@ -514,7 +517,7 @@ meet_criteria <- function(object, if (!is.null(allow_class)) { stop_ifnot(inherits(object, allow_class), "argument `", obj_name, "` must be ", format_class(allow_class, plural = isTRUE(has_length > 1)), - ", not ", format_class(class(object), plural = isTRUE(has_length > 1)), + ", i.e. not be ", format_class(class(object), plural = isTRUE(has_length > 1)), call = call_depth) # check data.frames for data if (inherits(object, "data.frame")) { diff --git a/R/isolate_identifier.R b/R/isolate_identifier.R index 94a2c49c..84bc8323 100644 --- a/R/isolate_identifier.R +++ b/R/isolate_identifier.R @@ -83,9 +83,15 @@ isolate_identifier <- function(x, col_mo = NULL, cols_ab = NULL) { } #' @method all.equal isolate_identifier +#' @inheritParams base::all.equal +#' @param ignore_empty_results a logical to indicate whether empty results must be ignored, so that only values R, S and I will be compared #' @rdname isolate_identifier #' @export all.equal.isolate_identifier <- function(target, current, ignore_empty_results = TRUE, ...) { + meet_criteria(target, allow_class = "isolate_identifier") + meet_criteria(current, allow_class = "isolate_identifier") + meet_criteria(ignore_empty_results, allow_class = "logical", has_length = 1) + if (isTRUE(all.equal.character(target, current))) { return(TRUE) } diff --git a/data-raw/AMR_1.5.0.9008.tar.gz b/data-raw/AMR_1.5.0.9009.tar.gz similarity index 87% rename from data-raw/AMR_1.5.0.9008.tar.gz rename to data-raw/AMR_1.5.0.9009.tar.gz index 231e2b61..0fc93b8c 100644 Binary files a/data-raw/AMR_1.5.0.9008.tar.gz and b/data-raw/AMR_1.5.0.9009.tar.gz differ diff --git a/docs/404.html b/docs/404.html index b2626d44..448c8675 100644 --- a/docs/404.html +++ b/docs/404.html @@ -81,7 +81,7 @@ AMR (for R) - 1.5.0.9008 + 1.5.0.9009 diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index aaf1ad72..bd4bd35e 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -81,7 +81,7 @@ AMR (for R) - 1.5.0.9008 + 1.5.0.9009 diff --git a/docs/articles/SPSS.html b/docs/articles/SPSS.html index 183b98d8..c452efdd 100644 --- a/docs/articles/SPSS.html +++ b/docs/articles/SPSS.html @@ -39,7 +39,7 @@ AMR (for R) - 1.5.0.9008 + 1.5.0.9009 diff --git a/docs/articles/index.html b/docs/articles/index.html index 32015764..4c0fd66b 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.5.0.9008 + 1.5.0.9009 diff --git a/docs/authors.html b/docs/authors.html index dcc70bfe..ac9000cc 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -81,7 +81,7 @@ AMR (for R) - 1.5.0.9008 + 1.5.0.9009 diff --git a/docs/index.html b/docs/index.html index ccdaeec5..118fea25 100644 --- a/docs/index.html +++ b/docs/index.html @@ -43,7 +43,7 @@ AMR (for R) - 1.5.0.9008 + 1.5.0.9009 diff --git a/docs/news/index.html b/docs/news/index.html index 3faabf1c..d396b2d4 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.5.0.9008 + 1.5.0.9009 @@ -236,9 +236,9 @@ Source: NEWS.md -
-

-AMR 1.5.0.9008 Unreleased +
+

+AMR 1.5.0.9009 Unreleased

diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 64b9961d..c14e4ac5 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-01-22T08:54Z +last_built: 2021-01-22T09:54Z urls: reference: https://msberends.github.io/AMR//reference article: https://msberends.github.io/AMR//articles diff --git a/docs/reference/index.html b/docs/reference/index.html index c6d2adc7..44091b32 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.5.0.9008 + 1.5.0.9009

diff --git a/docs/reference/isolate_identifier.html b/docs/reference/isolate_identifier.html index 21e7fb58..c2894867 100644 --- a/docs/reference/isolate_identifier.html +++ b/docs/reference/isolate_identifier.html @@ -82,7 +82,7 @@ AMR (for R) - 1.5.0.9008 + 1.5.0.9009
@@ -262,6 +262,18 @@ cols_ab

a character vector of column names of x, or (a combination with) an antibiotic selector function, such as carbapenems() and aminoglycosides()

+ + target +

R object.

+ + + current +

other R object, to be compared with target.

+ + + ignore_empty_results +

a logical to indicate whether empty results must be ignored, so that only values R, S and I will be compared

+ ...

column name of an antibiotic, see section Antibiotics below

diff --git a/docs/survey.html b/docs/survey.html index 9f037053..bd92ece4 100644 --- a/docs/survey.html +++ b/docs/survey.html @@ -81,7 +81,7 @@ AMR (for R) - 1.5.0.9008 + 1.5.0.9009

diff --git a/man/isolate_identifier.Rd b/man/isolate_identifier.Rd index 4c95e487..84d887f3 100644 --- a/man/isolate_identifier.Rd +++ b/man/isolate_identifier.Rd @@ -16,6 +16,12 @@ isolate_identifier(x, col_mo = NULL, cols_ab = NULL) \item{cols_ab}{a character vector of column names of \code{x}, or (a combination with) an \href{[ab_class()]}{antibiotic selector function}, such as \code{\link[=carbapenems]{carbapenems()}} and \code{\link[=aminoglycosides]{aminoglycosides()}}} +\item{target}{\R object.} + +\item{current}{other \R object, to be compared with \code{target}.} + +\item{ignore_empty_results}{a logical to indicate whether empty results must be ignored, so that only values R, S and I will be compared} + \item{...}{column name of an antibiotic, see section \emph{Antibiotics} below} } \description{ diff --git a/tests/testthat/test-data.R b/tests/testthat/test-data.R index ddd43d6e..4bf77fa8 100644 --- a/tests/testthat/test-data.R +++ b/tests/testthat/test-data.R @@ -63,7 +63,7 @@ test_that("data sets are valid", { test_that("creation of data sets is valid", { skip_on_cran() - df <- create_MO_lookup() + df <- AMR:::MO_lookup expect_lt(nrow(df[which(df$prevalence == 1), ]), nrow(df[which(df$prevalence == 2), ])) expect_lt(nrow(df[which(df$prevalence == 2), ]), nrow(df[which(df$prevalence == 3), ])) expect_true(all(c("mo", "fullname", @@ -71,11 +71,10 @@ test_that("creation of data sets is valid", { "rank", "ref", "species_id", "source", "prevalence", "snomed", "kingdom_index", "fullname_lower", "g_species") %in% colnames(df))) - olddf <- create_MO.old_lookup() expect_true(all(c("fullname", "fullname_new", "ref", "prevalence", - "fullname_lower", "g_species") %in% colnames(olddf))) + "fullname_lower", "g_species") %in% colnames(AMR:::MO.old_lookup))) - expect_s3_class(create_species_cons_cops("CoNS"), "mo") + expect_s3_class(AMR:::MO_CONS, "mo") }) diff --git a/vignettes/SPSS.Rmd b/vignettes/SPSS.Rmd index 53eb0cdd..f0aeb814 100755 --- a/vignettes/SPSS.Rmd +++ b/vignettes/SPSS.Rmd @@ -49,7 +49,7 @@ As said, SPSS is easier to learn than R. But SPSS, SAS and Stata come with major * **R has a huge community.** - Many R users just ask questions on websites like [StackOverflow.com](https://stackoverflow.com), the largest online community for programmers. At the time of writing, [`r format(suppressWarnings(readr::read_csv("https://data.stackexchange.com/stackoverflow/csv/1674647", col_types = "d")[[1]]), big.mark = ",")` R-related questions](https://stackoverflow.com/questions/tagged/r?sort=votes) have already been asked on this platform (that covers questions and answers for any programming language). In my own experience, most questions are answered within a couple of minutes. + Many R users just ask questions on websites like [StackOverflow.com](https://stackoverflow.com), the largest online community for programmers. At the time of writing, [`r format(suppressWarnings(read.csv("https://data.stackexchange.com/stackoverflow/csv/1674647", quote = '"'))[[1]], big.mark = ",")` R-related questions](https://stackoverflow.com/questions/tagged/r?sort=votes) have already been asked on this platform (that covers questions and answers for any programming language). In my own experience, most questions are answered within a couple of minutes. * **R understands any data type, including SPSS/SAS/Stata.**