We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4584a9b commit d1d4df4Copy full SHA for d1d4df4
R/fit.R
@@ -275,8 +275,16 @@ fit_xy.model_spec <-
275
}
276
277
278
- if (allow_sparse(object) && methods::is(x, "sparseMatrix")) {
279
- x <- sparsevctrs::coerce_to_sparse_data_frame(x)
+ if (methods::is(x, "sparseMatrix")) {
+ if (allow_sparse(object)) {
280
+ x <- sparsevctrs::coerce_to_sparse_data_frame(x)
281
+ } else {
282
+ cli::cli_warn(c(
283
+ "!" = "{.arg x} is a sparse matrix, but model doesn't accept that.",
284
+ "i" = "Converted {.arg x} to data.frame."
285
+ ))
286
+ x <- as.data.frame(x)
287
+ }
288
289
290
cl <- match.call(expand.dots = TRUE)
0 commit comments