I am using the MICE package to impute missing values in financial time series data (Foreign Exchange Rates). 
The mice() imputation worked fine for all my data sets except one. I get the following error when I try to use mice():
Error in cor(xobs[, keep, drop = FALSE], use = "all.obs") : 'x' is empty
I have tried fixing the problem by:
- Changing the format of the data to array and a matrix
- Taking subsets of the data.
But the above approaches have got me no results.
Here is a reproducible example:
#library used
library(mice)
#Generate dataset
Repdata <- matrix(data = c(1    , 40546,  0.0016,   -0.0053,    -0.0003, -0.0012,  0.0012,   0.0051, -0.0005,   -0.0008,  0.0057, -0.0068,
                       2    , 40547,  0.012 ,  0.0047,   0.0139,  NA      ,  0.0026,    -0.0073, -0.0001,    0.0087,  0.0058, -0.0049,
                       3    , 40548,  0.0067,    0.0009,     0.0157, -0.0009,  0.0118,   0.0047,  0.0003,    0.0079,  0.0102,   0.0006,
                       4    , 40549,  0.0045,   -0.0022,     0.0046,  0.0037,  0.0106,   0.0029,  0.0004,   -0.0022,  0.0041, -0.0017,
                       5    , NA,     0.0007,   -0.0027,     NA   ,   0.0002,  0.0073,  -0.0023, -0.0003,    0.0023,  0.0003,   0.0019,
                       6    , 40551,  0.0005,    0.0006,     0.0005,  NA      ,  NA    ,    0.001,  NA    , -0.0013,  0.0013,   0.0001,
                       7    , 40553,  0.0014,    0.0008,     0.0008,  0.0009, -0.0004,  -0.0031,  0.0006,    0.0029, -0.0059,   0.0016,
                       8    , 40554,  0.0069,   -0.0034,     0.0052, -0.002 , -0.0024,  -0.0029, -0.0001,   -0.007 , 0.0045 , -0.005,
                       9    , 40555,  NA    ,   -0.0046,    -0.0018, -0.0028, -0.0085,  -0.0059, -0.0003,   -0.0017, -0.0003,   NA,
                       10   , 40556, -0.0057,    0.0026,    -0.0038,  0.0001, -0.0185,  -0.0086,  NA      ,  0.0013, -0.0045,   0.0003), nrow = 10, byrow = TRUE)
 #Impute missing values:
 mice(Repdata)
Error:
Error in cor(xobs[, keep, drop = FALSE], use = "all.obs") : 'x' is empty
 
    