prodNA: Introduce Missing Values Completely at Random

Description Usage Arguments Value Author(s) See Also Examples

View source: R/prodNA.R

Description

'prodNA' artificially introduces missing values. Entries in the given dataframe are deleted completely at random up to the specified amount.

Usage

1
prodNA(x, noNA = 0.1)

Arguments

x

dataframe subjected to missing value introduction.

noNA

proportion of missing values w.r.t. the number of entries of 'x'.

Value

dataframe with missing values.

Author(s)

Daniel J. Stekhoven, <[email protected]>

See Also

missForest

Examples

1
2
3
4
data(iris)
## Introduce 5% of missing values to the iris data set
iris.mis <- prodNA(iris, 0.05)
summary(iris.mis)

Example output

Loading required package: randomForest
randomForest 4.6-12
Type rfNews() to see new features/changes/bug fixes.
Loading required package: foreach
Loading required package: itertools
Loading required package: iterators
  Sepal.Length    Sepal.Width     Petal.Length    Petal.Width   
 Min.   :4.300   Min.   :2.000   Min.   :1.000   Min.   :0.100  
 1st Qu.:5.100   1st Qu.:2.800   1st Qu.:1.550   1st Qu.:0.300  
 Median :5.800   Median :3.000   Median :4.400   Median :1.300  
 Mean   :5.858   Mean   :3.057   Mean   :3.741   Mean   :1.178  
 3rd Qu.:6.400   3rd Qu.:3.300   3rd Qu.:5.100   3rd Qu.:1.800  
 Max.   :7.900   Max.   :4.400   Max.   :6.900   Max.   :2.500  
 NA's   :9       NA's   :3       NA's   :11      NA's   :5      
       Species  
 setosa    :45  
 versicolor:48  
 virginica :48  
 NA's      : 9  
                
                
                

missForest documentation built on May 1, 2019, 8 p.m.