Hi, Check out the the melt function in the "reshape" package. Here is a quick tutorial: http://www.statmethods.net/management/reshape.html or the author's homepage: http://had.co.nz/reshape/
I think this will do what you want. Richard Erickson On Fri, Jun 15, 2012 at 1:13 AM, Peter Houk <[email protected]> wrote: > Greetings - > > I have a question regarding a relatively simple data transformation, and > wondering if it can be automated in R (or any other platform). For large > input datasets with numeric density and size, is there a function that can > reformat the data into a single vector for statistical analyses? > > For instance, for the two column dataset: > > numeric density size 5 5 4 8 3 9 4 10 > > How could the following output vector be automated: > > > size 5 5 5 5 5 8 8 8 8 9 9 9 10 10 10 10 > Last, what if there was a third column for 'location', and the desired > output would be a single vector for each location? > > I appreciate any assistance. It seems like a straightforward process, but > I can't find any example code in the reference books I have. > > Regards, > > Peter > > > > -- > Peter Houk, PhD > Chief Biologist > Pacific Marine Resources Institute > www.pacmares.com > www.micronesianfishing.com >
