Re: [R] permutates and/or samples a matrix

2008-01-31 Thread David Winsemius
David Winsemius <[EMAIL PROTECTED]> wrote : > On 31 Jan 2008, Stanley wrote: >> sample(x) only permutates and/or samples from a vector, which I >> can't use for a matrix. Please help. > > You just feed sample(.) a "redimensioned" object. If you need to do > it programmatically just multiply the

Re: [R] permutates and/or samples a matrix

2008-01-31 Thread Gabor Csardi
I mean On Thu, Jan 31, 2008 at 02:32:20PM +0100, Gabor Csardi wrote: > What exactly is the question? Selecting/permuting rows? > > M[sample(length=nrow(M), count), ] M[sample(seq(length=nrow(M)), count), ] > Selecting/permuting columns? > > M[ , sample(length=ncol(M), count) ] M[ , sample(seq

Re: [R] permutates and/or samples a matrix

2008-01-31 Thread David Winsemius
On 31 Jan 2008, you wrote in gmane.comp.lang.r.general: > Hi, > > sample(x) only permutates and/or samples from a vector, which I > can't use for a matrix. Please help. You just feed sample(.) a "redimensioned" object. If you need to do it programmatically just multiply the dimensions of the

Re: [R] permutates and/or samples a matrix

2008-01-31 Thread Gabor Csardi
What exactly is the question? Selecting/permuting rows? M[sample(length=nrow(M), count), ] Selecting/permuting columns? M[ , sample(length=ncol(M), count) ] Permuting elements? structure(sample(M), dim=dim(M)) Selecting elements? sample(M, count) Gabor On Thu, Jan 31, 2008 at 09:10:11PM +0

[R] permutates and/or samples a matrix

2008-01-31 Thread Ng Stanley
Hi, sample(x) only permutates and/or samples from a vector, which I can't use for a matrix. Please help. Thanks Stanley [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEA