yrosseel/lavaan

Increase the `rotation.args$target` element limit in lavaan

Closed this issue · 1 comments

While using lavaan for Exploratory Factor Analysis (EFA) with a target rotation, I encountered an error when attempting to use a target matrix with more than 1000 elements. The error message is as follows:

Error: lavaan->lav_options_check():  
   Length of option 'rotation.args$target' value must be maximum 1000.

The limitation appears to be defined in the lav_options_default function, where the oklen for rotation.args$target is set to (0L, 1000L):

elm(c("rotation.args", "target"), matrix(0, 0, 0), oklen = c(0L, 1000L))
elm(c("rotation.args", "target.mask"), matrix(0, 0, 0), oklen = c(0L, 1000L))

This constraint prevents the analysis of target matrices with dimensions larger than approximately 60 itemsx20 factors for example

I modified the lav_options_default function locally to increase the limit, which resolved the issue. However, this workaround is not ideal for reproducibility or users unfamiliar with internal modifications.

Indeed. That was just a mistake. It was never the intention to have such a small upper limit. The new upper limit is now 1e+32. Fixed on github.

Thanks for reporting this!