https://github.com/IvanVoronin/FAT
This package provides a web-widget for interactive presentation of results from exploratory factor analysis. The function loadings2table
accepts a matrix, a data frame or an output from fa
function (from the psych
package).
## Install the package
# install.packages('devtools')
library(devtools)
install_github('ivanvoronin/FAT')
# Load packages
library(FAT)
library(psych)
## This is the toy data from psych
## Details in ?bfi
data(bfi)
bfi[, 1:25]
bfi <-
## The BFI items will appear in hint popover on click
c(
hints <-A1 = "Am indifferent to the feelings of others. (q_146)",
A2 = "Inquire about others' well-being. (q_1162)",
A3 = "Know how to comfort others. (q_1206)",
A4 = "Love children. (q_1364)",
A5 = "Make people feel at ease. (q_1419)",
C1 = "Am exacting in my work. (q_124)",
C2 = "Continue until everything is perfect. (q_530)",
C3 = "Do things according to a plan. (q_619)",
C4 = "Do things in a half-way manner. (q_626)",
C5 = "Waste my time. (q_1949)",
E1 = "Don't talk a lot. (q_712)",
E2 = "Find it difficult to approach others. (q_901)",
E3 = "Know how to captivate people. (q_1205)",
E4 = "Make friends easily. (q_1410)",
E5 = "Take charge. (q_1768)",
N1 = "Get angry easily. (q_952)",
N2 = "Get irritated easily. (q_974)",
N3 = "Have frequent mood swings. (q_1099)",
N4 = "Often feel blue. (q_1479)",
N5 = "Panic easily. (q_1505)",
O1 = "Am full of ideas. (q_128)",
O2 = "Avoid difficult reading material.(q_316)",
O3 = "Carry the conversation to a higher level. (q_492)",
O4 = "Spend time reflecting on things. (q_1738)",
O5 = "Will not probe deeply into a subject. (q_1964)"
)
Responsive table
This is a table that presents factor loadings interactively to simplify the exploration of factor analysis results.
- For a default sorting order, each item is assigned to a factor, the factor it loads most. The loadings are sorted in ascending order within the factor they assigned to. ‘Reorder’ button applies the default sorting scheme.
- Alternatively, the table can be sorted by a column by clicking on the header of this column.
- ‘Cutoff’ field defines the threshold value to filter the loadings. The values below the threshold are excluded. Mind that the there may be a delay between the change of cutoff and the update of the table.
- ‘Filter’ field allows filtering the items by their labels.
- Click on a row to get a hint with item’s content. Click again to close the hint. Double clink anywhere in the document closes all hints.
- Drag the index of a row to rearrange items’ order.
- Use export buttons beneath the table to copy or save as xlsx, csv or pdf.
loadings2table
integrates withpsych
package by extracting factor loadings and explained variance from the return offa
function. Otherwise, the loadings can be passed as matrix, refer to?loadings2table
.
## Factor analysis using psych
fa(bfi, nfactors = 5,
FA <-n.iter = 100)
## Render the table
loadings2table(FA,
hints = hints)