I am really baffled about why my imputation is failing in R's mice
package. I am attempting a very simple operation with the following data frame:
dfn <- read.table(text =
"a b c d
0 1 0 1
1 0 0 0
0 0 0 0
NA 0 0 0
0 0 0 NA", header = TRUE)
I then use mice in the following way to perform a simple mean imputation:
imp <- mice(dfn, method = "mean", m = 1, maxit =1)
filled <- complete(imp)
However, my completed data looks like this:
filled
# a b c d
#1 0.00 1 0 1
#2 1.00 0 0 0
#3 0.00 0 0 0
#4 0.25 0 0 0
#5 0.00 0 0 NA
Why am I still getting this trailing NA
? This is the simplest failing example I could construct, but my real data set is much larger and I am just trying to get a sense of where things are going wrong. Any help would be greatly appreciated!