View source: R/simulate_missings.R
simulate_missings | R Documentation |
Function generates random missing values in given dataset according to set parameters.
simulate_missings( df, per_missings, per_instances_missings = NULL, per_variables_missings = NULL, variables_with_missings = NULL )
df |
Data.frame or data.table where missing values will be generated |
per_missings |
Overall percentage of missing values generated in dataset. Must be set every time. |
per_instances_missings |
Percentage of instances which will have missing values. |
per_variables_missings |
Percentage of variables which will have missing values. |
variables_with_missings |
Only when 'per_variables_missings' is 'NULL'. Vector of column indexes where missings will be generated. |
Dataset with generated missings.
{ data_NA <- simulate_missings(iris, 20) # check sum(is.na(data_NA)) > 0 }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.