composite: Create a Composite Factor

View source: R/composite.R

compositeR Documentation

Create a Composite Factor

Description

Create a composite factor from a list of variables. A composite factor can be formed using a mean, sum, factor analysis, or principal components.

Usage

composite(
  x,
  name = NULL,
  variables,
  type = "mean",
  standardize = TRUE,
  missing_allowed = NULL
)

Arguments

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


EngleLab/englelab documentation built on Sept. 9, 2024, 4:12 a.m.