mirror of
https://github.com/msberends/AMR.git
synced 2024-12-25 08:06:12 +01:00
(v1.6.0.9062) code consistency
This commit is contained in:
parent
07939b1a14
commit
06302d296a
@ -1,6 +1,6 @@
|
|||||||
Package: AMR
|
Package: AMR
|
||||||
Version: 1.6.0.9061
|
Version: 1.6.0.9062
|
||||||
Date: 2021-05-23
|
Date: 2021-05-24
|
||||||
Title: Antimicrobial Resistance Data Analysis
|
Title: Antimicrobial Resistance Data Analysis
|
||||||
Authors@R: c(
|
Authors@R: c(
|
||||||
person(role = c("aut", "cre"),
|
person(role = c("aut", "cre"),
|
||||||
|
4
NEWS.md
4
NEWS.md
@ -1,5 +1,5 @@
|
|||||||
# `AMR` 1.6.0.9061
|
# `AMR` 1.6.0.9062
|
||||||
## <small>Last updated: 23 May 2021</small>
|
## <small>Last updated: 24 May 2021</small>
|
||||||
|
|
||||||
### Breaking change
|
### Breaking change
|
||||||
* All antibiotic class selectors (such as `carbapenems()`, `aminoglycosides()`) can now be used for filtering as well, making all their accompanying `filter_*()` functions redundant (such as `filter_carbapenems()`, `filter_aminoglycosides()`). These functions are now deprecated and will be removed in a next release.
|
* All antibiotic class selectors (such as `carbapenems()`, `aminoglycosides()`) can now be used for filtering as well, making all their accompanying `filter_*()` functions redundant (such as `filter_carbapenems()`, `filter_aminoglycosides()`). These functions are now deprecated and will be removed in a next release.
|
||||||
|
@ -727,7 +727,7 @@ get_current_data <- function(arg_name, call) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current_R_older_than(3.2)) {
|
if (getRversion() < "3.2") {
|
||||||
# R-3.0 and R-3.1 do not have an `x` element in the call stack, rendering this function useless
|
# R-3.0 and R-3.1 do not have an `x` element in the call stack, rendering this function useless
|
||||||
if (is.na(arg_name)) {
|
if (is.na(arg_name)) {
|
||||||
# like in carbapenems() etc.
|
# like in carbapenems() etc.
|
||||||
@ -893,7 +893,7 @@ has_colour <- function() {
|
|||||||
if (Sys.getenv("RSTUDIO", "") == "") {
|
if (Sys.getenv("RSTUDIO", "") == "") {
|
||||||
return(FALSE)
|
return(FALSE)
|
||||||
}
|
}
|
||||||
if ((cols <- Sys.getenv("RSTUDIO_CONSOLE_COLOR", "")) != "" && !is.na(as.numeric(cols))) {
|
if ((cols <- Sys.getenv("RSTUDIO_CONSOLE_COLOR", "")) != "" && !is.na(as.double(cols))) {
|
||||||
return(TRUE)
|
return(TRUE)
|
||||||
}
|
}
|
||||||
tryCatch(get("isAvailable", envir = asNamespace("rstudioapi"))(), error = function(e) return(FALSE)) &&
|
tryCatch(get("isAvailable", envir = asNamespace("rstudioapi"))(), error = function(e) return(FALSE)) &&
|
||||||
@ -1186,15 +1186,11 @@ percentage <- function(x, digits = NULL, ...) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
time_start_tracking <- function() {
|
time_start_tracking <- function() {
|
||||||
pkg_env$time_start <- round(as.numeric(Sys.time()) * 1000)
|
pkg_env$time_start <- round(as.double(Sys.time()) * 1000)
|
||||||
}
|
}
|
||||||
|
|
||||||
time_track <- function(name = NULL) {
|
time_track <- function(name = NULL) {
|
||||||
paste("(until now:", trimws(round(as.numeric(Sys.time()) * 1000) - pkg_env$time_start), "ms)")
|
paste("(until now:", trimws(round(as.double(Sys.time()) * 1000) - pkg_env$time_start), "ms)")
|
||||||
}
|
|
||||||
|
|
||||||
current_R_older_than <- function(version) {
|
|
||||||
as.double(R.Version()$major) + (as.double(R.Version()$minor) / 10) < version
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# prevent dependency on package 'backports' ----
|
# prevent dependency on package 'backports' ----
|
||||||
@ -1245,7 +1241,7 @@ lengths <- function(x, use.names = TRUE) {
|
|||||||
vapply(x, length, FUN.VALUE = NA_integer_, USE.NAMES = use.names)
|
vapply(x, length, FUN.VALUE = NA_integer_, USE.NAMES = use.names)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current_R_older_than(3.1)) {
|
if (getRversion() < "3.1") {
|
||||||
# R-3.0 does not contain these functions, set them here to prevent installation failure
|
# R-3.0 does not contain these functions, set them here to prevent installation failure
|
||||||
# (required for extension of the <mic> class)
|
# (required for extension of the <mic> class)
|
||||||
cospi <- function(...) 1
|
cospi <- function(...) 1
|
||||||
|
@ -25,11 +25,11 @@
|
|||||||
|
|
||||||
#' Antibiotic Class Selectors
|
#' Antibiotic Class Selectors
|
||||||
#'
|
#'
|
||||||
#' These functions help to filter and select columns with antibiotic test results that are of a specific antibiotic class, without the need to define the columns or antibiotic abbreviations. \strong{\Sexpr{ifelse(as.double(R.Version()$major) + (as.double(R.Version()$minor) / 10) < 3.2, paste0("NOTE: THESE FUNCTIONS DO NOT WORK ON YOUR CURRENT R VERSION. These functions require R version 3.2 or later - you have ", R.version.string, "."), "")}}
|
#' These functions help to filter and select columns with antibiotic test results that are of a specific antibiotic class, without the need to define the columns or antibiotic abbreviations. \strong{\Sexpr{ifelse(getRversion() < "3.2", paste0("NOTE: THESE FUNCTIONS DO NOT WORK ON YOUR CURRENT R VERSION. These functions require R version 3.2 or later - you have ", R.version.string, "."), "")}}
|
||||||
#' @inheritSection lifecycle Stable Lifecycle
|
#' @inheritSection lifecycle Stable Lifecycle
|
||||||
#' @param ab_class an antimicrobial class, such as `"carbapenems"`. The columns `group`, `atc_group1` and `atc_group2` of the [antibiotics] data set will be searched (case-insensitive) for this value.
|
#' @param ab_class an antimicrobial class, such as `"carbapenems"`. The columns `group`, `atc_group1` and `atc_group2` of the [antibiotics] data set will be searched (case-insensitive) for this value.
|
||||||
#' @param only_rsi_columns a [logical] to indicate whether only columns of class `<rsi>` must be selected (defaults to `FALSE`), see [as.rsi()]
|
#' @param only_rsi_columns a [logical] to indicate whether only columns of class `<rsi>` must be selected (defaults to `FALSE`), see [as.rsi()]
|
||||||
#' @details \strong{\Sexpr{ifelse(as.double(R.Version()$major) + (as.double(R.Version()$minor) / 10) < 3.2, paste0("NOTE: THESE FUNCTIONS DO NOT WORK ON YOUR CURRENT R VERSION. These functions require R version 3.2 or later - you have ", R.version.string, "."), "")}}
|
#' @details \strong{\Sexpr{ifelse(getRversion() < "3.2", paste0("NOTE: THESE FUNCTIONS DO NOT WORK ON YOUR CURRENT R VERSION. These functions require R version 3.2 or later - you have ", R.version.string, "."), "")}}
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
#' These functions can be used in data set calls for selecting columns and filtering rows, see *Examples*. They support base R, but work more convenient in dplyr functions such as [`select()`][dplyr::select()], [`filter()`][dplyr::filter()] and [`summarise()`][dplyr::summarise()].
|
#' These functions can be used in data set calls for selecting columns and filtering rows, see *Examples*. They support base R, but work more convenient in dplyr functions such as [`select()`][dplyr::select()], [`filter()`][dplyr::filter()] and [`summarise()`][dplyr::summarise()].
|
||||||
@ -220,7 +220,7 @@ ab_selector <- function(ab_class,
|
|||||||
meet_criteria(function_name, allow_class = "character", has_length = 1, .call_depth = 1)
|
meet_criteria(function_name, allow_class = "character", has_length = 1, .call_depth = 1)
|
||||||
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1, .call_depth = 1)
|
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1, .call_depth = 1)
|
||||||
|
|
||||||
if (current_R_older_than(3.2)) {
|
if (getRversion() < "3.2") {
|
||||||
warning_("antibiotic class selectors such as ", function_name,
|
warning_("antibiotic class selectors such as ", function_name,
|
||||||
"() require R version 3.2 or later - you have ", R.version.string,
|
"() require R version 3.2 or later - you have ", R.version.string,
|
||||||
call = FALSE)
|
call = FALSE)
|
||||||
|
17
R/age.R
17
R/age.R
@ -75,11 +75,16 @@ age <- function(x, reference = Sys.Date(), exact = FALSE, na.rm = FALSE, ...) {
|
|||||||
# add decimals
|
# add decimals
|
||||||
if (exact == TRUE) {
|
if (exact == TRUE) {
|
||||||
# get dates of `x` when `x` would have the year of `reference`
|
# get dates of `x` when `x` would have the year of `reference`
|
||||||
x_in_reference_year <- as.POSIXlt(paste0(format(as.Date(reference), "%Y"), format(as.Date(x), "-%m-%d")))
|
x_in_reference_year <- as.POSIXlt(paste0(format(as.Date(reference), "%Y"),
|
||||||
|
format(as.Date(x), "-%m-%d")),
|
||||||
|
format = "%Y-%m-%d")
|
||||||
# get differences in days
|
# get differences in days
|
||||||
n_days_x_rest <- as.double(difftime(as.Date(reference), as.Date(x_in_reference_year), units = "days"))
|
n_days_x_rest <- as.double(difftime(as.Date(reference),
|
||||||
|
as.Date(x_in_reference_year),
|
||||||
|
units = "days"))
|
||||||
# get numbers of days the years of `reference` has for a reliable denominator
|
# get numbers of days the years of `reference` has for a reliable denominator
|
||||||
n_days_reference_year <- as.POSIXlt(paste0(format(as.Date(reference), "%Y"), "-12-31"))$yday + 1
|
n_days_reference_year <- as.POSIXlt(paste0(format(as.Date(reference), "%Y"), "-12-31"),
|
||||||
|
format = "%Y-%m-%d")$yday + 1
|
||||||
# add decimal parts of year
|
# add decimal parts of year
|
||||||
mod <- n_days_x_rest / n_days_reference_year
|
mod <- n_days_x_rest / n_days_reference_year
|
||||||
# negative mods are cases where `x_in_reference_year` > `reference` - so 'add' a year
|
# negative mods are cases where `x_in_reference_year` > `reference` - so 'add' a year
|
||||||
@ -100,7 +105,11 @@ age <- function(x, reference = Sys.Date(), exact = FALSE, na.rm = FALSE, ...) {
|
|||||||
ages <- ages[!is.na(ages)]
|
ages <- ages[!is.na(ages)]
|
||||||
}
|
}
|
||||||
|
|
||||||
ages
|
if (exact == TRUE) {
|
||||||
|
as.double(ages)
|
||||||
|
} else {
|
||||||
|
as.integer(ages)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#' Split Ages into Age Groups
|
#' Split Ages into Age Groups
|
||||||
|
2
R/disk.R
2
R/disk.R
@ -85,7 +85,7 @@ as.disk <- function(x, na.rm = FALSE) {
|
|||||||
fixed = TRUE)
|
fixed = TRUE)
|
||||||
x_clean <- gsub(remove, "", x, ignore.case = TRUE, fixed = fixed)
|
x_clean <- gsub(remove, "", x, ignore.case = TRUE, fixed = fixed)
|
||||||
# remove everything that is not a number or dot
|
# remove everything that is not a number or dot
|
||||||
as.numeric(gsub("[^0-9.]+", "", x_clean))
|
as.double(gsub("[^0-9.]+", "", x_clean))
|
||||||
}
|
}
|
||||||
|
|
||||||
# round up and make it an integer
|
# round up and make it an integer
|
||||||
|
2
R/pca.R
2
R/pca.R
@ -120,7 +120,7 @@ pca <- function(x,
|
|||||||
message_("Columns selected for PCA: ", vector_and(font_bold(colnames(pca_data), collapse = NULL), quotes = TRUE),
|
message_("Columns selected for PCA: ", vector_and(font_bold(colnames(pca_data), collapse = NULL), quotes = TRUE),
|
||||||
". Total observations available: ", nrow(pca_data), ".")
|
". Total observations available: ", nrow(pca_data), ".")
|
||||||
|
|
||||||
if (current_R_older_than(3.4)) {
|
if (getRversion() < "3.4.0") {
|
||||||
# stats::prcomp prior to 3.4.0 does not have the 'rank.' argument
|
# stats::prcomp prior to 3.4.0 does not have the 'rank.' argument
|
||||||
pca_model <- prcomp(pca_data, retx = retx, center = center, scale. = scale., tol = tol)
|
pca_model <- prcomp(pca_data, retx = retx, center = center, scale. = scale., tol = tol)
|
||||||
} else {
|
} else {
|
||||||
|
Binary file not shown.
@ -81,7 +81,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="https://msberends.github.io/AMR//index.html">AMR (for R)</a>
|
<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.6.0.9061</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9062</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
<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.6.0.9061</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9062</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<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.6.0.9061</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9062</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -192,7 +192,7 @@
|
|||||||
<div class="page-header toc-ignore">
|
<div class="page-header toc-ignore">
|
||||||
<h1 data-toc-skip>Data sets for download / own use</h1>
|
<h1 data-toc-skip>Data sets for download / own use</h1>
|
||||||
|
|
||||||
<h4 class="date">23 May 2021</h4>
|
<h4 class="date">24 May 2021</h4>
|
||||||
|
|
||||||
<small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/master/vignettes/datasets.Rmd"><code>vignettes/datasets.Rmd</code></a></small>
|
<small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/master/vignettes/datasets.Rmd"><code>vignettes/datasets.Rmd</code></a></small>
|
||||||
<div class="hidden name"><code>datasets.Rmd</code></div>
|
<div class="hidden name"><code>datasets.Rmd</code></div>
|
||||||
|
@ -81,7 +81,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<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.6.0.9061</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9062</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
<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.6.0.9061</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9062</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
<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.6.0.9061</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9062</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<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.6.0.9061</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9062</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -236,12 +236,12 @@
|
|||||||
<small>Source: <a href='https://github.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small>
|
<small>Source: <a href='https://github.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="amr-1609061" class="section level1">
|
<div id="amr-1609062" class="section level1">
|
||||||
<h1 class="page-header" data-toc-text="1.6.0.9061">
|
<h1 class="page-header" data-toc-text="1.6.0.9062">
|
||||||
<a href="#amr-1609061" class="anchor"></a><small> Unreleased </small><code>AMR</code> 1.6.0.9061</h1>
|
<a href="#amr-1609062" class="anchor"></a><small> Unreleased </small><code>AMR</code> 1.6.0.9062</h1>
|
||||||
<div id="last-updated-23-may-2021" class="section level2">
|
<div id="last-updated-24-may-2021" class="section level2">
|
||||||
<h2 class="hasAnchor">
|
<h2 class="hasAnchor">
|
||||||
<a href="#last-updated-23-may-2021" class="anchor"></a><small>Last updated: 23 May 2021</small>
|
<a href="#last-updated-24-may-2021" class="anchor"></a><small>Last updated: 24 May 2021</small>
|
||||||
</h2>
|
</h2>
|
||||||
<div id="breaking-change" class="section level3">
|
<div id="breaking-change" class="section level3">
|
||||||
<h3 class="hasAnchor">
|
<h3 class="hasAnchor">
|
||||||
|
@ -12,7 +12,7 @@ articles:
|
|||||||
datasets: datasets.html
|
datasets: datasets.html
|
||||||
resistance_predict: resistance_predict.html
|
resistance_predict: resistance_predict.html
|
||||||
welcome_to_AMR: welcome_to_AMR.html
|
welcome_to_AMR: welcome_to_AMR.html
|
||||||
last_built: 2021-05-23T20:10Z
|
last_built: 2021-05-23T22:05Z
|
||||||
urls:
|
urls:
|
||||||
reference: https://msberends.github.io/AMR//reference
|
reference: https://msberends.github.io/AMR//reference
|
||||||
article: https://msberends.github.io/AMR//articles
|
article: https://msberends.github.io/AMR//articles
|
||||||
|
@ -83,7 +83,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<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.6.0.9061</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9062</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<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.6.0.9061</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9062</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
<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.6.0.9061</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9062</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||||
# ==================================================================== #
|
# ==================================================================== #
|
||||||
|
|
||||||
if (!AMR:::current_R_older_than(3.2)) {
|
if (getRversion() >= "3.2") {
|
||||||
# antibiotic class selectors require at least R-3.2
|
# antibiotic class selectors require at least R-3.2
|
||||||
expect_true(ncol(example_isolates[, aminoglycosides(), drop = FALSE]) < ncol(example_isolates))
|
expect_true(ncol(example_isolates[, aminoglycosides(), drop = FALSE]) < ncol(example_isolates))
|
||||||
expect_true(ncol(example_isolates[, betalactams(), drop = FALSE]) < ncol(example_isolates))
|
expect_true(ncol(example_isolates[, betalactams(), drop = FALSE]) < ncol(example_isolates))
|
||||||
|
@ -85,7 +85,7 @@ suppressWarnings(expect_identical(log1p(x), log1p(x_double)))
|
|||||||
suppressWarnings(expect_identical(cos(x), cos(x_double)))
|
suppressWarnings(expect_identical(cos(x), cos(x_double)))
|
||||||
suppressWarnings(expect_identical(sin(x), sin(x_double)))
|
suppressWarnings(expect_identical(sin(x), sin(x_double)))
|
||||||
suppressWarnings(expect_identical(tan(x), tan(x_double)))
|
suppressWarnings(expect_identical(tan(x), tan(x_double)))
|
||||||
if (!AMR:::current_R_older_than(3.1)) {
|
if (getRversion() >= "3.1") {
|
||||||
suppressWarnings(expect_identical(cospi(x), cospi(x_double)))
|
suppressWarnings(expect_identical(cospi(x), cospi(x_double)))
|
||||||
suppressWarnings(expect_identical(sinpi(x), sinpi(x_double)))
|
suppressWarnings(expect_identical(sinpi(x), sinpi(x_double)))
|
||||||
suppressWarnings(expect_identical(tanpi(x), tanpi(x_double)))
|
suppressWarnings(expect_identical(tanpi(x), tanpi(x_double)))
|
||||||
|
@ -58,10 +58,10 @@ tetracyclines(only_rsi_columns = FALSE)
|
|||||||
\item{only_rsi_columns}{a \link{logical} to indicate whether only columns of class \verb{<rsi>} must be selected (defaults to \code{FALSE}), see \code{\link[=as.rsi]{as.rsi()}}}
|
\item{only_rsi_columns}{a \link{logical} to indicate whether only columns of class \verb{<rsi>} must be selected (defaults to \code{FALSE}), see \code{\link[=as.rsi]{as.rsi()}}}
|
||||||
}
|
}
|
||||||
\description{
|
\description{
|
||||||
These functions help to filter and select columns with antibiotic test results that are of a specific antibiotic class, without the need to define the columns or antibiotic abbreviations. \strong{\Sexpr{ifelse(as.double(R.Version()$major) + (as.double(R.Version()$minor) / 10) < 3.2, paste0("NOTE: THESE FUNCTIONS DO NOT WORK ON YOUR CURRENT R VERSION. These functions require R version 3.2 or later - you have ", R.version.string, "."), "")}}
|
These functions help to filter and select columns with antibiotic test results that are of a specific antibiotic class, without the need to define the columns or antibiotic abbreviations. \strong{\Sexpr{ifelse(getRversion() < "3.2", paste0("NOTE: THESE FUNCTIONS DO NOT WORK ON YOUR CURRENT R VERSION. These functions require R version 3.2 or later - you have ", R.version.string, "."), "")}}
|
||||||
}
|
}
|
||||||
\details{
|
\details{
|
||||||
\strong{\Sexpr{ifelse(as.double(R.Version()$major) + (as.double(R.Version()$minor) / 10) < 3.2, paste0("NOTE: THESE FUNCTIONS DO NOT WORK ON YOUR CURRENT R VERSION. These functions require R version 3.2 or later - you have ", R.version.string, "."), "")}}
|
\strong{\Sexpr{ifelse(getRversion() < "3.2", paste0("NOTE: THESE FUNCTIONS DO NOT WORK ON YOUR CURRENT R VERSION. These functions require R version 3.2 or later - you have ", R.version.string, "."), "")}}
|
||||||
|
|
||||||
These functions can be used in data set calls for selecting columns and filtering rows, see \emph{Examples}. They support base R, but work more convenient in dplyr functions such as \code{\link[dplyr:select]{select()}}, \code{\link[dplyr:filter]{filter()}} and \code{\link[dplyr:summarise]{summarise()}}.
|
These functions can be used in data set calls for selecting columns and filtering rows, see \emph{Examples}. They support base R, but work more convenient in dplyr functions such as \code{\link[dplyr:select]{select()}}, \code{\link[dplyr:filter]{filter()}} and \code{\link[dplyr:summarise]{summarise()}}.
|
||||||
|
|
||||||
|
@ -27,9 +27,7 @@
|
|||||||
if (identical(Sys.getenv("R_RUN_TINYTEST"), "true")) {
|
if (identical(Sys.getenv("R_RUN_TINYTEST"), "true")) {
|
||||||
# env var 'R_LIBS_USER' got overwritten during 'R CMD check' in GitHub Actions, so:
|
# env var 'R_LIBS_USER' got overwritten during 'R CMD check' in GitHub Actions, so:
|
||||||
.libPaths(c(Sys.getenv("R_LIBS_USER_GH_ACTIONS"), .libPaths()))
|
.libPaths(c(Sys.getenv("R_LIBS_USER_GH_ACTIONS"), .libPaths()))
|
||||||
print("here")
|
|
||||||
if (AMR:::pkg_is_available("tinytest")) {
|
if (AMR:::pkg_is_available("tinytest")) {
|
||||||
print("here2")
|
|
||||||
library(AMR)
|
library(AMR)
|
||||||
out <- test_package("AMR",
|
out <- test_package("AMR",
|
||||||
testdir = ifelse(AMR:::dir.exists("inst/tinytest"),
|
testdir = ifelse(AMR:::dir.exists("inst/tinytest"),
|
||||||
|
Loading…
Reference in New Issue
Block a user