make_mean_diffs: Make Mean Differences

View source: R/helpers_regression.R

make_mean_diffsR Documentation

Make Mean Differences

Description

This function calculates differences and means of a given variable for each kinship pair. The order of subtraction and the variables' names in the output dataframe depend on the order column set by check_sibling_order(). If the demographics parameter is set to "race", "sex", or "both", it also prepares demographic information accordingly, swapping the order of demographics as per the order column.

Usage

make_mean_diffs(
  data,
  id,
  sex,
  race,
  demographics,
  variable,
  pair_identifiers,
  row,
  coding_method = "none"
)

Arguments

data

The data set with kinship pairs

id

Default's to NULL. If supplied, must specify the column name corresponding to unique kinship pair identifiers.

sex

A character string for the sex column name.

race

A character string for the race column name.

demographics

Indicator variable for if the data has the sex and race demographics. If both are present (default, and recommended), value should be "both". Other options include "sex", "race", or "none".

variable

outcomes and predictors for manipulating the data

pair_identifiers

A character vector of length two that contains the variable identifier for each kinship pair

row

The row number of the data frame

coding_method

A character string that indicates what kind of additional coding schemes should be used. Default is none. Other options include "binary" and "multi".


smasongarrison/discord documentation built on March 4, 2024, 12:55 p.m.