Skip to content

Commit

Permalink
closes #110
Browse files Browse the repository at this point in the history
  • Loading branch information
xec-cm committed Dec 14, 2023
1 parent b1afac6 commit 45f83d8
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 20 deletions.
50 changes: 31 additions & 19 deletions R/corncob.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
)

Expand Down
4 changes: 3 additions & 1 deletion R/pkg_check.R
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ", "
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 45f83d8

Please sign in to comment.