generate: Generate bootstrap and permutation resamples

Description Usage Arguments Value Examples

Description

Takes a tibble and generates n samples using either the bootstrapping or permutation methods

Usage

1
generate(x, n_samples, type = "bootstrap")

Arguments

x

Tibble or data.frame, containing the response variable from which to sample

n_samples

Integer. The number of samples to be generated. Cannot be negative or 0.

type

String. Specifies the method to regenerate the samples. Default: "bootstrap" (the future implementations will allow for other types including "Permutation")

Value

Tibble containing all the resamples in a dataframe with an additional column mapping each observation to its sample id.

Examples

1
2
3
4
library(dplyr)
gap_df <- gapminder::gapminder %>%
    dplyr::filter(year == 2007 & continent %in% c("Africa"))
generate(gap_df, n_samples=5, type="bootstrap")

UBC-MDS/rfer documentation built on May 14, 2019, 11:02 p.m.