diff --git a/R/corncob.R b/R/corncob.R index be53963..16570ee 100644 --- a/R/corncob.R +++ b/R/corncob.R @@ -128,25 +128,37 @@ methods::setMethod( rarefy, id) { - recipes_pkg_check(required_pkgs_corncob(), "step_croncob()") - add_step( - rec, - step_corncob_new( - phi.formula = phi.formula, - formula_null = formula_null, - phi.formula_null = phi.formula_null, - link = link, - phi.link = phi.link, - test = test, - boot = boot, - B = B, - filter_discriminant = filter_discriminant, - fdr_cutoff = fdr_cutoff, - fdr = fdr, - log2FC = log2FC, - rarefy = rarefy, - id = id - )) + check <- recipes_pkg_check(required_pkgs_corncob(), "step_croncob()") + if (check) { + rec <- add_step( + rec, + step_corncob_new( + phi.formula = phi.formula, + formula_null = formula_null, + phi.formula_null = phi.formula_null, + link = link, + phi.link = phi.link, + test = test, + boot = boot, + B = B, + filter_discriminant = filter_discriminant, + fdr_cutoff = fdr_cutoff, + fdr = fdr, + log2FC = log2FC, + rarefy = rarefy, + id = id + )) + } else { + rlang::inform(c( + "i" = glue::glue( + "The {crayon::blue('corncob')} package is currently unavailable on ", + "CRAN due to dependency issues. The functionality of this function ", + "that requires {crayon::blue('corncob')} has been temporarily ", + "disabled." + ) + ), use_cli_format = TRUE) + } + rec } ) diff --git a/R/pkg_check.R b/R/pkg_check.R index 77c70f4..c7618b0 100644 --- a/R/pkg_check.R +++ b/R/pkg_check.R @@ -37,6 +37,7 @@ recipes_pkg_check <- function(pkg = NULL, step_name, ...) { } } + res <- TRUE if (any(!good)) { pkList <- paste( stringr::str_remove_all(pkg[!good], ".*[/]|.*[:]") , collapse = ", " @@ -73,9 +74,10 @@ recipes_pkg_check <- function(pkg = NULL, step_name, ...) { '{crayon::blue(inst)}' ) cat(c(msg, "\n")) + res <- FALSE } - invisible() + invisible(res) } #' @noRd