Closed stefvanbuuren closed 4 years ago
To do: mice
should detect this case, and generate a proper error.
After commit ee3ac80 we now have
mice(nhanesTest)
Error in check.dataform(data) :
Cannot handle columns with class data.frame: testVar
For now this solves the cryptic error message.
For the future, it would be interesting to extend mice
to handle this case, for example, using the blocks
feature.
The following example was kindly contributed by Leonhard Bakker. It shows that
mice 3.6.0
does not work with nested data frames, for example, as created bytibble::add_column()
.Error description
When using the
mice()
function, the errorwas returned. The error originated from a coding error. A function returned a variable as a
data.frame
, which was added to the dataset using thetibble::add_column()
function. The dataset now comprised a variable with the classdata.frame
, which resulted in the error message.Generate the data
This error was replicated using the
mice::nhanes2
dataset. Thechl
variable is dropped first from the test dataset and subsequently thechl
variable is added as adata.frame
using thetibble::add_column()
function.Replicate the error