umx_explode_twin_names | R Documentation |
Break names like Dep_T1 into a list of base names, a separator, and a vector of twin indexes. e.g.: c("Dep_T1", "Dep_T2", "Anx_T1", "Anx_T2") will become:
list(baseNames = c("Dep", "Anx"), sep = "_T", twinIndexes = c(1,2))
umx_explode_twin_names(df, sep = "_T")
df |
vector of names or data.frame containing the data |
sep |
text constant separating name from numeric 1:2 twin index. |
- list(baseNames, sep, twinIndexes)
[umx_paste_names()]
Other String Functions:
umx_explode()
,
umx_grep()
,
umx_names()
,
umx_paste_names()
,
umx_rot()
,
umx_str_chars()
,
umx_str_from_object()
,
umx_trim()
,
umx
## Not run:
require(umx)
data("twinData")
umx_explode_twin_names(twinData, sep = "")
umx_explode_twin_names(twinData, sep = NULL)
# Ignore this: just a single-character/single variable test case
x = round(10 * rnorm(1000, mean = -.2))
y = round(5 * rnorm(1000))
x[x < 0] = 0; y[y < 0] = 0
umx_explode_twin_names(data.frame(x_T1 = x, x_T2 = y), sep = "_T")
umx_explode_twin_names(data.frame(x_T11 = x, x_T22 = y), sep = "_T")
umx_explode_twin_names(c("x_T11", "x_T22"), sep = "_T")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.