Skip to content

Replicate

3 messages · André Luis Neves, Bert Gunter, Sarah Goslee

#
Hi, There!

I have this data frame:
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,
#
?rep  (to replicate indices)

plotdat2[rep(1:3,e=100), ]

This seemspretty basic. Have you gone through any R tutorials yet? If
not, please do so before posting further. There are many good ones on
the web.

Cheers,
Bert
Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
On Tue, Aug 23, 2016 at 10:54 AM, Andr? Luis Neves <andrluis at ualberta.ca> wrote:
#
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: