fa_plot_loadings | R Documentation |
Returns a ggplot2 plot with sorted loadings colored by the analysis they belong to. Supports reversing of any factors that are reversed. Dodges to avoid overplotting.
fa_plot_loadings(
fa_objects,
fa_labels = NA,
factor_names = NA,
reverse_vector = NA,
reorder = "mean",
clean_factor_labels = T,
clean_indicator_labels = T
)
fa_objects |
(list of fa-class objects) Factor analyses objects from the fa() function from the |
fa_labels |
(chr vector) Names of the analyses. |
factor_names |
(chr vectr) Names of the factors if multiple. |
reverse_vector |
(num vector) Vector of numbers to use for reversing factors. Use e.g. c(1, -1) to reverse the second factor. Defaults not reversing. |
reorder |
(chr scalar or NA) Which factor analysis to order the loadings by. Can be integers that reprensent each factor analysis. Can also be "mean", "median" to use the means and medians of the loadings. Use "all" for the old method. Default = "mean". |
Non-overlapping indicates are put in the bottom. Note that internally, x and y coods have been flipped, so to modify the scales, use the opposite command, e.g. ylim to modify x axis limits.
library(psych)
fa_plot_loadings(fa(iris[-5])) #extract 1 factor and plot
fa_plot_loadings(fa(iris[-5], 2)) #extract 2 factors and plot
#list of FAs
fa_list = list(part1 = fa(iris[1:50, -c(1, 5)]),
part2 = fa(iris[51:100, -c(2, 5)]),
part3 = fa(iris[101:150, -c(3, 5)]))
#notice that it handles non-overlapping indicators
fa_plot_loadings(fa_list)
#reorder by a particular FA
fa_plot_loadings(fa_list, reorder = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.