Re: [R] reformatting some data

2012-12-05 Thread David Winsemius
On Dec 4, 2012, at 1:44 PM, arun wrote: Hi, You can also do this: dat1<-structure(list(group = c(4L, 3L, 4L, 4L, 4L, 2L), X3.Hydroxybutyrate = c(4e-04, 5e-04, 4e-04, 6e-04, 5e-04, 7e-04), X3.Hydroxyisovalerate = c(3e-04, 3e-04, 3e-04, 3e-04, 3e-04, 4e-04), ADP = c(5e-04, 6e-04, 6e-04, 5e

Re: [R] reformatting some data

2012-12-04 Thread arun
Hi, You can also do this: dat1<-structure(list(group = c(4L, 3L, 4L, 4L, 4L, 2L), X3.Hydroxybutyrate =  c(4e-04,  5e-04, 4e-04, 6e-04, 5e-04, 7e-04), X3.Hydroxyisovalerate = c(3e-04,  3e-04, 3e-04, 3e-04, 3e-04, 4e-04), ADP = c(5e-04, 6e-04, 6e-04,  5e-04, 7e-04, 7e-04)), .Names = c("group", "X3.Hy

Re: [R] reformatting some data

2012-12-04 Thread arun
Hi, Not sure whether this helps: library(reshape2) dat1<-structure(list(group = c(4L, 3L, 4L, 4L, 4L, 2L), X3.Hydroxybutyrate =  c(4e-04,  5e-04, 4e-04, 6e-04, 5e-04, 7e-04), X3.Hydroxyisovalerate = c(3e-04,  3e-04, 3e-04, 3e-04, 3e-04, 4e-04), ADP = c(5e-04, 6e-04, 6e-04,  5e-04, 7e-04, 7e-04)),

Re: [R] reformatting some data

2012-12-04 Thread Mark Lamias
That should read the "reshape" package -- not the "shape" package.  My apologies. To: Charles Determan Jr ; "r-help@r-project.org" Sent: Tuesday, December 4, 2012 4:36 PM Subject: Re: [R] reformatting some data It's

Re: [R] reformatting some data

2012-12-04 Thread Mark Lamias
It's not clear to me what it is you are attempting to do, as you switch from a very specific example to some general example with the vague terms "var1" "var2", and "var3." It sounds like you might be trying to do something similar to what would be available in the shape package using the melt