[R-pkg-devel] New package with C++ code causes R abort in RStudio, not in R console.

Luc De Wilde Luc@DeW||de @end|ng |rom UGent@be
Tue Nov 12 15:06:53 CET 2024


Dear R package developers,

I'm helping with the development of the lavaan package (see https://lavaan.ugent.be/) and currently writing a C++ version of the parser of the model syntax in lavaan. The package with C++ code is in  https://github.com/lucdw/lavaanC. 

When testing with a bunch of models, there is one model that causes an abort of the R session in RStudio (on Windows), but in the R console or in a batch job it causes no errors. The model is the following : 
model <- ' 
    F1 =~ "a b"*X1
    F2 =~ a * X1 + 3*X2 # dat is hier een beetje commentaar
    # efa block 2
    efa("efa2")*f3 +
    efa("efa2")*f4 =~ y1 + y2 + y3 + y1:y3
    f4 := 3.14159 * F2
    F1 ~ start(0.76)*F2 + a*F2
    a == (b + f3)^2
    b1 > exp(b2 + b3) '

and the translation can be tested - after installing lavaanC - with 

lavaanC::lav_parse_model_string_c(model)

As mentioned, this causes an abort of the R session when executed in RStudio on Windows (10 or 11), but passes without problem in the R console or a batch job. 

Because many users are using RStudio I 'd like to tackle this problem, but don't know how to pinpoint the cause of the problem. I hope some of you have an idea how to handle this problem ...

All the best,


Luc De Wilde



More information about the R-package-devel mailing list