Re: [R] use of do.call and rep

About this list Date view Thread view Subject view Author view Attachment view

From: Prof Brian Ripley (ripley@stats.ox.ac.uk)
Date: Wed 26 May 2004 - 06:44:23 EST


Message-id: <Pine.LNX.4.44.0405252142180.28532-100000@gannet.stats>

rep(1:2, each=5) is simpler to parse and comprehend, but I don't think
efficiency comes into this. Did you have some very much larger example in
mind.

On Tue, 25 May 2004, Laura Holt wrote:

> If I use this:
>
> rep(1:2,c(5,5))
>
> I'll get
> 1 1 1 1 1 2 2 2 2 2
>
> Is there a way to do this more efficiently, please?
> Maybe via do.call?

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________ R-help@stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Mon 31 May 2004 - 23:05:12 EST