diff --git a/R/spatial_vfold_cv.R b/R/spatial_vfold_cv.R
index 70f9b7e..c029131 100644
--- a/R/spatial_vfold_cv.R
+++ b/R/spatial_vfold_cv.R
@@ -88,26 +88,34 @@ spatial_buffer_vfold_cv <- function(data,
n <- nrow(data)
v <- check_v(v, n, "rows")
- if (v == n && repeats > 1) {
- rlang::abort(
- c(
- "Repeated cross-validation doesn't make sense when performing leave-one-out cross-validation.",
- i = "Set `v` to a lower value.",
- i = "Or set `repeats = 1`."
+
+ if (v == n) {
+ if (repeats > 1) {
+ rlang::abort(
+ c(
+ "Repeated cross-validation doesn't make sense when performing leave-one-out cross-validation.",
+ i = "Set `v` to a lower value.",
+ i = "Or set `repeats = 1`."
+ )
)
+ }
+ rset <- rsample::loo_cv(data)
+
+ # change `id` to match vfold style
+ # no need to change the rset class here since we're setting it at the end
+ rset$id <- names0(length(rset$splits), "Fold")
+ } else {
+ rset <- rsample::vfold_cv(
+ data = data,
+ v = v,
+ repeats = repeats,
+ strata = {{ strata }},
+ breaks = breaks,
+ pool = pool,
+ ...
)
}
- rset <- rsample::vfold_cv(
- data = data,
- v = v,
- repeats = repeats,
- strata = {{ strata }},
- breaks = breaks,
- pool = pool,
- ...
- )
-
if (!missing(strata)) {
strata <- tidyselect::vars_select(names(data), {{ strata }})
if (length(strata) == 0) strata <- NULL
diff --git a/tests/testthat/_snaps/autoplot/block-plots-with-grid.svg b/tests/testthat/_snaps/autoplot/block-plots-with-grid.svg
index be94cef..7915edf 100644
--- a/tests/testthat/_snaps/autoplot/block-plots-with-grid.svg
+++ b/tests/testthat/_snaps/autoplot/block-plots-with-grid.svg
@@ -3067,34 +3067,34 @@
Fold
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
Fold01
Fold02
Fold03
diff --git a/tests/testthat/_snaps/autoplot/buffered-rsample-plot.svg b/tests/testthat/_snaps/autoplot/buffered-rsample-plot.svg
index f36b0a3..b8461a1 100644
--- a/tests/testthat/_snaps/autoplot/buffered-rsample-plot.svg
+++ b/tests/testthat/_snaps/autoplot/buffered-rsample-plot.svg
@@ -824,11 +824,11 @@
Class
-
+
-
+
-
+
Analysis
Assessment
Buffer
diff --git a/tests/testthat/_snaps/autoplot/buffered-rset-plot.svg b/tests/testthat/_snaps/autoplot/buffered-rset-plot.svg
index 1417f7b..7bac641 100644
--- a/tests/testthat/_snaps/autoplot/buffered-rset-plot.svg
+++ b/tests/testthat/_snaps/autoplot/buffered-rset-plot.svg
@@ -885,35 +885,35 @@
Fold
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
Fold01
Fold02
Fold03
diff --git a/tests/testthat/_snaps/autoplot/buffered-vfold-plot.svg b/tests/testthat/_snaps/autoplot/buffered-vfold-plot.svg
index 2a4d8a8..650adcf 100644
--- a/tests/testthat/_snaps/autoplot/buffered-vfold-plot.svg
+++ b/tests/testthat/_snaps/autoplot/buffered-vfold-plot.svg
@@ -824,25 +824,25 @@
Fold
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
Fold01
Fold02
Fold03
diff --git a/tests/testthat/_snaps/autoplot/buffered-vfold-split.svg b/tests/testthat/_snaps/autoplot/buffered-vfold-split.svg
index 2b92b44..283f3f1 100644
--- a/tests/testthat/_snaps/autoplot/buffered-vfold-split.svg
+++ b/tests/testthat/_snaps/autoplot/buffered-vfold-split.svg
@@ -824,11 +824,11 @@
Class
-
+
-
+
-
+
Analysis
Assessment
Buffer
diff --git a/tests/testthat/_snaps/autoplot/expand-bbox.svg b/tests/testthat/_snaps/autoplot/expand-bbox.svg
index 8c4ab87..6a6942e 100644
--- a/tests/testthat/_snaps/autoplot/expand-bbox.svg
+++ b/tests/testthat/_snaps/autoplot/expand-bbox.svg
@@ -832,17 +832,17 @@
Fold
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
Fold1
Fold2
Fold3
diff --git a/tests/testthat/_snaps/autoplot/repeated-block-cv.svg b/tests/testthat/_snaps/autoplot/repeated-block-cv.svg
index fa8950b..056f680 100644
--- a/tests/testthat/_snaps/autoplot/repeated-block-cv.svg
+++ b/tests/testthat/_snaps/autoplot/repeated-block-cv.svg
@@ -1745,35 +1745,35 @@
Fold
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
Fold01
Fold02
Fold03
diff --git a/tests/testthat/_snaps/autoplot/repeated-vfold.svg b/tests/testthat/_snaps/autoplot/repeated-vfold.svg
index 922d7e6..df97134 100644
--- a/tests/testthat/_snaps/autoplot/repeated-vfold.svg
+++ b/tests/testthat/_snaps/autoplot/repeated-vfold.svg
@@ -6962,25 +6962,25 @@
Fold
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
Fold01
Fold02
Fold03
diff --git a/tests/testthat/_snaps/autoplot/snake-flips-rows-the-right-way.svg b/tests/testthat/_snaps/autoplot/snake-flips-rows-the-right-way.svg
index d276786..7d0a1c9 100644
--- a/tests/testthat/_snaps/autoplot/snake-flips-rows-the-right-way.svg
+++ b/tests/testthat/_snaps/autoplot/snake-flips-rows-the-right-way.svg
@@ -1054,35 +1054,35 @@
Fold
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
Fold01
Fold02
Fold03
diff --git a/tests/testthat/_snaps/spatial_vfold_cv.md b/tests/testthat/_snaps/spatial_vfold_cv.md
index c39bd11..1c88472 100644
--- a/tests/testthat/_snaps/spatial_vfold_cv.md
+++ b/tests/testthat/_snaps/spatial_vfold_cv.md
@@ -80,7 +80,7 @@
spatial_leave_location_out_cv(ames)
Condition
Error in `rsample::group_vfold_cv()`:
- ! `group` should be a single character value for the column that will be used for splitting.
+ ! `group` must be a single string, not `NULL`.
---
@@ -97,7 +97,7 @@
spatial_leave_location_out_cv(ames_sf, v = c(5, 10))
Condition
Error in `rsample::group_vfold_cv()`:
- ! `group` should be a single character value for the column that will be used for splitting.
+ ! `group` must be a single string, not `NULL`.
---
@@ -165,7 +165,7 @@
---
- Repeated resampling when `v` is 28 would create identical resamples
+ Repeated resampling when `v` is 28 would create identical resamples.
# printing
diff --git a/tests/testthat/test-autoplot.R b/tests/testthat/test-autoplot.R
index f6d3174..373feb6 100644
--- a/tests/testthat/test-autoplot.R
+++ b/tests/testthat/test-autoplot.R
@@ -124,6 +124,8 @@ test_that("autoplot is stable", {
})
test_that("autoplot respects expand_bbox", {
+ skip_on_os("windows")
+
vdiffr::expect_doppelganger(
"expand_bbox",
autoplot(