1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-08 18:01:50 +02:00

(v1.3.0.9000) support across() in as.rsi()

This commit is contained in:
2020-08-10 11:44:58 +02:00
parent 791bb6d33f
commit 0d9602a6a9
31 changed files with 378 additions and 141 deletions

View File

@ -202,11 +202,19 @@ stop_ifnot_installed <- function(package) {
return(invisible())
}
import_fn <- function(name, pkg) {
stop_ifnot_installed(pkg)
import_fn <- function(name, pkg, error_on_fail = TRUE) {
if (isTRUE(error_on_fail)) {
stop_ifnot_installed(pkg)
}
tryCatch(
get(name, envir = asNamespace(pkg)),
error = function(e) stop_("an error occurred in import_fn() while using this function", call = FALSE))
error = function(e) {
if (isTRUE(error_on_fail)) {
stop_("function ", name, "() not found in package '", pkg, "'. Please contact the maintainers of the AMR package at https://github.com/msberends/AMR/issues.", call = FALSE)
} else {
return(NULL)
}
})
}
stop_ <- function(..., call = TRUE) {