Skip to content
Prev 314529 / 398502 Next

Make a column from columns

On 01/03/2013 04:00 PM, Aseem Sharma wrote:
Hi Aseem,
This is a "reshape" problem. There is a "reshape" function in the stats 
package that comes with R that will do this. Say your data frame is 
named "mydata" and the columns are named "year" and "Jan" to "Dec":

reshape(mydata,varying=month.abb,v.names="month",
  timevar="year",direction="long")

Jim