A "lazy" resample.
Often you will resample a dataset hundreds or thousands of times. Storing
the complete resample each time would be very inefficient so this class
instead stores a "pointer" to the original dataset, and a vector of row
indexes. To turn this into a regular data frame, call as.data.frame
,
to extract the indices, use as.integer
.
resample(data, idx)
data |
The data frame |
idx |
A vector of integer indexes indicating which rows have
been selected. These values should lie between 1 and |
Other resampling techniques:
bootstrap()
,
resample_bootstrap()
,
resample_partition()
resample(mtcars, 1:10) b <- resample_bootstrap(mtcars) b as.integer(b) as.data.frame(b) # Many modelling functions will do the coercion for you, so you can # use a resample object directly in the data argument lm(mpg ~ wt, data = b)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.