Learn R Programming

umx (version 1.4.0)

umx_paste_names: umx_paste_names

Description

Helper to add suffixes to names: useful for expanding base names for variables (e.g. "bmi") into fully specified family-wise row names for variables c("bmi_T1", "bmi_T2") Use sep to add a constant like "_T" after each base variable name. This is then suffixed with e.g. "1", "2".

Usage

umx_paste_names(varNames, sep = "", suffixes = 1:2)

Arguments

varNames
a list of _base_ names, e.g c("bmi", "IQ")
sep
A string separating the name and the twin suffix, e.g. "_T" (default is "")
suffixes
a list of terminal suffixes differentiating the twins default = c("1", "2"))

Value

- vector of suffixed var names, i.e., c("a_T1", "b_T1", "a_T2", "b_T2")

References

- http://tbates.github.io, https://github.com/tbates/umx

See Also

Other Utility Functions: qm, umx_find_object, umx_grep, umx_msg, umx_names, umx_pb_note, umx_print, umx_rename, umx

Examples

Run this code
# two styles doing the same thing: first is more general
umx_paste_names("bmi", "_T", 1:2)
umx_paste_names("bmi", suffixes = c("_T1", "_T2"))
varNames = umx_paste_names(c("N", "E", "O", "A", "C"), "_T", 1:2)

Run the code above in your browser using DataLab