composite: Create a compositve variable

compositeR Documentation

Create a compositve variable

Description

This function will create a composite variable

Usage

composite(
  x,
  variables,
  type = "mean",
  standardize = TRUE,
  name = NULL,
  missing.allowed = NULL
)

Arguments

x

dataframe

variables

c() of columns to average together to create the composite

type

What type of composite should be calculated?, i.e. mean or sum. (Default = "mean").

standardize

Logical. Do you want to calculate the composite based on standardize (z-score) values? (Default = FALSE)

name

Name of the new composite variable

missing.allowed

Criteria for how many variables can having missing values and still calculate a composite

Examples

composite(x, variable = c(), type = "mean", name = "name")

dr-JT/datawrangling documentation built on June 25, 2022, 7:47 p.m.