Hello, I am attempting to randomly select a data of equal length from my dataset. My dataset is of equal length each ranging from 1 to 16 rows. Since they are of equal length, I can form a matrix of equal length and rows or concatenate them into a data of 16n x 2 matrix where n is number of samples. I have reproduced small part of the data below.
Now the problem is how to select as many samples of the same length (i.e. 16 rows) as possible from the two dataset below. If the first is taken as X1 and the second as X2, manually selecting from the 4th row of X1 to 3rd row of X2 gives a data of length 16, from 5th row of X1 to 4th row of X2 gives a data of length 16, etc. This implies choosing any row from X1 and counting 15 rows down from that to get 16 rows. I can then concatenate these new samples to the original sample and sort them out to do my work. Doing this random selection manually when my dataset becomes larger may not be good. I will be obliged should anyone suggests how I can do this in R. Thank you Best regards Ogbos 1 703116 2 243714 3 297060 4 307697 5 296588 6 255266 7 297116 8 291530 9 239259 10 239126 11 212396 12 202471 13 227833 14 212977 15 207408 16 228564 1 230414 2 15372 3 19647 4 29523 5 26234 6 34766 7 16738 8 25215 9 20757 10 31250 11 27993 12 24441 13 19853 14 20751 15 7658 16 5934 [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.