View source: R/borg_wrappers.R
| borg_group_vfold_cv | R Documentation |
A guarded version of rsample::group_vfold_cv() that validates
group-based CV is appropriate for the data structure.
borg_group_vfold_cv(
data,
group,
v = NULL,
balance = c("groups", "observations"),
coords = NULL,
time = NULL,
target = NULL,
...
)
data |
A data frame. |
group |
Character. Column name for grouping. |
v |
Integer. Number of folds. Default: number of groups. |
balance |
Character. How to balance folds: "groups" or "observations". |
coords |
Character vector. Coordinate columns for spatial check. |
time |
Character. Time column for temporal check. |
target |
Character. Target variable for dependency detection. |
... |
Additional arguments passed to |
An rset object from rsample.
if (requireNamespace("rsample", quietly = TRUE)) {
# Clustered data - group CV is appropriate
data <- data.frame(
site = rep(1:20, each = 5),
x = rnorm(100),
y = rnorm(100)
)
folds <- borg_group_vfold_cv(data, group = "site", v = 5)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.