Given a data.table such as:
data.table::data.table(a = c(1,2,3), b = c("red","blue","yellow"), c = c(TRUE, FALSE, TRUE), d = c(21, 45, 34, 26))
a b c d
1: 1 red TRUE 21
2: 2 blue FALSE 45
3: 3 yellow TRUE 34
4: 4 green FALSE 26
where a is a unique row identifier, how could I randomize/anonymize the data so that the columns shuffle within their own column. This would create a random data.table that looks something like:
a b c d
1: 1 green TRUE 26
2: 2 yellow FALSE 45
3: 3 red FALSE 21
4: 4 blue TRUE 34