-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error in colMeans(as.matrix(imp[[j]]), na.rm = TRUE) : 'x' must be numeric #601
Comments
Cannot reproduce with mice 3.16.8 nh3 <- mice::nhanes2
nh3$chl <- as.character(nh3$chl)
imp <- mice::mice(nh3)
#>
#> iter imp variable
#> 1 1 bmi hyp
#> 1 2 bmi hyp
#> 1 3 bmi hyp
#> 1 4 bmi hyp
#> 1 5 bmi hyp
#> 2 1 bmi hyp
#> 2 2 bmi hyp
#> 2 3 bmi hyp
#> 2 4 bmi hyp
#> 2 5 bmi hyp
#> 3 1 bmi hyp
#> 3 2 bmi hyp
#> 3 3 bmi hyp
#> 3 4 bmi hyp
#> 3 5 bmi hyp
#> 4 1 bmi hyp
#> 4 2 bmi hyp
#> 4 3 bmi hyp
#> 4 4 bmi hyp
#> 4 5 bmi hyp
#> 5 1 bmi hyp
#> 5 2 bmi hyp
#> 5 3 bmi hyp
#> 5 4 bmi hyp
#> 5 5 bmi hyp
#> Warning: Number of logged events: 1
imp$loggedEvents
#> it im dep meth out
#> 1 0 0 constant chl Created on 2023-11-20 with reprex v2.0.2 |
Ah, thanks. I forgot to mention that my test was calculated from the branch I will add a test to that branch to ban this baby from appearing in |
Test added to mice4 branch |
I got a report that the error may also appear in the CRAN version,
When I run this in my system, everything is fine. However some users report a crash with |
Describe the bug
MICE crashes on an incomplete character variable
To Reproduce
Created on 2023-11-20 with reprex v2.0.2
Expected behavior
mice()
should not touch or impute character variables.The text was updated successfully, but these errors were encountered: