Re: [R] transform variables

2013-08-27 Thread Xochitl CORMON
You have what is called a "wide" table and you want a "tall" table. In this case the function melt from reshape2 package is suitable. Be careful specifying properly the variables (columns) you want to use for the reshape using correct syntax. ?melt {reshape2} You can also use as already sugges

Re: [R] transform variables

2013-08-26 Thread arun
.abb))) colnames(yrmon3)<- colnames(res3)  row.names(yrmon3)<- row.names(res3)  identical(res3,yrmon3) #[1] TRUE A.K. - Original Message - From: arun To: catalin roibu Cc: Jim Lemon ; R help Sent: Monday, August 26, 2013 9:08 AM Subject: Re: [R] transform variables HI, You could also

Re: [R] transform variables

2013-08-26 Thread arun
01 2 -0.2318646 #1.3 1901 3 -0.1961822 #1.4 1901 4  0.5609812 #1.5 1901 5  0.5713866 #1.6 1901 6 -1.5676166 A.K. - Original Message - From: Jim Lemon To: catalin roibu Cc: r-help@r-project.org Sent: Monday, August 26, 2013 7:45 AM Subject: Re: [R] transform variable

Re: [R] transform variables

2013-08-26 Thread Gerrit Eichner
Catalin, first, keep the communication on the list, so it gets documented also for others. Second, my code does work for an example I made up myself, but if you don't "provide commented, minimal, self-contained, reproducible code" (as the posting guide asks you to; see last line of this e-ma

Re: [R] transform variables

2013-08-26 Thread Erich Neuwirth
Have a look at the packages reshape and reshape2 They were written with this type of problems in mind. On Aug 26, 2013, at 1:04 PM, catalin roibu wrote: > Dear all! > > I have a data frame composed by 13 columns (year, and 12 months). I want to > transform this data base in another like this >

Re: [R] transform variables

2013-08-26 Thread Jim Lemon
On 08/26/2013 09:04 PM, catalin roibu wrote: Dear all! I have a data frame composed by 13 columns (year, and 12 months). I want to transform this data base in another like this year month values 1901 1 1901 2 1901 3 . 1901 12 1902 1 1902 2 1902 12 Is there a possibility to succeed t

Re: [R] transform variables

2013-08-26 Thread Gerrit Eichner
Hello, Catalin, assume your data frame is as simple as A <- data.frame( year = , month01 = , , + month12 = ) then, e.g., reshape( A, varying = c( "month01", , "month12"), + v.names = "Values", timevar = "Month", direction = "long") should do what you want

[R] transform variables

2013-08-26 Thread catalin roibu
Dear all! I have a data frame composed by 13 columns (year, and 12 months). I want to transform this data base in another like this year month values 1901 1 1901 2 1901 3 . 1901 12 1902 1 1902 2 1902 12 Is there a possibility to succeed that in R? Thank you! best regards! CR -- --