knitr::opts_chunk$set(collapse = TRUE, comment = "#>")
I have stopped active development on the resamplr package. I suggest using the rsample package, which implement
I am also working on a lower-level package mlspearer. This package will implement the same resampling, cross-validation, and permutation methods, but work for a wider variety of objects.
The resamplr package provides functions that implement resampling methods including the bootstrap, jackknife, random test/train sets, k-fold cross-validation, leave-one-out and leave-p-out cross-validation, time-series cross validation, time-series k-fold cross validation, permutations, rolling windows.
These functions generate data frames with resample objects that work with the modelling pipeline of modelr and the tidyverse.
resamplr is not on CRAN. You can install the development version with
# install.packages("devtools") devtools::install_github("jrnold/resamplr")
The resamplr package includes functions to generate data frames of
lazy resample objects, as introduced in the tidyverse modelr package. The resample class
stores the a "pointer" to the original dataset and a vector of row indices.
The object can be coerced to a dataframe with as.data.frame and the row indices with as.integer.
library("modelr") library("resamplr") rs <- resample(mtcars, 1:10) as.data.frame(rs) as.integer(rs)
While the modelr package contains a few functions with resampling methods (crossv_kfold, crossv_mc, and bootstrap), the resamplr package implements many more resampling methods including the following:
boostrap
bootstrapbalanced_bootstraptsbootstrapcross-validation
holdout_n, holdout_fraccrossv_kfoldcrossv_tscrossv_lpo, crossv_loocrossv_tskfoldjackknife: jackknife
permuterollAll resampling functions are implemented as generic functions with methods for data frames (data.frame) and grouped data frames (grouped_df).
When used with grouped data frames, these functions allow either resampling groups instead of rows, or resample rows within each group (stratification), or both, depending on what is appropriate for the method.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.