Skip to content

Commit 8481a4a

Browse files
committed
Rename cor into correlation_matrix
1 parent 4c01573 commit 8481a4a

File tree

4 files changed

+91
-102
lines changed

4 files changed

+91
-102
lines changed

R/factor_analysis.R

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ factor_analysis <- function(x,
66
sort = FALSE,
77
threshold = NULL,
88
standardize = TRUE,
9-
cor = NULL,
9+
correlation_matrix = NULL,
1010
...) {
1111
UseMethod("factor_analysis")
1212
}
@@ -19,23 +19,29 @@ factor_analysis.data.frame <- function(x,
1919
sort = FALSE,
2020
threshold = NULL,
2121
standardize = TRUE,
22-
cor = NULL,
22+
correlation_matrix = NULL,
2323
...) {
2424
# Standardize
25-
if (standardize && is.null(cor)) {
25+
if (standardize && is.null(correlation_matrix)) {
2626
x <- datawizard::standardize(x, ...)
2727
}
2828

2929
# N factors
30-
n <- .get_n_factors(x, n = n, type = "FA", rotation = rotation, cor = cor)
30+
n <- .get_n_factors(
31+
x,
32+
n = n,
33+
type = "FA",
34+
rotation = rotation,
35+
correlation_matrix = correlation_matrix
36+
)
3137

3238
.factor_analysis_rotate(
3339
x,
3440
n,
3541
rotation = rotation,
3642
sort = sort,
3743
threshold = threshold,
38-
cor = cor,
44+
correlation_matrix = correlation_matrix,
3945
...
4046
)
4147
}
@@ -47,7 +53,7 @@ factor_analysis.data.frame <- function(x,
4753
rotation,
4854
sort = FALSE,
4955
threshold = NULL,
50-
cor = NULL,
56+
correlation_matrix = NULL,
5157
...) {
5258
if (!inherits(x, "data.frame")) {
5359
insight::format_error("`x` must be a data frame.")
@@ -58,8 +64,8 @@ factor_analysis.data.frame <- function(x,
5864
insight::format_error(sprintf("Package `psych` required for `%s`-rotation.", rotation))
5965
}
6066

61-
# Pass cor if available
62-
if (is.null(cor)) {
67+
# Pass correlation_matrix if available
68+
if (is.null(correlation_matrix)) {
6369
out <- model_parameters(
6470
psych::fa(x, nfactors = n, rotate = rotation, ...),
6571
sort = sort,
@@ -68,7 +74,7 @@ factor_analysis.data.frame <- function(x,
6874
} else {
6975
out <- model_parameters(
7076
psych::fa(
71-
cor,
77+
correlation_matrix,
7278
nfactors = n,
7379
rotate = rotation,
7480
n.obs = nrow(x),

0 commit comments

Comments
 (0)