Learn R Programming

CCI (version 0.3.6)

permute_within_strata: Stratified permutation of x within strata

Description

Stratified permutation of x within strata

Usage

permute_within_strata(x, strata, seed = NULL)

Value

x_star permuted within strata.

Arguments

x

vector to permute.

strata

factor-like vector defining strata.

seed

optional seed for reproducibility.

Examples

Run this code
set.seed(123)
x <- 1:10
strata <- rep(letters[1:2], each = 5)
x_permuted <- permute_within_strata(x, strata, seed = 123)

Run the code above in your browser using DataLab