impute | R Documentation |
Imputes blanks and NAs in dataset by various methods.
impute(
data,
method = "mice",
mice_method = NULL,
pred_ignore = c(),
impute_ignore = c(),
pred_matrix = NULL,
impute_outlier = Inf,
seed = 628
)
data |
dataset to be analysed. |
method |
method of imputation. Possible methods are "mice" or "mean/mode". |
mice_method |
the method of imputation used by the |
pred_ignore |
columns in dataset to be not used in data imputation process. Only required if |
impute_ignore |
columns in dataset to be not imputed. |
pred_matrix |
optional pre-defined prediction matrix to derive the imputed values when using the "mice" method. |
impute_outlier |
a numeric where values which are |
seed |
seed for |
Imputes missing values (blanks or NAs) in dataset. There are two possible methods of imputation. If method
= "mean/mode", then all missing values in numeric variables will be imputed with its mean and all missing values in
factor variables will be imputed with its mode.
If method
= "mice", then imputation will be performed using the mice
package. The imputation method performed by
mice
can be selected using the mice_method
parameter. A single method can be specified, which will be applied to
all eligible variables in the dataset, or a vector of methods for each variable (including variables listed in
impute_ignore
) can be specified. If the mice_method
parameter is not used, then the default methods selected by
mice
will be used. The pred_ignore
parameter is only applicable when using the "mice" method. This specifies
which variables should not be used in the data imputation process.
imputed data.table.
## Not run:
if(interactive()){
data(property_prices)
impute(property_prices)
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.