impute_sample: Helper function that samples with replacement

Description Usage Arguments Value See Also Examples

Description

impute returns a vector of values imputed from resampling x.

Usage

1
impute_sample(x, n = 1, replace = TRUE)

Arguments

x

A vector.

n

The number of values to impute.

replace

Whether or not to sample with replacement. The default is TRUE.

Value

The output of impute_sample is a vector of imputed values of length n

See Also

Other imputers: impute_ecdf, impute_mode, impute

Examples

1
2
3
4
5
6
7
x <- c("mode", "mode", "other", NA, NA)

# Impute via sampling
x_impute <- impute(x, impute_sample)

# Compare
data.frame(x, x_impute)

derek-damron/transform documentation built on May 15, 2019, 3:57 a.m.