# NOT RUN {
set.seed(3527)
test_data <- data.frame(id = sort(sample(1:20, size = 80, replace = TRUE)))
test_data$dat <- runif(nrow(test_data))
set.seed(5144)
split_by_id <- group_vfold_cv(test_data, group = "id")
get_id_left_out <- function(x)
unique(assessment(x)$id)
library(purrr)
table(map_int(split_by_id$splits, get_id_left_out))
set.seed(5144)
split_by_some_id <- group_vfold_cv(test_data, group = "id", v = 7)
held_out <- map(split_by_some_id$splits, get_id_left_out)
table(unlist(held_out))
# number held out per resample:
map_int(held_out, length)
# }
Run the code above in your browser using DataLab