Skip to content

Commit

Permalink
removed the 'cli::' descriptor from cli_abort. fixes tidymodels#506
Browse files Browse the repository at this point in the history
  • Loading branch information
PriKalra committed Aug 15, 2024
1 parent 0cc2c23 commit fc4436c
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions R/initial_validation_split.R
Original file line number Diff line number Diff line change
Expand Up @@ -120,25 +120,25 @@ initial_validation_split <- function(data,

check_prop_3 <- function(prop, call = rlang::caller_env()) {
if (!is.numeric(prop)) {
cli::cli_abort("`prop` needs to be numeric.", call = call)
cli_abort("`prop` needs to be numeric.", call = call)
}
if (any(is.na(prop))) {
cli::cli_abort("`prop` cannot contain `NA`.", call = call)
cli_abort("`prop` cannot contain `NA`.", call = call)
}
if (any(is.null(prop))) {
cli::cli_abort("`prop` cannot contain `NULL`.", call = call)
cli_abort("`prop` cannot contain `NULL`.", call = call)
}
if (length(prop) != 2L) {
cli::cli_abort(
cli_abort(
"`prop` needs to contain the proportions for training and validation.",
call = call
)
}
if (any(!(prop > 0)) | any(!(prop < 1))) {
cli::cli_abort("Elements of `prop` need to be in (0, 1).", call = call)
cli_abort("Elements of `prop` need to be in (0, 1).", call = call)
}
if (!(sum(prop) > 0 ) | !(sum(prop) < 1) ) {
cli::cli_abort(
cli_abort(
"The sum of the proportions in `prop` needs to be in (0, 1).",
call = call
)
Expand Down Expand Up @@ -303,7 +303,7 @@ validation <- function(x, ...) {
#' @rdname initial_validation_split
validation.default <- function(x, ...) {
cls <- class(x)
cli::cli_abort(
cli_abort(
"No method for objects of class{?es}: {.cls {cls}} "
)
}
Expand All @@ -321,7 +321,7 @@ validation.initial_validation_split <- function(x, ...) {
#' @export
#' @keywords internal
analysis.initial_validation_split <- function(x, ...) {
cli::cli_abort(
cli_abort(
c("The initial validation split does not contain an analysis set.",
"i" = "You can access the training data with {.fun training}.")
)
Expand All @@ -330,7 +330,7 @@ analysis.initial_validation_split <- function(x, ...) {
#' @export
#' @keywords internal
assessment.initial_validation_split <- function(x, ...) {
cli::cli_abort(
cli_abort(
c("The initial validation split does not contain an assessment set.",
"i" = "You can access the testing data with {.fun testing}.")
)
Expand Down

0 comments on commit fc4436c

Please sign in to comment.