Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

umx_make_twin_data_nice

Convert a twin dataset into umx standard format.


Description

umx_make_twin_data_nice is a function to convert your twin data into a format used across umx. Specifically:

  1. Existing column for zygosity is renamed to "zygosity".

  2. sep is set to "_T"

  3. The twinID is is set to sequential digits, i.e. 1,2...

Usage

umx_make_twin_data_nice(
  data,
  sep = "",
  zygosity = "zygosity",
  numbering,
  labelNumericZygosity = FALSE,
  levels = 1:5,
  labels = c("MZFF", "MZMM", "DZFF", "DZMM", "DZOS")
)

Arguments

data

a data.frame() to check/convert.

sep

existing separator string (will be updated to "_T").

zygosity

existing zygosity column name (will be renamed zygosity).

numbering

existing twin sequence string (will be updated to _T1, _T2, _T3).

labelNumericZygosity

If TRUE numeric zygosity levels will be set to labels.

levels

legal levels of zygosity (ignored if labelNumericZygosity = FALSE (default 1:5)

labels

labels for each zyg level c("MZFF", "MZMM", "DZFF", "DZMM", "DZOS").

Value

References

See Also

Examples

data(twinData)
tmp = twinData
tmp2 = umx_make_twin_data_nice(twinData, sep="", numbering = 1:5, zygosity="zygosity")
tmp$zygosity=NULL
tmp = umx_make_twin_data_nice(twinData, sep="", numbering = 1:5, zygosity="zygosity")
namez(tmp, "zyg")
levels(tmp$zygosity)

umx

Structural Equation Modeling and Twin Modeling in R

v4.10.10
GPL-3
Authors
Timothy C. Bates [aut, cre] (<https://orcid.org/0000-0002-1153-9007>), Gillespie Nathan [wit], Michael Zakharin [wit], Brenton Wiernik [ctb], Joshua N. Pritikin [ctb], Michael C. Neale [ctb], Hermine Maes [ctb]
Initial release
2021-11-30

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.