|
40 | 40 | na.action = na.omit, |
41 | 41 | indicators = "traditional", |
42 | 42 | composition = "data.frame", |
43 | | - remove_intercept = TRUE) { |
| 43 | + remove_intercept = TRUE, |
| 44 | + call = rlang::caller_env()) { |
44 | 45 | if (!(composition %in% c("data.frame", "matrix", "dgCMatrix"))) { |
45 | 46 | cli::cli_abort( |
46 | 47 | "{.arg composition} should be either {.val data.frame}, {.val matrix}, or |
47 | | - {.val dgCMatrix}." |
| 48 | + {.val dgCMatrix}.", |
| 49 | + call = call |
48 | 50 | ) |
49 | 51 | } |
50 | 52 |
|
51 | 53 | if (sparsevctrs::has_sparse_elements(data)) { |
52 | 54 | cli::cli_abort( |
53 | | - "Sparse data cannot be used with formula interface. Please use |
54 | | - {.fn fit_xy} instead." |
| 55 | + "Sparse data cannot be used with formula interface. Please use |
| 56 | + {.fn fit_xy} instead.", |
| 57 | + call = call |
55 | 58 | ) |
56 | 59 | } |
57 | 60 |
|
|
84 | 87 |
|
85 | 88 | w <- as.vector(model.weights(mod_frame)) |
86 | 89 | if (!is.null(w) && !is.numeric(w)) { |
87 | | - cli::cli_abort("{.arg weights} must be a numeric vector.") |
| 90 | + cli::cli_abort("{.arg weights} must be a numeric vector.", call = call) |
88 | 91 | } |
89 | 92 |
|
90 | 93 | # TODO: Do we actually use the offset when fitting? |
|
175 | 178 | .convert_form_to_xy_new <- function(object, |
176 | 179 | new_data, |
177 | 180 | na.action = na.pass, |
178 | | - composition = "data.frame") { |
| 181 | + composition = "data.frame", |
| 182 | + call = rlang::caller_env()) { |
179 | 183 | if (!(composition %in% c("data.frame", "matrix"))) { |
180 | 184 | cli::cli_abort( |
181 | | - "{.arg composition} should be either {.val data.frame} or {.val matrix}." |
| 185 | + "{.arg composition} should be either {.val data.frame} or {.val matrix}.", |
| 186 | + call = call |
182 | 187 | ) |
183 | 188 | } |
184 | 189 |
|
|
244 | 249 | y, |
245 | 250 | weights = NULL, |
246 | 251 | y_name = "..y", |
247 | | - remove_intercept = TRUE) { |
| 252 | + remove_intercept = TRUE, |
| 253 | + call = rlang::caller_env()) { |
248 | 254 | if (is.vector(x)) { |
249 | | - cli::cli_abort("{.arg x} cannot be a vector.") |
| 255 | + cli::cli_abort("{.arg x} cannot be a vector.", call = call) |
250 | 256 | } |
251 | 257 |
|
252 | 258 | if (remove_intercept) { |
|
279 | 285 |
|
280 | 286 | if (!is.null(weights)) { |
281 | 287 | if (!is.numeric(weights)) { |
282 | | - cli::cli_abort("{.arg weights} must be a numeric vector.") |
| 288 | + cli::cli_abort("{.arg weights} must be a numeric vector.", call = call) |
283 | 289 | } |
284 | 290 | if (length(weights) != nrow(x)) { |
285 | | - cli::cli_abort("{.arg weights} should have {nrow(x)} elements.") |
| 291 | + cli::cli_abort("{.arg weights} should have {nrow(x)} elements.", call = call) |
286 | 292 | } |
287 | 293 |
|
288 | 294 | form <- patch_formula_environment_with_case_weights( |
|
0 commit comments