I would like to randomly reorder each column separately between given blocks of rows of a data frame. The row blocks are consecutive as shown:
mylist=list(1:50,51:52,53:102,103:128,129:154,155:180,181:206,207:232,233:258,259:284,285:310,311:336,337:362,363:388,389:414,415:440,441:466,467:492,493:518,519:544,545:570,571:596,597:622,623:648,649:674,675:700)
Say I have a data.frame called dat. It is 700 rows and 50 columns. So basically, for each of these 26 row blocks, I would like each column to be randomly reordered within.
An example with a smaller data.frame could be A =
1 1 1 1 1
2 2 2 2 2
3 3 3 3 3
4 4 4 4 4
5 5 5 5 5
6 6 6 6 6
7 7 7 7 7
8 8 8 8 8
9 9 9 9 9
where each row bin is as follows:
mylist=list(1:2,3:6,7:9)
could lead to the reordered data frame B=
1 2 1 1 1
2 1 2 2 2
3 4 3 5 3
4 6 4 3 4
5 5 5 6 5
6 3 6 4 6
8 9 8 7 9
9 7 9 8 8
7 8 7 9 7
Thank you.