powered by
Takes a data frame and randomly replaces a user-supplied proportion of values with `NA`.
sim_missing(.data, prop, seed = NA)
a dataframe with NAs
A dataframe.
Proportion of values to be set to `NA`.
An optional seed for random number generation. If `NA` (default) a random seed will be used.
library(dplyr) df <- sim_cat(n_obs = 10, n_groups = 2) %>% sim_covar(n_vars = 10, var = 1, cov = 0.5) %>% sim_missing(0.05)
Run the code above in your browser using DataLab