[Rd] A rep_each function

Richard Cotton richierocks at gmail.com
Sun Mar 23 13:42:55 CET 2014


The rep function is very versatile, but that versatility comes at a
cost: it takes a bit of effort to learn (and remember) its syntax.
This is a problem, since rep is one of the first functions many
beginners will come across.  Of the three main uses of rep, two have
simpler alternatives.

rep(x, times = ) has rep.int
rep(x, length.out  = ) has rep_len

I think that a rep_each function would be a worthy addition for the
third use case

rep(x, each = )

(It might also be worth having rep_times as a synonym for rep.int.)

While this could go in a package, since one of its main benefits is to
help beginners, I feel it ought to go in base R.

Before I submit this as a feature request, I thought I'd check here to
see if there was any enthusiasm.  Does rep_len sound useful to you?

-- 
Regards,
Richie

Learning R <http://shop.oreilly.com/product/0636920028352.do>
4dpiecharts.com



More information about the R-devel mailing list