Displaying 2 results from an estimated 2 matches for "rep_times".
2014 Mar 23
1
A rep_each function
...tions 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?
--
Re...
2014 Mar 26
2
R-devel Digest, Vol 133, Issue 23
...in 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 think this is exactly the wrong approach. Indeed, the aim should be
to get rid of functions like rep.int (or at least discourage their
use, even if they have to be kept for compatibility).
Why is rep_each(x,n) better than rep(x,each=n)? There is no saving in
typing...