yrosseel/lavaan

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

IndrajeetPatil opened this issue · 2 comments

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

* installing *source* packagelavaan...
  ** packagelavaansuccessfully 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 packagelavaan

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

B1c <-
lapply(zb, \(z) tcrossprod(z - zbar)) |>
Reduce(f = `+`)

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

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