Learn R Programming

permutest (version 1.0.0)

permute_group: Unstratified group permutation

Description

This function takes a data frame and group column name as input and returns the dataframe with the group column randomly permuted

Usage

permute_group(df, group_col, strata_col = NULL, seed = NULL)

Value

The inputted data frame with the group column randomly shuffled

Arguments

df

A data frame

group_col

String, the name of the column in df that corresponds to the group label

strata_col

The name of the column in df that corresponds to the strata, should be NULL for unstratified permutation

seed

An integer seed value

Examples

Run this code
data <- data.frame(group_label = c(1, 2, 2, 1, 2, 1), outcome = 1:6)
permute_group(df = data, group_col = "group_label", strata_col = NULL, seed = 42)

Run the code above in your browser using DataLab