I have a dataframe in R that I want to randomize, keeping the first column like it is but randomizing the last two columns together, so that values that appear in the same rows in these columns will appear in the same row both after randomizing. So if I started with this:
1 a b c
2 d e f
3 g h i
when randomized it might look like:
1 a e f
2 d h i
3 g b c
I know that sample works fine but does it conserve the columns equivalence?
1 Answer