@@ -82,7 +82,7 @@ xrf_fit <-
8282
8383process_mtry <- function (colsample_bytree , counts , n_predictors , is_missing ) {
8484 if (! is.logical(counts )) {
85- rlang :: abort( " ' counts' should be a logical value." )
85+ cli :: cli_abort( " {.arg counts} should be a logical value." )
8686 }
8787
8888 ineq <- if (counts ) {
@@ -102,35 +102,21 @@ process_mtry <- function(colsample_bytree, counts, n_predictors, is_missing) {
102102 }
103103
104104 if ((colsample_bytree < 1 & counts ) | (colsample_bytree > 1 & ! counts )) {
105- rlang :: abort(
106- paste0(
107- " The supplied argument `mtry = " ,
108- colsample_bytree ,
109- " ` must be " ,
110- ineq ,
111- " than or equal to 1. \n\n `mtry` is currently being interpreted " ,
112- " as a " ,
113- interp ,
114- " rather than a " ,
115- opp ,
116- " . Supply `counts = " ,
117- ! counts ,
118- " ` to `set_engine()` to supply this argument as a " ,
119- opp ,
120- " rather than " ,
121- # TODO: add a section to the linked parsnip docs on mtry vs mtry_prop
122- " a " ,
123- interp ,
124- " . \n\n See `?details_rule_fit_xrf` for more details."
125- ),
126- call = NULL
105+ cli :: cli_abort(
106+ c(
107+ " The supplied argument `{.arg mtry} = {colsample_bytree}` must be {ineq} than or equal to 1." ,
108+ " i" = " {.arg mtry} is currently being interpreted as a {interp} rather than a {opp}." ,
109+ " i" = " Supply `{.arg counts} = {!counts}` to `set_engine()` to supply this argument as a {opp} rather than a {interp}." ,
110+ " i" = " See {.help details_rule_fit_xrf} for more details." ,
111+ call = NULL
112+ )
127113 )
128114 }
129115
130116 if (rlang :: is_call(colsample_bytree )) {
131117 if (rlang :: call_name(colsample_bytree ) == " tune" ) {
132- rlang :: abort (
133- paste0 (
118+ cli :: cli_abort (
119+ c (
134120 " The supplied `mtry` parameter is a call to `tune`. Did you forget " ,
135121 " to optimize hyperparameters with a tuning function like `tune::tune_grid`?"
136122 ),
@@ -220,7 +206,9 @@ xrf_pred <- function(object, new_data, lambda = object$fit$lambda, type, ...) {
220206multi_predict._xrf <-
221207 function (object , new_data , type = NULL , penalty = NULL , ... ) {
222208 if (any(names(enquos(... )) == " newdata" )) {
223- rlang :: abort(" Did you mean to use `new_data` instead of `newdata`?" )
209+ cli :: cli_abort(
210+ " Did you mean to use {.arg new_data} instead of {.arg newdata}?"
211+ )
224212 }
225213 if (is.null(penalty )) {
226214 penalty <- object $ fit $ lambda
0 commit comments