umx_wide2long: Change data family data from wide (2 twins per row) to long...

umx_wide2longR Documentation

Change data family 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_wide2long(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_merge_randomized_columns()], [umx_select_valid()]

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

Examples

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

tbates/umx documentation built on April 10, 2024, 8:14 p.m.