I'm having trouble stacking columns in a data.frame into one column.
Now my data looks something like this:
I'm trying to transform the data.frame so that it looks like this:
I'm guessing that this problem requires using the reshape package,
but I'm not exactly sure how to use it to stack multiple columns under
one column. Can anyone provide help on this? |
|||
Here's melt from reshape:
And using reshape2 (an up-to-date, faster version of reshape ) the syntax is almost identical.The help files have useful examples (see ?melt and the link to melt.data.frame ). In your case, something like the following will work (assuming your data.frame is called DF )
|
No comments:
Post a Comment