[R] a sequence that wraps around

Jack Tanner ihok at hotmail.com
Wed Sep 16 18:11:21 CEST 2009


Szabolcs Horvát <szhorvat <at> gmail.com> writes:

> You could use the modulo operator.
> >
> > # additional examples of what I want
> > seq(from=2, length.out=4, rlimit=3)
> > [1] 2 3 1 2
> 
> seq(from=1, length.out=4) %% 3 + 1

Ah, that's so slick. You're off to a great start! Huge thanks to you and 
everyone else who responded.




More information about the R-help mailing list