discord_data: Restructure Data

Description Usage Arguments Value

View source: R/discord_data.R

Description

Restructure wide form data into analyzable data, sorted by outcome.

Usage

1
2
discord_data(doubleentered = F, outcome = NULL, predictors = NULL,
  sep = "", scale = T, df = NULL, id = NULL, full = T)

Arguments

doubleentered

Describes whether data are double entered. Default is FALSE.

outcome

Name of outcome variable

predictors

Names of predictors. Default is to use all variables in df that are not the outcome.

sep

The character in df that separates root outcome and predictors from mean and diff labelscharacter string to separate the names of the predictors and outcomes from kin identifier (1 or 2). Not NA_character_.

scale

If TRUE, rescale all variables at the individual level to have a mean of 0 and a SD of 1.

df

Dataframe with all variables in it.

id

id variable (optional).

full

If TRUE, returns kin1 and kin2 scores in addition to diff and mean scores. If FALSE, only returns diff and mean scores.

Value

Returns data.frame with the following variables:

id

id

outcome_1

outcome for kin1; kin1 is always greater than kin2, except when tied. Then kin1 is randomly selected from the pair

outcome_2

outcome for kin2

outcome_diff

difference between outcome of kin1 and kin2

outcome_mean

mean outcome for kin1 and kin2

predictor_i_1

predictor variable i for kin1

predictor_i_2

predictor variable i for kin2

predictor_i_diff

difference between predictor i of kin1 and kin2

predictor_i_mean

mean predictor i for kin1 and kin2


discord documentation built on May 29, 2017, 9:06 a.m.