1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-08 12:31:58 +02:00

(v1.7.1.9049) unit tests

This commit is contained in:
2021-10-05 09:58:08 +02:00
parent d1b16ce641
commit 2bcf28281d
28 changed files with 64 additions and 44 deletions

View File

@ -296,12 +296,15 @@ stop_ifnot_installed <- function(package) {
return(invisible())
}
pkg_is_available <- function(pkg, also_load = TRUE) {
pkg_is_available <- function(pkg, also_load = TRUE, min_version = NULL) {
if (also_load == TRUE) {
out <- suppressWarnings(require(pkg, character.only = TRUE, warn.conflicts = FALSE))
} else {
out <- requireNamespace(pkg, quietly = TRUE)
}
if (!is.null(min_version)) {
out <- out && packageVersion(pkg) >= min_version
}
isTRUE(out)
}