% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/print.efa_compare.R
\name{print.efa_compare}
\alias{print.efa_compare}
\alias{format.efa_compare}
\title{Print and format an efa_compare object}
\usage{
\method{print}{efa_compare}(x, ...)

\method{format}{efa_compare}(
  x,
  digits = NULL,
  m_red = NULL,
  range_red = NULL,
  round_red = NULL,
  print_diff = NULL,
  ...
)
}
\arguments{
\item{x}{An object of class \code{efa_compare} (output from \code{\link[=efa_compare]{efa_compare()}}).}

\item{...}{Passed from \code{print()} to \code{format()}; not otherwise used.}

\item{digits, m_red, range_red, round_red, print_diff}{Display controls, documented
in \code{\link[=efa_compare]{efa_compare()}}. Each defaults to \code{NULL}, meaning the value \code{efa_compare()}
recorded in \code{x$settings} is used; supplying one overrides it for this call
only, so the comparison need not be recomputed to change the printed report.}
}
\value{
\code{print()} returns its argument \code{x} invisibly. \code{format()} returns a
character vector with the report lines.
}
\description{
\code{print()} shows a summarised output of the \code{\link[=efa_compare]{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. \code{format()} assembles the same report and returns it
as a character vector; \code{print()} is \code{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
\code{\link[cli:ansi_strip]{cli::ansi_strip()}}).
}
\details{
The line reporting the minimum number of decimals provided is shown only when it
carries information: two ordinary double matrices carry the full double precision,
for which the count is uninformative and the line is omitted.

The summary statistics are absolute differences, so they carry no direction. The
elementwise differences are signed, and the table is headed by the direction of the
subtraction, named with the \code{x_labels} recorded by \code{\link[=efa_compare]{efa_compare()}} (\code{"x"} and \code{"y"} by
default): a negative cell means the first solution is the lower of the two there.
}
\examples{
# 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 a character vector:
writeLines(format(comp))

# the display settings can be changed without recomputing the comparison:
print(comp, digits = 2, print_diff = FALSE)

}
