amputeData: amputeData

Description Usage Arguments Value Examples

View source: R/amputeData.R

Description

Randomly amputes data (MCAR).

Usage

1
amputeData(data, perc = 0.1, cols = names(data))

Arguments

data

The data to be amputed

perc

A scalar. The percentage (0-1) to be amputed.

cols

The columns to ampute.

Value

The same dataset with random values in cols set to NA.

Examples

1
2
3
4
5
data(iris)
head(iris,10)

ampIris <- amputeData(iris)
head(ampIris,10)

Example output

   Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1           5.1         3.5          1.4         0.2  setosa
2           4.9         3.0          1.4         0.2  setosa
3           4.7         3.2          1.3         0.2  setosa
4           4.6         3.1          1.5         0.2  setosa
5           5.0         3.6          1.4         0.2  setosa
6           5.4         3.9          1.7         0.4  setosa
7           4.6         3.4          1.4         0.3  setosa
8           5.0         3.4          1.5         0.2  setosa
9           4.4         2.9          1.4         0.2  setosa
10          4.9         3.1          1.5         0.1  setosa
    Sepal.Length Sepal.Width Petal.Length Petal.Width Species
 1:          5.1         3.5           NA         0.2    <NA>
 2:          4.9         3.0          1.4         0.2  setosa
 3:          4.7         3.2          1.3         0.2    <NA>
 4:           NA         3.1           NA         0.2  setosa
 5:          5.0         3.6           NA         0.2  setosa
 6:          5.4         3.9          1.7         0.4  setosa
 7:          4.6         3.4           NA          NA    <NA>
 8:           NA         3.4          1.5         0.2  setosa
 9:          4.4          NA          1.4         0.2    <NA>
10:          4.9         3.1          1.5         0.1  setosa

miceRanger documentation built on Sept. 6, 2021, 5:07 p.m.