View source: R/code_template.R
| code_template | R Documentation |
Default R code template used by semproducible when generating
the code.
code_template()
The template is a string with R code that contain placeholders in the form
of variables like %%NAME%%. The variables are replaced with
actual content of the SEM model during code generation.
Placeholder variables:
%%FORMULA%% = lavaan formula.
%%OBSERVATIONS%% = number of observations of the actual data.
%%VARIABLES%% = column names (variable names) of
the covariance matrix.
%%VALUES%% = actual values of the covariance matrix.
%%LAVAAN_CALL%% = lavaan function
call.
%%COVMAT_VARIABLE%% = variable name of the covariance matrix.
%%FIT_VARIABLE%% = variable name of the lavaan object that
is created from lavaan.
a character string with the R code template.
data <- data.frame(x = rnorm(100), y = rnorm(100)) code <- semproducible(data, formula="y ~ x", template = code_template()) # Modify code template template <- paste(code_template(), "\n# Adds a comment at end") code <- semproducible(data, formula="y ~ x", template = template) # Look at the new code code
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.