From 0542408a346440db66237838b8181aaff8309d1a Mon Sep 17 00:00:00 2001 From: James Wade Date: Thu, 15 Aug 2024 09:38:26 -0700 Subject: [PATCH] Use cli erros in rsplit.R Fixes #512 --- R/rsplit.R | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/R/rsplit.R b/R/rsplit.R index 96234934..c13b7333 100644 --- a/R/rsplit.R +++ b/R/rsplit.R @@ -1,20 +1,20 @@ rsplit <- function(data, in_id, out_id) { if (!is.data.frame(data) & !is.matrix(data)) { - rlang::abort("`data` must be a data frame.") + cli::cli_abort("`data` must be a data frame.") } if (!is.integer(in_id) | any(in_id < 1)) { - rlang::abort("`in_id` must be a positive integer vector.") + cli::cli_abort("`in_id` must be a positive integer vector.") } if (!all(is.na(out_id))) { if (!is.integer(out_id) | any(out_id < 1)) { - rlang::abort("`out_id` must be a positive integer vector.") + cli::cli_abort("`out_id` must be a positive integer vector.") } } if (length(in_id) == 0) { - rlang::abort("At least one row should be selected for the analysis set.") + cli::cli_abort("At least one row should be selected for the analysis set.") } structure( @@ -88,13 +88,13 @@ as.data.frame.rsplit <- data = "analysis", ...) { if (!is.null(row.names)) { - rlang::warn(paste0( + cli::cli_warn(paste0( "`row.names` is kept for consistency with the underlying class but ", "non-NULL values will be ignored." )) } if (optional) { - rlang::warn(paste0( + cli::cli_warn(paste0( "`optional` is kept for consistency with the underlying class but ", "TRUE values will be ignored." )) @@ -107,7 +107,7 @@ as.data.frame.rsplit <- "There is no assessment data set for an `rsplit` object", " with class `", rsplit_class, "`." ) - rlang::abort(msg) + cli::cli_abort(msg) } ind <- as.integer(x, data = data, ...) permuted_col <- vctrs::vec_slice(x$data, ind) %>%