Skip to contents

Generate EFA planning syntax

Usage

efa_syntax(
  items,
  nfactors = 1L,
  extraction = c("minres", "pa", "ml"),
  rotation = c("oblimin", "promax", "varimax"),
  data_name = "data"
)

Arguments

items

Character vector of item IDs.

nfactors

Number of factors.

extraction

Extraction method.

rotation

Rotation method.

data_name

Name of the data object in generated R code.

Value

A character string with R syntax.

Examples

syntax <- efa_syntax(c("sq_1", "sq_2", "sq_3"), nfactors = 1)
cat(syntax)
#> # EFA syntax generated by surveyframe
#> rlang::check_installed("psych", reason = "to estimate an EFA solution")
#> efa_items <- data[, c("sq_1", "sq_2", "sq_3")]
#> psych::fa(efa_items, nfactors = 1, fm = "minres", rotate = "oblimin")