Re: [R] making dataframes

2011-03-16 Thread Bill.Venables
Firstly, the way you have constructed your data frame in the example will convert everything to factors. What you need to do is actually a bit simpler: ### dum <- data.frame(date, col1, col2) ### One way to turn this into the kind of data frame you want is to convert the main part of i

Re: [R] making dataframes

2011-03-16 Thread Henrique Dallazuanna
Try this: reshape(dum, direction = 'long', idvar = 'date', varying = list(c('col1', 'col2'))) On Wed, Mar 16, 2011 at 11:28 AM, pelt wrote: > Dear all, > > I have a dataframe which looks like this (dummy): > > date<-c("jan", "feb", "mar", "apr", "may", "june", "july", > "aug","sep","oct","nov","

Re: [R] making dataframes

2011-03-16 Thread Scott Chamberlain
require(reshape2) melt(dum, id = 1) On Wednesday, March 16, 2011 at 9:28 AM, pelt wrote: Dear all, > > I have a dataframe which looks like this (dummy): > > date<-c("jan", "feb", "mar", "apr", "may", "june", "july", > "aug","sep","oct","nov","dec") > col1<-c(8.2,5.4,4.3,4.1,3.1,2.5,1.1,4.5,3.2,1