Description Usage Arguments Value Examples
This function randomly resamples observations separately for variables and groups (e.g., individual participants) so that meaningful information contained in the order of the observation gets lost, but each groups still has the same set of values.
1 |
data |
A data frame containing hierarchical data (e.g., time series data) |
ID |
The grouping variable (e.g., to distinguish participants from each other) |
variables |
A vector of variable names for which the order should be changed. |
The resampled data frame.
1 2 3 4 5 6 | tib <- dplyr::tibble(participant=rep(1:10, each=10), # grouping variable
happiness = rnorm(100, mean = 3.5, sd=1.7), # order should not be changed
stress = rnorm(100, mean = 2, sd= 1.3), # order should be changed
anxiety = rnorm(100, mean = 1.7, sd= 2)) # order should be changed
new_tib <- resample(tib, participant, c("stress", "anxiety"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.