Description Usage Arguments Value Methods (by class) Examples
Generate subsamples from manually specified indices of observations in each subsample.
1 2 3 4 5 6 7 | resample_df(data, ...)
## S3 method for class 'data.frame'
resample_df(data, samples, ...)
## S3 method for class 'grouped_df'
resample_df(data, samples, ...)
|
data |
A data frame |
... |
Arguments passed to methods |
samples |
A list of integer vectors or an integer vector, with the indices in each subsample. |
A data frame with rows for each subsample and the following columns:
A list of resample
objects. Training sets.
A list of resample
objects. Test sets.
An integer vector of identifiers
data.frame
: Generate subsamples of rows of data frames.
grouped_df
: Generate subsamples of groups of grouped data frames.
1 2 3 4 5 6 | library("dplyr")
# specify subsamples by a list of indices
resample_df(mtcars, samples = c(1:5, 5:10, 15:20))
resample_df(mtcars, samples = c(1:10, 1:15, 5:30))
# with grouped data frames, indices refer to groups
resample_df(group_by(mtcars, mpg), samples = list(c(1:2)))$sample
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.