# NOT RUN {
# Example 1
get_layout("c", NA, "d",
NA, "e", NA, rows = 2)
# Example 2
library(lavaan)
fit <- cfa(' visual =~ x1 + x2 + x3 ',
data = HolzingerSwineford1939[1:50, ])
get_layout(fit)
# }
# NOT RUN {
# Example 3
# Here, we first write the layout to .csv, but you could create it in a
# spreadsheet program, and save the spreadsheet to .csv:
write.csv(matrix(c("c", "", "d", "", "e", ""), nrow = 2, byrow = TRUE),
file = file.path(tempdir(), "example3.csv"), row.names = FALSE)
# Now, we load the .csv:
read.csv(file.path(tempdir(), "example3.csv"))
# Example 4
# For this example, make your layout in a spreadsheet program, select it, and
# copy to clipboard. Reading from the clipboard works differently in Windows
# and Mac. For this example, I used Microsoft Excel.
# On Windows, run:
read.table("clipboard", sep = "\t")
# On Mac, run:
read.table(pipe("pbpaste"), sep="\t")
# }
Run the code above in your browser using DataLab