| prodNA | R Documentation |
prodNA artificially introduces missing values by deleting entries
completely at random (MCAR) up to a specified proportion.
prodNA(x, noNA = 0.1)
x |
A data frame or matrix to which missing values will be added. Column
classes are preserved; factors receive |
noNA |
Proportion of entries in |
Missingness is introduced independently and uniformly over all cells, i.e., Missing Completely At Random (MCAR). No structure by row/column or variable type is imposed.
For reproducibility, call set.seed before prodNA.
An object of the same base type as x (data frame or matrix) with
approximately noNA proportion of its entries set to NA.
Daniel J. Stekhoven [aut, cre]
missForest, mixError
data(iris)
## Introduce 5% MCAR missingness into the iris data set:
set.seed(81)
iris.mis <- prodNA(iris, noNA = 0.05)
summary(iris.mis)
## Higher missingness:
set.seed(81)
iris.mis.20 <- prodNA(iris, noNA = 0.20)
mean(is.na(as.matrix(iris.mis.20)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.