Skip to content
Prev 247881 / 398503 Next

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

I would think that the following code should work:

newcodesM = reshape(codesM, id=1)

If other variables in the data.frame are factors, reshape thinks all of them are ID variables and tries to use all of them as "keys". Specifying the id variable you want to keep (I used id=1 since "key" is in the 1st column) will probably solve the issue. 

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