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,