We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 350e0a8 commit a748736Copy full SHA for a748736
R/skip.R
@@ -100,6 +100,12 @@ skip_if <- function(condition, message = NULL) {
100
#' @param minimum_version Minimum required version for the package
101
#' @rdname skip
102
skip_if_not_installed <- function(pkg, minimum_version = NULL) {
103
+ # most common case: it's not installed
104
+ res <- tryCatch(find.package(pkg), error = identity)
105
+ if (inherits(res, "error")) {
106
+ skip(paste0("{", pkg, "} is not installed"))
107
+ }
108
+ # rarer: it's installed, but fails to load
109
if (!requireNamespace(pkg, quietly = TRUE)) {
110
skip(paste0("{", pkg, "} cannot be loaded"))
111
}
0 commit comments