Re: [R] random sequence

2010-06-22 Thread David Winsemius
On Jun 22, 2010, at 7:15 AM, sta...@quo.org wrote: Hi Barbara, You could use: samples = matrix(rep(0,(5000*40)),ncol=40) for(i in 1:5000) { samples[i,] = sample(1:40,40) } Might also be a good time to use replicate(): samples = matrix(replicate(5000, sample(1:40) ), ncol=40, byrow=TRUE)

Re: [R] random sequence

2010-06-22 Thread status
Hi Barbara, You could use: samples = matrix(rep(0,(5000*40)),ncol=40) for(i in 1:5000) { samples[i,] = sample(1:40,40) } This will give you a matrix of samples, one per row. The second term in the "sample" function is the length of your sequence. By default "sample" samples without replaceme

[R] random sequence

2010-06-22 Thread Barbara . Rogo
I have a sequence of number from 1 to 40 and I have to extract a random sequence, for example: 1) 1, 2 3, 4, ...40 2) 2, 10, 9 , 25 e so on for 5000 times. How I can do Thanks [[alternative HTML version deleted]] __ R-help@r-project.org

Re: [R] Random sequence of days?

2008-08-19 Thread Lauri Nikkinen
; > so that the the days are adjacent... > > -Lauri > > 2008/8/20, Moshe Olshansky <[EMAIL PROTECTED]>: > > How about > > > > d[sample(length(d),10)] > > > > > > --- On Wed, 20/8/08, Lauri Nikkinen <[EMAIL PROTECTED]> wrote: > > &

Re: [R] Random sequence of days?

2008-08-19 Thread Lauri Nikkinen
25" so that the the days are adjacent... -Lauri 2008/8/20, Moshe Olshansky <[EMAIL PROTECTED]>: > How about > > d[sample(length(d),10)] > > > --- On Wed, 20/8/08, Lauri Nikkinen <[EMAIL PROTECTED]> wrote: > > > From: Lauri Nikkinen <[EMAIL PROTECTED]&g

Re: [R] Random sequence of days?

2008-08-19 Thread Jeff Newmiller
Lauri Nikkinen wrote: Dear list, I tried to find a solution for this problem from the archives but couldn't find any. I would like sample sequence of ten days from vector d d <- seq(as.Date("2007-02-12"), as.Date("2008-08-18"), by="days") so that the days follow each other (sample(d, 10) is no

Re: [R] Random sequence of days?

2008-08-19 Thread Moshe Olshansky
How about d[sample(length(d),10)] --- On Wed, 20/8/08, Lauri Nikkinen <[EMAIL PROTECTED]> wrote: > From: Lauri Nikkinen <[EMAIL PROTECTED]> > Subject: [R] Random sequence of days? > To: [EMAIL PROTECTED] > Received: Wednesday, 20 August, 2008, 4:04 PM > Dear l

[R] Random sequence of days?

2008-08-19 Thread Lauri Nikkinen
Dear list, I tried to find a solution for this problem from the archives but couldn't find any. I would like sample sequence of ten days from vector d d <- seq(as.Date("2007-02-12"), as.Date("2008-08-18"), by="days") so that the days follow each other (sample(d, 10) is not the appropriate soluti