The resulting order preserves the original order, but shuffles (a) equal numeric entries (11, 11, 11) among each other and (b) shuffles equal letter entries ('A', 'A', 'B', 'B') in blocks so that the order within the letter is preserved, but the letters are randomly ordered.

shuffleWithBlocks(desired_order)

Arguments

desired_order

alphanumeric vector consisting of natural numbers and letters

Examples

desired_order = c(1,2,3,4,5,'A','A','B','B',10,11,11,11,11,15,16,17) shuffleWithBlocks(desired_order)
#> [1] 1 2 3 4 5 6 7 8 9 10 14 11 12 13 15 16 17