Learn R Programming

EFAtools (version 0.8.0)

print.COMPARE: Print and format a COMPARE object

Description

print() shows a summarised output of the COMPARE() function: the mean (with its range), median, the number of decimals to which all numbers agree, and the minimum number of decimals provided, 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 COMPARE
print(x, ...)

# S3 method for 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 COMPARE (output from 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(IDS2_R, n_factors = 5, type = "SPSS")

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

# compare the two
comp <- 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