Extract observed variable names referenced by a lavaan syntax string.
Source:R/fastsem.R
fastsem_sem_vars.RdParses the model syntax and returns only those variable names that are
also present in col_names. Useful for subsetting a data frame before
passing it to fastsem_fit().
Examples
if (FALSE) { # \dontrun{
syntax <- "f =~ y1 + y2 + y3\nf ~~ f\ny1 ~~ y1\ny2 ~~ y2\ny3 ~~ y3"
all_cols <- c("id", "y1", "y2", "y3", "y4", "group")
fastsem_sem_vars(syntax, all_cols)
# [1] "y1" "y2" "y3"
} # }