For a user provided data set a number of bootstrapped samples are generated with replacement.
Arguments
- data
A data frame from which to generate bootstrap samples.
- times
A numeric input specifying how many bootstrap draws are to be generated from
data
.- include_original
A logical input. If
TRUE
the returned output will contain a row with the originaldata
. Default isFALSE
(see details).- seed
A numeric input specifying the seed to be used. Default is
NULL
- ...
These dots are for future extensions and must be empty.
Details
Note that by design each bootstrapped sample is of the same size as
the original data set. The function generates a simple random sample with
replacement along the number of rows in the provided data. The suitability
of making any inference from the bootstrapped samples depend on a variety
of points (eg. size of original N, number of boot strap draws generated)
which are left to the user to decide if they are warranted. The
include_original
argument can be useful to obtain apparent selection
from a given variable selection method.
Examples
test_dat <- data.frame(a = 1:5, b = rnorm(5))
bootstrap_data(test_dat, times = 2, seed = 123)
#> # A tibble: 2 × 2
#> boot_rep data
#> <int> <list>
#> 1 1 <df [5 × 2]>
#> 2 2 <df [5 × 2]>