[R] randomize the order of rows in a matrix or table

Berton Gunter gunter.berton at gene.com
Wed Dec 8 19:13:07 CET 2004


?sample

as in rand.rowx <- x[sample(nrow(x)),]

-- Bert Gunter
Genentech Non-Clinical Statistics
South San Francisco, CA
 
"The business of the statistician is to catalyze the scientific learning
process."  - George E. P. Box
 
 

> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Andreas
> Sent: Wednesday, December 08, 2004 5:23 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] randomize the order of rows in a matrix or table
> 
> Hello,
> 
> is there any function to randomize the order of rows in 
> matrix. My dataset
> for suport vector mashines is in the order first the samples 
> of class1 and
> then the samples for class2. For the training of the svm I 
> need this dataset
> randomized in its order.
> 
> regards Andreas
> 
> ______________________________________________
> 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
>




More information about the R-help mailing list