Skip to content

Commit c08891b

Browse files
committed
docs
1 parent 884d74c commit c08891b

File tree

7 files changed

+43
-45
lines changed

7 files changed

+43
-45
lines changed

R/principal_components.R

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,26 @@
99
#' @param x A data frame or a statistical model.
1010
#' @param n Number of components to extract. If `n="all"`, then `n` is set as
1111
#' the number of variables minus 1 (`ncol(x)-1`). If `n="auto"` (default) or
12-
#' `n=NULL`, the number of components is selected through [`n_factors()`] resp.
13-
#' [`n_components()`]. Else, if `n` is a number, `n` components are extracted.
14-
#' If `n` exceeds number of variables in the data, it is automatically set to
15-
#' the maximum number (i.e. `ncol(x)`). In [`reduce_parameters()`], can also
16-
#' be `"max"`, in which case it will select all the components that are
17-
#' maximally pseudo-loaded (i.e., correlated) by at least one variable.
12+
#' `n=NULL`, the number of components is selected through [`n_factors()`]
13+
#' resp. [`n_components()`]. Else, if `n` is a number, `n` components are
14+
#' extracted. If `n` exceeds number of variables in the data, it is
15+
#' automatically set to the maximum number (i.e. `ncol(x)`). In
16+
#' [`reduce_parameters()`], can also be `"max"`, in which case it will select
17+
#' all the components that are maximally pseudo-loaded (i.e., correlated) by
18+
#' at least one variable.
1819
#' @param rotation If not `"none"`, the PCA / FA will be computed using the
19-
#' **psych** package. Possible options include `"varimax"`,
20-
#' `"quartimax"`, `"promax"`, `"oblimin"`, `"simplimax"`,
21-
#' or `"cluster"` (and more). See [`psych::fa()`] for details.
20+
#' **psych** package. Possible options include `"varimax"`, `"quartimax"`,
21+
#' `"promax"`, `"oblimin"`, `"simplimax"`, or `"cluster"` (and more). See
22+
#' [`psych::fa()`] for details.
2223
#' @param sparse Whether to compute sparse PCA (SPCA, using [`sparsepca::spca()`]).
2324
#' SPCA attempts to find sparse loadings (with few nonzero values), which improves
2425
#' interpretability and avoids overfitting. Can be `TRUE` or `"robust"` (see
2526
#' [`sparsepca::robspca()`]).
2627
#' @param sort Sort the loadings.
2728
#' @param threshold A value between 0 and 1 indicates which (absolute) values
2829
#' from the loadings should be removed. An integer higher than 1 indicates the
29-
#' n strongest loadings to retain. Can also be `"max"`, in which case it
30-
#' will only display the maximum loading per variable (the most simple
31-
#' structure).
30+
#' n strongest loadings to retain. Can also be `"max"`, in which case it will
31+
#' only display the maximum loading per variable (the most simple structure).
3232
#' @param standardize A logical value indicating whether the variables should be
3333
#' standardized (centered and scaled) to have unit variance before the
3434
#' analysis (in general, such scaling is advisable).
@@ -445,9 +445,10 @@ principal_components.data.frame <- function(x,
445445
threshold = NULL,
446446
original_data = NULL,
447447
...) {
448-
if (!(rotation %in% c("varimax", "quartimax", "promax", "oblimin", "simplimax", "cluster", "none"))) {
449-
insight::format_error("`rotation` must be one of \"varimax\", \"quartimax\", \"promax\", \"oblimin\", \"simplimax\", \"cluster\" or \"none\".")
450-
}
448+
rotation <- insight::validate_argument(
449+
rotation,
450+
c("varimax", "quartimax", "promax", "oblimin", "simplimax", "cluster", "none")
451+
)
451452

452453
if (!inherits(x, c("prcomp", "data.frame"))) {
453454
insight::format_error("`x` must be of class `prcomp` or a data frame.")

man/convert_efa_to_cfa.Rd

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/display.parameters_model.Rd

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/model_parameters.principal.Rd

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/principal_components.Rd

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/reduce_parameters.Rd

Lines changed: 7 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/reshape_loadings.Rd

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)