composite | R Documentation |
Create a composite factor from a list of variables. A composite factor can be formed using a mean, sum, factor analysis, or principal components.
composite(
x,
name = NULL,
variables,
type = "mean",
standardize = TRUE,
missing_allowed = NULL
)
x |
data frame |
name |
Name of the new composite variable |
variables |
c() of columns to average together to create the composite |
type |
What type of composite should be calculated? options are "mean", "sum", "fa" (factor analysis using psych::fa), or "pca" (principal component analysis using psych::pca). Default is "mean" |
standardize |
Logical. Do you want to calculate the composite based on standardize (z-score) variables? (Default = TRUE) |
missing_allowed |
Criteria for how many variables can having missing values and still calculate a composite |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.