Re: [R] a sequence that wraps around

2009-09-16 Thread Jack Tanner
Szabolcs Horvát 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

Re: [R] a sequence that wraps around

2009-09-16 Thread Duncan Murdoch
On 9/16/2009 10:08 AM, Jack Tanner wrote: I'd like to have something like seq() where I can pass in a length of the desired sequence and a right limit so that the sequence goes up to the limit and then starts again from 1. # works now seq(from=2, length.out=3) [1] 2 3 4 # what I want seq(from=2

Re: [R] a sequence that wraps around

2009-09-16 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Jack Tanner > Sent: Wednesday, September 16, 2009 7:08 AM > To: r-h...@stat.math.ethz.ch > Subject: [R] a sequence that wraps around > > I'd li

Re: [R] a sequence that wraps around

2009-09-16 Thread Szabolcs Horvát
On 2009.09.16. 16:08, Jack Tanner wrote: I'd like to have something like seq() where I can pass in a length of the desired sequence and a right limit so that the sequence goes up to the limit and then starts again from 1. Disclaimer: total R beginner here (started to learn a 1 day ago), who j

Re: [R] a sequence that wraps around

2009-09-16 Thread Jack Tanner
Henrique Dallazuanna gmail.com> writes: > Try rep: > > rep(2:4, length.out = 3, times = 10) That's close, but it doesn't wrap to start at 1. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting

Re: [R] a sequence that wraps around

2009-09-16 Thread Henrique Dallazuanna
Try rep: rep(2:4, lenght.out = 3, times = 10) On Wed, Sep 16, 2009 at 11:08 AM, Jack Tanner wrote: > I'd like to have something like seq() where I can pass in a length of the > desired sequence and a right limit so that the sequence goes up to the limit > and > then starts again from 1. > > # w

[R] a sequence that wraps around

2009-09-16 Thread Jack Tanner
I'd like to have something like seq() where I can pass in a length of the desired sequence and a right limit so that the sequence goes up to the limit and then starts again from 1. # works now seq(from=2, length.out=3) [1] 2 3 4 # what I want seq(from=2, length.out=3, rlimit=3) [1] 2 3 1 # addit