Stop lavaan's `sem()` function to print output

30 views Asked by At

I am trying to run Monte Carlo simulations using R with the lavaan package and its function sem(). However, at every iteration, the output of sem() is showed, which is not very convenient. Is there a known way to stop that.

Here is a minimal example.

library(lavaan)
x = rnorm(100)
y = rnorm(100)
res = summary(sem("y ~ x"))

I have tried suppressMessage(), invisible() so far. I have found nothing in the various documentation.

Thank you,

0

There are 0 answers