4242 remove_intercept = TRUE
4343) {
4444 if (! (composition %in% c(" data.frame" , " matrix" ))) {
45- rlang :: abort(" `composition` should be either 'data.frame' or 'matrix'." )
45+ cli :: cli_abort(
46+ " {.arg composition} should be {.cls data.frame} or {.cls matrix}."
47+ )
4648 }
4749
4850 # # Assemble model.frame call from call arguments
5961
6062 w <- as.vector(model.weights(mod_frame ))
6163 if (! is.null(w ) && ! is.numeric(w )) {
62- rlang :: abort( " ` weights` must be a numeric vector" )
64+ cli :: cli_abort( " The {.arg weights} must be a numeric vector. " )
6365 }
6466
6567 # TODO: Do we actually use the offset when fitting?
@@ -124,15 +126,11 @@ check_form_dots <- function(x) {
124126 good_args <- c(" subset" , " weights" )
125127 good_names <- names(x ) %in% good_args
126128 if (any(! good_names )) {
127- rlang :: abort(
128- glue :: glue(
129- " These argument(s) cannot be used to create the data: " ,
130- glue :: glue_collapse(
131- glue :: glue(" `{names(x)[!good_names]}`" ),
132- sep = " , "
133- ),
134- " . Possible arguments are: " ,
135- glue :: glue_collapse(glue :: glue(" `{good_args}`" ), sep = " , " )
129+ cli :: cli_abort(
130+ c(
131+ " The argument{?s} {.code {names(x)[!good_names]}} cannot be used
132+ to create the data." ,
133+ " i" = " Possible arguments are: {.code {good_args}}."
136134 )
137135 )
138136 }
@@ -159,7 +157,7 @@ local_one_hot_contrasts <- function(frame = rlang::caller_env()) {
159157# ' @keywords internal
160158.convert_x_to_form_fit <- function (x , weights = NULL , remove_intercept = TRUE ) {
161159 if (is.vector(x )) {
162- rlang :: abort( " `x` cannot be a vector." )
160+ cli :: cli_abort( " {.arg x} cannot be a vector." )
163161 }
164162
165163 if (remove_intercept ) {
@@ -182,10 +180,10 @@ local_one_hot_contrasts <- function(frame = rlang::caller_env()) {
182180
183181 if (! is.null(weights )) {
184182 if (! is.numeric(weights )) {
185- rlang :: abort( " ` weights` must be a numeric vector" )
183+ cli :: cli_abort( " The {.arg weights} must be a numeric vector. " )
186184 }
187185 if (length(weights ) != nrow(x )) {
188- rlang :: abort( glue :: glue( " ` weights` should have {nrow(x)} elements" ) )
186+ cli :: cli_abort( " {.arg weights} should have {nrow(x)} elements. " )
189187 }
190188 }
191189
@@ -219,7 +217,9 @@ make_formula <- function(x, short = TRUE) {
219217 composition = " data.frame"
220218) {
221219 if (! (composition %in% c(" data.frame" , " matrix" ))) {
222- rlang :: abort(" `composition` should be either 'data.frame' or 'matrix'." )
220+ cli :: cli_abort(
221+ " {.arg composition} should be either {.code data.frame} or {.code matrix}."
222+ )
223223 }
224224
225225 mod_terms <- object $ terms
0 commit comments