Try this: transform(fish[rep(seq(nrow(fish)), fish$N),], N = 1)
On Wed, Feb 2, 2011 at 8:58 AM, Lucia Rueda <lucia.ru...@ba.ieo.es> wrote: > > Hi Ivan, > > Thanks for your reply. This is what I want to do: > > Imagine my dataset looks like this: > > Species N Size > Coris julis 1 8 > Coris julis 3 10 > D.vulgaris 2 12 > > I have 1 C.julis of 8 cm, 3 C. julis of 10 cm and 2 D.vulgaris of 12 cm. I > want 1 row for each animal, something like this: > > Species N Size > Coris julis 1 8 > Coris julis 1 10 > Coris julis 1 10 > Coris julis 1 10 > D.vulgaris 1 12 > D.vulgaris 1 12 > > I hope that helps. I tried reshape but couldn't do it and from what I've > seen I don't think that aggregate, unique or duplicated would do it... but > I'm not good with R so I can be wrong. > > Cheers! > > Lucia > > > -- > View this message in context: > http://r.789695.n4.nabble.com/reshape-data-adding-rows-to-dataframe-tp3253640p3253780.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[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.