Skip to content

Commit e9ff997

Browse files
committed
.code to .val for engine argument in sparse data functions
1 parent 6140db3 commit e9ff997

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

R/sparsevctrs.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ to_sparse_data_frame <- function(x, object, call = rlang::caller_env()) {
99

1010
cli::cli_abort(
1111
"{.arg x} is a sparse matrix, but {.fn {class(object)[1]}} with
12-
engine {.code {object$engine}} doesn't accept that.",
12+
engine {.val {object$engine}} doesn't accept that.",
1313
call = call
1414
)
1515
}
@@ -35,7 +35,7 @@ materialize_sparse_tibble <- function(x, object, input) {
3535

3636
cli::cli_warn(
3737
"{.arg {input}} is a sparse tibble, but {.fn {class(object)[1]}} with
38-
engine {.code {object$engine}} doesn't accept that. Converting to
38+
engine {.val {object$engine}} doesn't accept that. Converting to
3939
non-sparse."
4040
)
4141
for (i in seq_along(ncol(x))) {

tests/testthat/_snaps/sparsevctrs.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@
44
lm_fit <- fit(spec, avg_price_per_room ~ ., data = hotel_data[1:100, ])
55
Condition
66
Warning:
7-
`data` is a sparse tibble, but `linear_reg()` with engine `lm` doesn't accept that. Converting to non-sparse.
7+
`data` is a sparse tibble, but `linear_reg()` with engine "lm" doesn't accept that. Converting to non-sparse.
88

99
# sparse tibble can be passed to `fit_xy()
1010

1111
Code
1212
lm_fit <- fit_xy(spec, x = hotel_data[1:100, -1], y = hotel_data[1:100, 1])
1313
Condition
1414
Warning:
15-
`x` is a sparse tibble, but `linear_reg()` with engine `lm` doesn't accept that. Converting to non-sparse.
15+
`x` is a sparse tibble, but `linear_reg()` with engine "lm" doesn't accept that. Converting to non-sparse.
1616

1717
# sparse matrices can be passed to `fit_xy()
1818

1919
Code
2020
lm_fit <- fit_xy(spec, x = hotel_data[1:100, -1], y = hotel_data[1:100, 1])
2121
Condition
2222
Error in `fit_xy()`:
23-
! `x` is a sparse matrix, but `linear_reg()` with engine `lm` doesn't accept that.
23+
! `x` is a sparse matrix, but `linear_reg()` with engine "lm" doesn't accept that.
2424

2525
# sparse matrices can not be passed to `fit()
2626

@@ -37,15 +37,15 @@
3737
preds <- predict(lm_fit, sparse_mtcars)
3838
Condition
3939
Warning:
40-
`x` is a sparse tibble, but `linear_reg()` with engine `lm` doesn't accept that. Converting to non-sparse.
40+
`x` is a sparse tibble, but `linear_reg()` with engine "lm" doesn't accept that. Converting to non-sparse.
4141

4242
# sparse matrices can be passed to `predict()
4343

4444
Code
4545
predict(lm_fit, sparse_mtcars)
4646
Condition
4747
Error in `predict()`:
48-
! `x` is a sparse matrix, but `linear_reg()` with engine `lm` doesn't accept that.
48+
! `x` is a sparse matrix, but `linear_reg()` with engine "lm" doesn't accept that.
4949

5050
# to_sparse_data_frame() is used correctly
5151

0 commit comments

Comments
 (0)