yrosseel / lavaan

an R package for structural equation modeling and more
http://lavaan.org
412 stars 99 forks source link

`{lavaan}` can't be installed on R < 4.1 #360

Closed IndrajeetPatil closed 1 week ago

IndrajeetPatil commented 3 weeks ago

Although DESCRIPTION file says R >= 3.4, the package can't be installed on older R versions:

* installing *source* package ‘lavaan’ ...
  ** package ‘lavaan’ successfully unpacked and MD5 sums checked
  staged installation is only possible with locking
  ** using non-staged installation
  ** R
  Error in parse(outFile) : 
    /tmp/RtmpSuPa5f/R.INSTALL1896434aa876/lavaan/R/lav_model_h1_information.R:762:22: unexpected input
  761:         B1c <-
  762:           lapply(zb, \
                            ^
  ERROR: unable to collate and parse R files for package ‘lavaan’

It's because the package is using syntax introduced in R 4.1:

https://github.com/yrosseel/lavaan/blob/cd5ec1ba89fc35871bbc5a5928491f05c07250b7/R/lav_model_h1_information.R#L761-L763

yrosseel commented 3 weeks ago

Indeed. Thanks for reporting this. I will adapt the syntax, because older versions of R are still widely used.

yrosseel commented 1 week ago

The code has been adapted in the github version, and lavaan should run (again) with older versions of R.