Re: [R] reshape from wide to long, ordering of "varying"

2010-10-07 Thread stefan.d...@gmail.com
Thanks a lot! Both solutions work great! On Thu, Oct 7, 2010 at 7:19 PM, Gabor Grothendieck wrote: > On Thu, Oct 7, 2010 at 1:05 PM, stefan.d...@gmail.com > wrote: >> Hello, >> I have data in the following form >> >>      age sex Int.Prev.Est.1 Int.Prev.Est.2 Int.Prev.Est.3 >> Int.Prev.Est.4 Int

Re: [R] reshape from wide to long, ordering of "varying"

2010-10-07 Thread Gabor Grothendieck
On Thu, Oct 7, 2010 at 1:05 PM, stefan.d...@gmail.com wrote: > Hello, > I have data in the following form > >      age sex Int.Prev.Est.1 Int.Prev.Est.2 Int.Prev.Est.3 > Int.Prev.Est.4 Int.Prev.Est.5 > 93110  93   0       23.75482       57.86592       9.755003 > 4.343534       4.280714 > 93610  93

Re: [R] reshape from wide to long, ordering of "varying"

2010-10-07 Thread Henrique Dallazuanna
Try this: reshape(UK.INT, direction = 'long', varying = list(grep("Int.Prev.Est", names(UK.INT On Thu, Oct 7, 2010 at 2:05 PM, stefan.d...@gmail.com wrote: > Hello, > I have data in the following form > > age sex Int.Prev.Est.1 Int.Prev.Est.2 Int.Prev.Est.3 > Int.Prev.Est.4 Int.Prev.E

[R] reshape from wide to long, ordering of "varying"

2010-10-07 Thread stefan.d...@gmail.com
Hello, I have data in the following form age sex Int.Prev.Est.1 Int.Prev.Est.2 Int.Prev.Est.3 Int.Prev.Est.4 Int.Prev.Est.5 93110 93 0 23.75482 57.86592 9.755003 4.343534 4.280714 93610 93 1 53.36475 39.47247 4.381618 1.622119 1.159044 94

Re: [R] reshape from wide to long

2009-02-25 Thread Gabor Grothendieck
Try: reshape(x, dir = "long", idvar = 1, times = cn[-1], varying = list(cn[-1]), v.names = "X", timevar = "Name") On Wed, Feb 25, 2009 at 11:01 PM, Juliet Hannah wrote: > Out of curiosity, what would be a good way to do this without using > the reshape package? Thanks! > > On Wed, Feb 25, 2009

Re: [R] reshape from wide to long

2009-02-25 Thread hadley wickham
On Wed, Feb 25, 2009 at 10:01 PM, Juliet Hannah wrote: > Out of curiosity, what would be a good way to do this without using > the reshape package? Thanks! Well the core of the melt code is this: ids <- data[, var$id, drop = FALSE] df <- do.call("rbind", lapply(var$measure, function(x) {

Re: [R] reshape from wide to long

2009-02-25 Thread Juliet Hannah
Out of curiosity, what would be a good way to do this without using the reshape package? Thanks! On Wed, Feb 25, 2009 at 8:04 PM, jim holtman wrote: > You can use the 'reshape' package: > >> x <- read.table(textConnection(" Grp        X0        X3               X6     >>       X12          X25  

Re: [R] reshape from wide to long

2009-02-25 Thread jim holtman
You can use the 'reshape' package: > x <- read.table(textConnection(" GrpX0X3 X6 > X12 X25 X50 +1C 0.5326517 0.6930942 0.9403883 1.157571 2.483117 2.809012 + 2C 0.4715917 0.8613200 2.0706117 2.937632 7.530960 7.120678 + 3

Re: [R] reshape from wide to long

2009-02-25 Thread Rowe, Brian Lee Yung (Portfolio Analytics)
ehalf Of Veerappa Chetty Sent: Wednesday, February 25, 2009 5:00 PM To: r-help@r-project.org Subject: [R] reshape from wide to long Hi,I would like to reshape the following "wide" data set to "long" form. I would appreciate help with the

[R] reshape from wide to long

2009-02-25 Thread Veerappa Chetty
Hi,I would like to reshape the following "wide" data set to "long" form. I would appreciate help with the correct code for "reshape". I tried a few unsuccessfully. Thanks. Chetty __ dat.1 GrpX0X3 X6 X12