Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docs for group_vfold_cv() #339

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions R/vfold.R
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,14 @@ vfold_splits <- function(data, v = 10, strata = NULL, breaks = 4, pool = 0.1) {
#' on some grouping variable (which may have more than a single row
#' associated with it). The function can create as many splits as
#' there are unique values of the grouping variable or it can
#' create a smaller set of splits where more than one value is left
#' create a smaller set of splits where more than one group is left
#' out at a time. A common use of this kind of resampling is when you have
#' repeated measures of the same subject.
#'
#' @inheritParams vfold_cv
#' @param v The number of partitions of the data set. If left as `NULL`, `v`
#' will be set to the number of unique values in the group.
#' @param v The number of partitions of the data set. If left as `NULL` (the
#' default), `v` will be set to the number of unique values in the grouping
#' variable, creating "leave-one-group-out" splits.
#' @param balance If `v` is less than the number of unique groups, how should
#' groups be combined into folds? Should be one of
#' `"groups"` or `"observations"`.
Expand All @@ -181,6 +182,9 @@ vfold_splits <- function(data, v = 10, strata = NULL, breaks = 4, pool = 0.1) {
#' )
#' group_vfold_cv(ames, group = Neighborhood, v = 5, repeats = 2)
#'
#' # Leave-one-group-out CV
#' group_vfold_cv(ames, group = Neighborhood)
#'
#' @export
group_vfold_cv <- function(data, group = NULL, v = NULL, repeats = 1, balance = c("groups", "observations"), ...) {

Expand Down
10 changes: 7 additions & 3 deletions man/group_vfold_cv.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.