factor_plot | R Documentation |
PCA is performed using add_factors.
factor_plot(
data,
cols,
newcols = NULL,
k = 2,
method = "pca",
labels = TRUE,
clean = TRUE,
...
)
data |
A dataframe. |
cols |
A tidy selection of item columns. If the first column already contains a pca from add_factors, the result is used. Other parameters are ignored. If there is no pca result yet, it is calculated by add_factors first. |
newcols |
Names of the factor columns as a character vector. Must be the same length as k or NULL. Set to NULL (default) to automatically build a name from the common column prefix, prefixed with "fct_", postfixed with the factor number. |
k |
Number of factors to calculate.
Set to NULL to generate a scree plot with eigenvalues for all components up to the number of items
and automatically choose k. Eigenvalues and the decision on k are calculated by
|
method |
The method as character value. Currently, only pca is supported. |
labels |
If TRUE (default) extracts labels from the attributes, see codebook. |
clean |
Prepare data by data_clean. |
... |
Placeholder to allow calling the method with unused parameters from plot_metrics. |
A ggplot object.
library(volker)
ds <- volker::chatgpt
volker::factor_plot(ds, starts_with("cg_adoption"), k = 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.