umx_wide2longTwinData: Change twin data from wide (2 twins per row) to long format.

umx_wide2longTwinDataR Documentation

Change twin data from wide (2 twins per row) to long format.

Description

Just detects the data columns for twin 1, and twin 2, then returns them stacked on top of each other (rbind) with the non-twin specific columns copied for each as well.

*Note*, zygosity codings differ among labs. One scheme uses 1 = MZFF, 2 = MZMM, 3 = DZFF, 4 = DZMM, 5 = DZOS or DZFM, 6 = DZMF, with 9 = unknown, and then 50, 51,... for siblings.

Typically, OS twins are ordered Female/Male.

Usage

umx_wide2longTwinData(data, sep = "_T", verbose = FALSE)

Arguments

data

a dataframe containing twin data.

sep

the string between the var name and twin suffix, i.e., var_T1 = _T

verbose

Report the non-twin and twin columns (default = FALSE).

Value

- long-format dataframe

See Also

[reshape()], [umx_wide2long()], [umx_merge_randomized_columns()], [umx_select_valid()]

Other Twin Data functions: umx, umx_long2wide(), umx_make_TwinData(), umx_make_twin_data_nice(), umx_residualize(), umx_scale_wide_twin_data()

Examples

long = umx_wide2longTwinData(data = twinData, sep = "")
long = umx_wide2longTwinData(data = twinData, sep = "", verbose = TRUE)
str(long)
str(twinData)

tbates/umx documentation built on April 13, 2025, 7:22 a.m.