Skip to content
Prev 247885 / 398503 Next

How to reshape wide format data.frame to long format?

On Jan 20, 2011, at 10:51 AM, Fredrik Karlsson wrote:

            
I don't "see" anything special about this. If there is an unusual  
aspect to it, then you should post a simpler full example.  What  
happens when you try:

library(reshape2)

longCodes <- melt(codesM)

(Then you can fiddle with the names() of the new dataframe.)
Use strsplit and "["

If that's not clear, then post results of dput( codesM[1:5, 1:10] ) to  
provide a reproducible example.