na_random: Replace missing data with random values

Description Usage Arguments Details See Also

View source: R/random.R

Description

Replace missing data with random values

Usage

1
2
3
na_random(x, replace = TRUE)

na_density(x, bw = bw.nrd0(na.omit(x)), adjust = 1, preserve_var = TRUE)

Arguments

x

a vector.

replace

should sampling be with replacement? TRUE by default.

bw

the smoothing bandwidth to be used.

adjust

the bandwidth used is actually adjust*bw.

preserve_var

if TRUE random generation algorithm preserves mean and variance of the original sample.

Details

na_random replaces missing data with non-missing values drawn from the data with, or without replacement. na_density replaces missing values with draws from Gaussian kernel density estimated on the non-missing data. The preserve_var argument for na_density if set to TRUE (default), leads to producing samples that have the same variance as the original data.

See Also

sample, density


twolodzko/misster documentation built on May 24, 2019, 2:54 p.m.