[R] Replicate

Sarah Goslee sarah.goslee at gmail.com
Tue Aug 23 21:09:42 CEST 2016


I'm not sure why you'd want to, but here's one way to do it:

plotdat2[rep(1:nrow(plotdat), each=100), ]

This puts all the replicates of each row together.


plotdat2[rep(1:nrow(plotdat), times=100), ]

while this repeats each row then starts over.

If that answer doesn't make sense, then you should definitely go read
some of the great introductory material on R out there.

Sarah


On Tue, Aug 23, 2016 at 1:54 PM, André Luis Neves <andrluis at ualberta.ca> wrote:
> Hi, There!
>
> I have this data frame:
>
>> plotdat2
>   Firmicutes    Lower    Upper fTissue2
> 1   63.48023 59.15983 68.11614   CAECUM
> 2   61.42512 57.24651 65.90875    COLON
> 3   44.68343 41.62523 47.96632    RUMEN
>
>
> How can I replicate each line 100 times?
>
> I`m new in R command line, so sorry if my question is nonsense.
>
> Thanks,
>
> --
> A
> LAN
>



More information about the R-help mailing list