[Rd] A rep_each function
hpages at fhcrc.org
Mon Mar 24 06:37:38 CET 2014
On 03/23/2014 05:42 AM, Richard Cotton wrote:
> 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.)
I agree that rep_times() would be a much better name. Because rep.int()
looks like an S3 method for rep(), 'R CMD check' emits the following
NOTE on the BiocGenerics package (where rep.int() is turned into an
* checking Rd \usage sections ... NOTE
S3 methods shown with full name in documentation object 'rep':
The \usage entries for S3 methods should use the \method markup and not
their full name.
See the chapter ‘Writing R documentation files’ in the ‘Writing R
> 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?
Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024
E-mail: hpages at fhcrc.org
Phone: (206) 667-5791
Fax: (206) 667-1319
More information about the R-devel