1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-25 06:46:11 +01:00

(v1.5.0.9009) unit test fixes

This commit is contained in:
dr. M.S. (Matthijs) Berends 2021-01-22 10:55:07 +01:00
parent 1ba44776a1
commit 1a88caa119
19 changed files with 51 additions and 25 deletions

View File

@ -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(

View File

@ -1,4 +1,4 @@
# AMR 1.5.0.9008
# AMR 1.5.0.9009
## <small>Last updated: 22 January 2021</small>
### New

View File

@ -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")) {

View File

@ -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)
}

View File

@ -81,7 +81,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="https://msberends.github.io/AMR//index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9008</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9009</span>
</span>
</div>

View File

@ -81,7 +81,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9008</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9009</span>
</span>
</div>

View File

@ -39,7 +39,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9008</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9009</span>
</span>
</div>

View File

@ -81,7 +81,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9008</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9009</span>
</span>
</div>

View File

@ -81,7 +81,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9008</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9009</span>
</span>
</div>

View File

@ -43,7 +43,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9008</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9009</span>
</span>
</div>

View File

@ -81,7 +81,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9008</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9009</span>
</span>
</div>
@ -236,9 +236,9 @@
<small>Source: <a href='https://github.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small>
</div>
<div id="amr-1509008" class="section level1">
<h1 class="page-header" data-toc-text="1.5.0.9008">
<a href="#amr-1509008" class="anchor"></a>AMR 1.5.0.9008<small> Unreleased </small>
<div id="amr-1509009" class="section level1">
<h1 class="page-header" data-toc-text="1.5.0.9009">
<a href="#amr-1509009" class="anchor"></a>AMR 1.5.0.9009<small> Unreleased </small>
</h1>
<div id="last-updated-22-january-2021" class="section level2">
<h2 class="hasAnchor">

View File

@ -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

View File

@ -81,7 +81,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9008</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9009</span>
</span>
</div>

View File

@ -82,7 +82,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9008</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9009</span>
</span>
</div>
@ -262,6 +262,18 @@
<th>cols_ab</th>
<td><p>a character vector of column names of <code>x</code>, or (a combination with) an <a href='[ab_class()]'>antibiotic selector function</a>, such as <code><a href='antibiotic_class_selectors.html'>carbapenems()</a></code> and <code><a href='antibiotic_class_selectors.html'>aminoglycosides()</a></code></p></td>
</tr>
<tr>
<th>target</th>
<td><p><span style="R">R</span> object.</p></td>
</tr>
<tr>
<th>current</th>
<td><p>other <span style="R">R</span> object, to be compared with <code>target</code>.</p></td>
</tr>
<tr>
<th>ignore_empty_results</th>
<td><p>a logical to indicate whether empty results must be ignored, so that only values R, S and I will be compared</p></td>
</tr>
<tr>
<th>...</th>
<td><p>column name of an antibiotic, see section <em>Antibiotics</em> below</p></td>

View File

@ -81,7 +81,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9008</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9009</span>
</span>
</div>

View File

@ -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{

View File

@ -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")
})

View File

@ -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.**