generateNA: Adds Missing Values

View source: R/generateNA.R

generateNAR Documentation

Adds Missing Values

Description

Takes a vector, matrix or data.frame and replaces some values by NA.

Usage

generateNA(x, p = 0.1, seed = NULL)

Arguments

x

A vector, matrix or data.frame.

p

Proportion of missing values to add to x. In case x is a data.frame, p can also be a vector of probabilities per column or a named vector.

seed

An integer seed.

Value

x with missing values.

Examples

generateNA(1:10, p = 0.5)
head(generateNA(iris, p = 0.2))

missRanger documentation built on Sept. 12, 2024, 7:15 a.m.