IQSS / Amelia

Amelia: A Package for Missing Data
http://gking.harvard.edu/amelia
61 stars 17 forks source link

Error: Subscript `AMr1.orig` is a matrix, the data `x.imp[, -possibleFactors][AMr1.orig]` must have size 1 #47

Open vincentarelbundock opened 1 year ago

vincentarelbundock commented 1 year ago

In case you had not seen this StackOverflow error report from 2020:

https://stackoverflow.com/questions/64056125/how-to-fix-erreur-subscript-amr1-orig-is-a-matrix-the-data-x-imp-possib

I just ran into the same problem. The solution is simple. Just add this to convert x to data frame if it is a tibble:

if (inherits(x, "tbl_df")) {
  x <- as.data.frame(x)
}
vincentarelbundock commented 1 year ago

FWIW, I ran into this issue with a complex dataset today. Hard to create a minimal reproducible example, but the SO question and answer have a lot of likes and comments, so I think the bug should be treated as "replicated on several machines."

mecoskun commented 11 months ago

Ran into this problem recently, and spent an hour trying to understand what was wrong. Fortunately, the SO post helped me resolve it. A bug fix would be helpful.