[R] permutation of rows of a matrix

Manuel López-Ibáñez manuellopezibanez at yahoo.es
Sat Apr 15 16:44:26 CEST 2006

help(sample) does not say anything about randomly permuting the rows of 
a matrix M by using M[sample(m,m),]. Perhaps it could be added as an 
example of use.

John Fox wrote:
> Dear Jose,
> M[sample(m, m),] will randomly permute the rows of M. [You probably could
> have figured this out via help.search("permutation"), which would have led
> you to sample().]
> Regards,
>  John
> --------------------------------
> John Fox
> Department of Sociology
> McMaster University
> Hamilton, Ontario
> Canada L8S 4M4
> 905-525-9140x23604
> http://socserv.mcmaster.ca/jfox 
> -------------------------------- 
>>-----Original Message-----
>>From: r-help-bounces at stat.math.ethz.ch 
>>[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of javargas
>>Sent: Saturday, April 15, 2006 7:53 AM
>>To: r-help at stat.math.ethz.ch
>>Subject: [R] permutation of rows of a matrix
>>How can I generate a random permutation between rows of a 
>>matrix M (of m rows and n columns)?
>>Thanks for your help,
>>R-help at stat.math.ethz.ch mailing list
>>PLEASE do read the posting guide! 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

LLama Gratis a cualquier PC del Mundo. 
Llamadas a fijos y móviles desde 1 céntimo por minuto. 

More information about the R-help mailing list