View source: R/IntroducingNA.R
| IntroducingNA | R Documentation |
'IntroducingNA' introduces missing values (NAs) to the specified data matrix.
IntroducingNA(dataMatrix, percentage = 0.05, ...)
dataMatrix |
Name of the input matrix (or list, or data frame). |
percentage |
Desired percentage of missing values (NAs) in each row. |
... |
Additional parameters passed to other functions. |
The procedure changes randomly some values in the specified matrix to "missing values" (denoted by NA).
Number of these missing values in each row is given by the parameter percentage.
If the input is a list of fuzzy numbers or data frame, then it is automatically converted to a matrix.
The output is given as a matrix.
# prepare matrix with 3 columns and 3 rows
matrix1 <- matrix(c(1,3,5,2,5,7,1,4,5),ncol=3,byrow = TRUE)
# add 1 NA in each row
set.seed(12345)
IntroducingNA(matrix1,percentage = 0.33)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.