hide_values | R Documentation |
A convenient function that randomly introduces missing values to an at-least-bivariate data set. The user can specify either the proportion of observations that contain some missing values or the exact number of observations that contain some missing values. Note that the function does not guarantee that underlying missing-data mechanism to be missing at random (MAR).
hide_values(X, prop_cases = 0.1, n_cases = NULL)
X |
An |
prop_cases |
(optional) Proportion of observations that contain some missing values.
|
n_cases |
(optional) Number of observations that contain some missing values.
|
If subject to missingness, an observation can have at least 1 and at
most ncol(X) - 1
missing values. Depending on the data
set, it is not guaranteed that the resulting matrix will have the number of
rows with missing values matches the specified proportion.
The orginal n
by d
matrix or data frame with missing values.
set.seed(1234)
hide_values(iris[1:4])
hide_values(iris[1:4], prop_cases = 0.5)
hide_values(iris[1:4], n_cases = 80)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.