
A Function That Writes, Saves, and Exports Syntax for Fitting the I-NULL model for indistinguishable dyads
Source:R/scriptINULL.R
scriptINULL.RdThis function takes the outputted object from scrapeVarCross() and automatically writes, returns, and exports (.txt) lavaan() syntax for the I-NULL model described in Olsen & Kenny (2006)
Arguments
- dvn
input dvn list from scrapeVarCross
- lvxname
input character to (arbitrarily) name X LV in lavaan syntax
- lvyname
(optional) input character to (arbitrarily) name Y LV in lavaan syntax
- writeTo
A character string specifying a directory path to where the output file(s) should be saved. If set to
".", the file(s) will be written to the current working directory. The default isNULL, and examples use a temporary directory created bytempdir(). When dealing with tabular output,writeTois only relevant ifgtTab = TRUE.- fileName
A character string specifying a desired base name for the output file. The default is
NULL. The specified name will be automatically appended with the appropriate file extension (e.g.,.txtforlavaanscripts,.rtffor tabular output whengtTab = TRUE, or other extensions as appropriate for the output type). If a file with the same name already exists in the user's chosen directory, it will be overwritten.
See also
scrapeVarCross which this function relies on
Other indistinguishable script-writing functions:
scriptISAT()
Examples
dvn <- scrapeVarCross(dat = DRES, x_order = "sip", x_stem = "PRQC", x_delim1 = "_",
x_delim2=".", x_item_num="\\d+", distinguish_1="1", distinguish_2="2")
#>
#> ── Variable Scraping Summary ──
#>
#> ✔ Successfully scraped 1 latent variable: PRQC
#> ℹ PRQC: 9 indicators for P1 (1), 9 indicators for P2 (2)
#> ℹ Total indicators: 18
qual.inull.script <- scriptINULL(dvn, lvxname = "Qual",
writeTo = tempdir(),
fileName = "I-NULL_script")