Skip to content

Commit

Permalink
pass CI on older R versions?
Browse files Browse the repository at this point in the history
to avoid `Error in `as.data.frame.default(x[[i]], optional = TRUE)`: cannot coerce class '"Surv"' to a data.frame`
  • Loading branch information
hfrick committed Sep 19, 2024
1 parent 8f57e0c commit 3b167a0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/testthat/test-vfold.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ test_that("strata arg is checked", {
type = "right",
class = "Surv"
)
dat <- data.frame(a = 1:5, b = surv_obj)
dat <- data.frame(a = 1:5)
# add Surv object like this for older R versions (<= 4.2.3)
dat$b <- surv_obj
expect_snapshot(error = TRUE, {
vfold_cv(dat, strata = b)
})
Expand Down

0 comments on commit 3b167a0

Please sign in to comment.