knitr::opts_chunk$set(collapse = TRUE, comment = "#>")

resamplr

lifecycle Travis-CI Build Status codecov

Status

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.

Introduction

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.

Installation

resamplr is not on CRAN. You can install the development version with

# install.packages("devtools")
devtools::install_github("jrnold/resamplr")

Main Features

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:

All 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.



jrnold/resamplr documentation built on May 20, 2019, 1:05 a.m.