View source: R/dataReduction.R
factorAnalysis | R Documentation |
This is a wrapper for the psych
functions psych::pca()
and psych::fa()
to produce output that it similar to the output produced by jamovi.
factorAnalysis( data, nfactors, items = names(data), rotate = "oblimin", covar = FALSE, na.rm = TRUE, kaiser = 1, loadings = TRUE, summary = FALSE, correlations = FALSE, modelFit = FALSE, eigenValues = FALSE, screePlot = FALSE, residuals = FALSE, itemLabels = items, colorLoadings = FALSE, fm = "minres", digits = 2, headingLevel = 3, ... ) principalComponentAnalysis( data, items, nfactors, rotate = "oblimin", covar = FALSE, na.rm = TRUE, kaiser = 1, loadings = TRUE, summary = FALSE, correlations = FALSE, eigenValues = FALSE, screePlot = FALSE, residuals = FALSE, itemLabels = items, colorLoadings = FALSE, digits = 2, headingLevel = 3, ... ) rosettaDataReduction_partial( x, digits = x$input$digits, headingLevel = x$input$headingLevel, echoPartial = FALSE, partialFile = NULL, quiet = TRUE, ... ) ## S3 method for class 'rosettaDataReduction' knit_print( x, digits = x$input$digits, headingLevel = x$input$headingLevel, echoPartial = FALSE, partialFile = NULL, quiet = TRUE, ... ) ## S3 method for class 'rosettaDataReduction' print( x, digits = x$input$digits, headingLevel = x$input$headingLevel, forceKnitrOutput = FALSE, ... )
data |
The data frame that contains the |
nfactors |
The number of factors to extract, or ' |
items |
The items to analyse; if not specified, all variables
in |
rotate |
Which rotation to use; see |
covar |
Whether to analyse the correlation matrix ( |
na.rm |
Whether to first remove all cases with missing values. |
kaiser |
The minimum eigenvalue when applying the Kaiser criterion (see
|
loadings |
Whether to display the component or factor loadings. |
summary |
Whether to display the factor or component summary. |
correlations |
Whether to display the correlations between factors of components. |
modelFit |
Whether to display the model fit Only for EFA). |
eigenValues |
Whether to display the eigen values. |
screePlot |
Whether to display the scree plot. |
residuals |
Whether to display the matrix with residuals. |
itemLabels |
Optionally, labels to use for the items (optionally, named,
with the names corresponding to the |
colorLoadings |
Whether, when producing an Rmd partial (i.e. when
calling the command while knitting) to colour the cells using
|
fm |
The method to use for the factor analysis: ' |
digits |
The number of digits to round to. |
headingLevel |
The number of hashes to print in front of the headings when printing while knitting |
... |
Any additional arguments are passed to |
x |
The object to print. |
echoPartial |
Whether to show the executed code in the R Markdown
partial ( |
partialFile |
This can be used to specify a custom partial file. The
file will have object |
quiet |
Passed on to |
forceKnitrOutput |
Force knitr output. |
The code in these functions uses parts of the code in jamovi, written by Jonathon Love and Ravi Selker.
An object with the object resulting from the call to the
psych
functions and some extracted information that will be printed.
### Load example dataset data("pp15", package="rosetta"); ### Get variable names with expected ### effects of a high dose of MDMA items <- grep( "highDose_AttBeliefs_", names(pp15), value=TRUE ); ### Do a factor analysis rosetta::factorAnalysis( data = pp15, items = items, nfactors = "eigen", scree = TRUE ); if (FALSE) { ### To get more output, show the ### output as Rmd Partial in the viewer, ### and color/size the factor loadings rosetta::rosettaDataReduction_partial( rosetta::factorAnalysis( data = pp15, items = items, nfactors = "eigen", summary = TRUE, correlations = TRUE, colorLoadings = TRUE ) ); }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.