sim_missing {holodeck} | R Documentation |
Simulate missing values
Description
Takes a data frame and randomly replaces a user-supplied proportion of values with 'NA'.
Usage
sim_missing(.data, prop, seed = NA)
Arguments
.data |
A dataframe. |
prop |
Proportion of values to be set to 'NA'. |
seed |
An optional seed for random number generation. If 'NA' (default) a random seed will be used. |
Value
a dataframe with NAs
Examples
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)
[Package holodeck version 0.2.2 Index]