Skip to contents

Resample Distributions

Usage

resample_distribution(
  data,
  resampled_data = NULL,
  strata = NULL,
  ignore.columns = NULL,
  ...
)

Arguments

data

Data.frame (or vector) to be resampled where the rows are the observations and the columns are the variables. Note, all variables are permuted not specified in ignore.columns.

resampled_data

Data from resample() or NULL to run resample() on data

strata

String or numeric. This indicate the column to stratify the data when method is stratify. This can be the column number or the column name. When NULL the data is not stratified. When given, strata are sampled separately.

ignore.columns

Name or column numbers to ignore when resampling data. These are not permuted. Note that if less/more samples are collected than the original, these are permuted separately.

...

Additional parameters for resample()

Value

ggplot object showing original and resample distribution. Note that if a function is used, they many not be describing the same thing

Examples

resample_distribution(rnorm(100))

resample_distribution(
  data.frame(
    "data" = c(rnorm(100), rnorm(50, mean = 10)),
    "strata" = c(rep("A", 100), rep("B", 50))
  ),
  strata = "strata"
)

resample_distribution(rnorm(100), fn = mean)