Learn R Programming

EFAtools (version 1.0.0)

print.efa_compare: Print and format an efa_compare object

Description

print() shows a summarised output of the efa_compare() function: the mean (with its range), median, and root mean squared distance (RMSE) of the differences, the number of decimals to which all numbers agree, the minimum number of decimals provided, and (for matrices) the number of differing indicator-to-factor correspondences, followed (optionally) by the table of elementwise differences. format() assembles the same report and returns it as a character vector; print() is cat(format(x), sep = "\n"). The lines follow the active console theme, so they are plain when colours are disabled (for example when captured into a file or stripped with cli::ansi_strip()).

Usage

# S3 method for efa_compare
print(x, ...)

# S3 method for efa_compare format(x, ...)

Value

print() returns its argument x invisibly. format() returns a character vector with the report lines (styled to the active console theme; plain when colours are disabled).

Arguments

x

An object of class efa_compare (output from efa_compare()).

...

Not used; for consistency with the generic.

Examples

Run this code
# A type SPSS EFA to mimick the SPSS implementation
EFA_SPSS_5 <- efa_fit(IDS2_R, n_factors = 5,
                      estimate_control = estimate_control(type = "SPSS"),
                      rotate_control = rotate_control(type = "SPSS"))

# A type psych EFA to mimick the psych::fa() implementation
EFA_psych_5 <- efa_fit(IDS2_R, n_factors = 5,
                       estimate_control = estimate_control(type = "psych"),
                       rotate_control = rotate_control(type = "psych"))

# compare the two
comp <- efa_compare(EFA_SPSS_5$unrot_loadings, EFA_psych_5$unrot_loadings,
                    x_labels = c("SPSS", "psych"))
comp

# format() returns the same lines as plain text:
writeLines(format(comp))

Run the code above in your browser using DataLab