I have a vector column of ¨n¨ components as in the following example:
c(1,3,8,10,23,78,5,15,47,1,8,51)
How can I obtain a vector with R
in which a permutation is applied for every six elements?
For example, a possible first permutation with the first six elements is (8,1,78,3,10,23)
and another tentative permutation for the following six elements (47,8,15,1,51,5)
in this way the final column vector would be c (8,1,7,3,3,10,23,47,8,15,1,51,5).
There is in R, some function like SAMPLE that does this routine, or some lines of code for this routine are welcome.
Thank you.