View source: R/scramble_within_groups.R
scramble_within_groups | R Documentation |
Permutes the rows of a dataframe within groups.
scramble_within_groups(data, group_index)
data |
: A dataframe. One column is a categorical variable indicating group. |
group_index |
: Column index of the variable indicating group. |
: A dataframe with permuted rows. Rows are only permuted within groups. Permutations are done via sampling with replacement.
my_data <- data.frame(
Col1 = c(1, 2, 3, 4, 5, 6),
Col2 = c("A", "B", "A", "B", "C", "C"))
scramble_within_groups(my_data)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.