The "measure variables" are tXX and lXX. I want to give the t's and the l's each their own column. This would be as simple as
Y <- melt(X, id.vars=c('origin','cluster','n','distance'))
Y <- cbind(Y, colsplit(Y$variable, split="(?<=[lt])", perl=TRUE,
names=c("var", "i")))
cast(Y, origin + cluster + distance + n + i ~ var)
if colsplit supported perl=TRUE, but it doesn't, and without that I see no way to do this short of reimplementing colsplit myself. The underlying strsplit does support perl=TRUE so it's as simple as accepting the argument and passing it down. (Note: in the present codebase, strsplit seems to have been replaced with a function str_split_fixed whose definition I cannot find.)
Motivating example: consider this cut-down data frame
The "measure variables" are tXX and lXX. I want to give the t's and the l's each their own column. This would be as simple as
if colsplit supported
perl=TRUE
, but it doesn't, and without that I see no way to do this short of reimplementing colsplit myself. The underlyingstrsplit
does supportperl=TRUE
so it's as simple as accepting the argument and passing it down. (Note: in the present codebase,strsplit
seems to have been replaced with a functionstr_split_fixed
whose definition I cannot find.)