options(conflicts.policy = "depends.ok") library(anchorMplus) library(psych) library(dplyr)
Say we want to do a CFA on the famous Big Five personality traits in
the psych::bfi
dataset.
BFI <- psych::bfi
Annotate each column with an R data type.
BFI %<>% mutate(across(matches("^[A-Z][1-5]$"), ordered, 1:6)) %>% mutate(across("gender", factor, 1:2, labels = c("M", "F"))) %>% mutate(across("education", ordered, 1:5)) BFI
Ordinal or dichotomous items are designated in Mplus syntax as follows:
mp_cat(BFI) %>% cat
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.