4

I have a matrix of 10 classes (2089 rows and 112 colunms).

 0   1  2   3  4   5   6   7  8  9   
482 60 404 134 60 339 376 66 63 105

I want to split the matrix randomly in three sets of proportion: 60, 20 and 20 % respectively with keeping the proportion classes in each set as in the original matrix.

I cheked Stratified random sampling from data frame but it's not the same question.

The first column of the matrix contains the classes indexes from 0 to 9. I want to do the split in 60, 20 and 20 % according to this column. For example the 9th class contains 63 observations (3%). The three parts must contains 3% of this class.

Noura
  • 474
  • 2
  • 11

0 Answers0