Skip to content
Prev 178927 / 398506 Next

How do I sample "cases" within a matrix?

Hi Silvia,
excuse me if I'm missing something but sampling the row numbers should make
it :

let M be your matrix, and spM a sample with n rows :
spM <- M[sample(seq(1,dim(M)[1],by=1), n),]

Regards, Olivier
Silvia Lomascolo wrote: