Re: [R] jump in sequence

2007-01-30 Thread Ben Fairbank
Or perhaps rep(4:6,3)+9*rep(0:2,rep(3,3)) with changes as necessary for longer sequences Ben Fairbank -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Adrian DUSA Sent: Tuesday, January 30, 2007 8:29 AM To: r-help@stat.math.ethz.ch Subject: [R] jump

Re: [R] jump in sequence

2007-01-30 Thread Robin Hankin
> f <- function(n){as.vector(sweep(matrix(4:6,nrow=3,ncol=n),2,seq (from=0,by=9,len=n),"+"))} > f(10) [1] 4 5 6 13 14 15 22 23 24 31 32 33 40 41 42 49 50 51 58 59 60 67 68 69 76 77 78 85 86 87 > HTH rksh On 30 Jan 2007, at 14:29, Adrian DUSA wrote: > Dear list, > > This should be a s

Re: [R] jump in sequence

2007-01-30 Thread Adrian Dusa
On Tuesday 30 January 2007 16:38, Peter Dalgaard wrote: > >[...snip...] > Is this it? > > > as.vector(outer(0:2,seq(4,22,9),"+")) > > [1] 4 5 6 13 14 15 22 23 24 Indeed it is :)) Thanks, Adrian -- Adrian Dusa Romanian Social Data Archive 1, Schitu Magureanu Bd 050025 Bucharest sector 5 Romani

Re: [R] jump in sequence

2007-01-30 Thread Martin Becker
Adrian DUSA wrote: > Dear list, > > This should be a simple one, I just cannot see it. > I need to generate a sequence of the form: > 4 5 6 13 14 15 22 23 24 > > That is: starting with 4, make a 3 numbers sequence, jump 6, then another 3 > and so on. > I can create a whole vector with: > myvec <-

Re: [R] jump in sequence

2007-01-30 Thread Benilton Carvalho
is it sth like: as.integer(sapply(seq(4, 22, by=9), seq, length.out=3)) you're looking for? b On Jan 30, 2007, at 9:29 AM, Adrian DUSA wrote: > Dear list, > > This should be a simple one, I just cannot see it. > I need to generate a sequence of the form: > 4 5 6 13 14 15 22 23 24 > > That is

Re: [R] jump in sequence

2007-01-30 Thread Peter Dalgaard
Adrian DUSA wrote: > Dear list, > > This should be a simple one, I just cannot see it. > I need to generate a sequence of the form: > 4 5 6 13 14 15 22 23 24 > > That is: starting with 4, make a 3 numbers sequence, jump 6, then another 3 > and so on. > I can create a whole vector with: > myvec <-

[R] jump in sequence

2007-01-30 Thread Adrian DUSA
Dear list, This should be a simple one, I just cannot see it. I need to generate a sequence of the form: 4 5 6 13 14 15 22 23 24 That is: starting with 4, make a 3 numbers sequence, jump 6, then another 3 and so on. I can create a whole vector with: myvec <- rep(rep(c(F, T, F), rep(3, 3)), 3)