To fill NAs in numerical data with MICE algorithm, you can install mice package from CRAN, and call it as a Custom R Command Step.
Install mice package from CRAN. Here is an instruction to install a custom R package.
Keep only the numeric columns which you want to fill NAs with a Select step. You can create a Select step from a column header menu.
- Add a Custom R Command step to fill NAs with mice function with the following function expression. This expression is written in such a way that it takes a data frame as the first argument, and returns the resulting data frame, so that it works as a step in Exploratory.
- NAs are filled. Note that % of NAs are now all 0.
- To put back other columns, let’s create a branch from the step for the original data.
- On the branch, create a Select step, and this time remove the numeric columns we used for MICE, keeping only the other columns.
- Go back to the main branch, and bind the branch with the other columns that we just created.
- Now the original columns are put back with the NA-filled numeric columns!