Hello, I am trying to reformat some data so that it is organized by group in the columns. The data currently looks like this:
group X3.Hydroxybutyrate X3.Hydroxyisovalerate ADP 347 4 4e-04 3e-04 5e-04 353 3 5e-04 3e-04 6e-04 359 4 4e-04 3e-04 6e-04 365 4 6e-04 3e-04 5e-04 371 4 5e-04 3e-04 7e-04 377 2 7e-04 4e-04 7e-04 I would like to reformat it so it is like this: 2 3 4 var1 var2 var3 I realize that there unequal numbers in each group but I would like to none-the-less if possible. Here is a subset of the data: 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.Hydroxybutyrate", "X3.Hydroxyisovalerate", "ADP"), row.names = c(347L, 353L, 359L, 365L, 371L, 377L), class = "data.frame") Any insight is truly appreciated, Regards, Charles [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.