Is it possible to change the default delimiter when cast (dcast) assigns new column headers?
I convert the file from long to wide, and get the following headers:
value_1, value_2, value_3,...
In change mode, you can assign the sep parameter (sep = "") and display the column headers as I want them:
value1, value2, value3,...
However, my data frame requires more than 200,000 rows, while dcast takes seconds. dcast also displays the columns in the order I want, where reshape is not. Is there an easy way to change the output using dcast or do I need to manually change the column headers?
For instance:
example <- data.frame(id=rep(c(1,2,3,4),4),index=c(rep(1,4),rep(2,4),rep(1,4),rep(2,4)),variable=c(rep("resp",8),rep("conc",8)),value=rnorm(16,5,1))
dcast(example,id~variable+index)
The example shows the column headings:
conc_1, conc_2, resp_1, resp_2
I want the column headers to be read:
conc1, conc2, resp1, resp2
I tried:
dcast(example,id~variable+index,sep="")
dcast seems to completely ignore sep, as providing a character also does not change the result.