rsample a boot on a green background

R-CMD-check Codecov test
coverage CRAN_Status_Badge Downloads lifecycle


The rsample package provides functions to create different types of resamples and corresponding classes for their analysis. The goal is to have a modular set of methods that can be used for:

The scope of rsample is to provide the basic building blocks for creating and analyzing resamples of a data set, but this package does not include code for modeling or calculating statistics. The Working with Resample Sets vignette gives a demonstration of how rsample tools can be used when building models.

Note that resampled data sets created by rsample are directly accessible in a resampling object but do not contain much overhead in memory. Since the original data is not modified, R does not make an automatic copy.

For example, creating 50 bootstraps of a data set does not create an object that is 50-fold larger in memory:


#> 2,644,640 B

boots <- bootstraps(LetterRecognition, times = 50)
#> 6,686,776 B

# Object size per resample
#> 133,735.5 B

# Fold increase is <<< 50
#> [1] 2.528426

Created on 2022-02-28 by the reprex package (v2.0.1)

The memory usage for 50 bootstrap samples is less than 3-fold more than the original data set.


To install it, use:


And the development version from GitHub with:

# install.packages("pak")


This project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Try the rsample package in your browser

Any scripts or data that you put into this service are public.

rsample documentation built on May 29, 2024, 11:03 a.m.