This function creates missing values under the missing complete at random (MCAR) mechanism. It is for demonstration purposes only.
Examples
# Create 30% MCAR data across all variables in a dataset
withNA.df <- createNA(data = iris, p = 0.3)
# Create 30% MCAR data in a specified variable in a dataset
withNA.df <- createNA(data = iris, var.names = c("Sepal.Length"), p = 0.3)
# Create MCAR data in several specified variables in a dataset
withNA.df <- createNA(
data = iris,
var.names = c("Sepal.Length", "Petal.Width", "Species"),
p = c(0.3, 0.2, 0.1)
)