generateSplits {rapidsplithalf}R Documentation

A balanced split-half generator

Description

Generates split-half indices that can be stratified by multiple subgroup variables while guaranteeing near-equal numbers of trials in both halves.

Usage

generateSplits(data, subsetvars, stratvars = NULL, splits, verbose = TRUE)

Arguments

data

A dataset to generate split-halves from.

subsetvars

Variables identifying subgroups that must be individually split into equally sized halves, e.g. participant number and experimental condition.

stratvars

Variables identifying subgroups that are nested within the subsetvars, and must be split as fairly as possible, while preserving the equal size of the two halves of each subset identified by the subsetvars, e.g. stimulus ID.

splits

How many splits to generate.

verbose

Display progress bar?

Value

A logical matrix in which each row represents a row of the input dataset, and each column represents a single split.

Examples

data(foodAAT)
mysplits<-generateSplits(data=foodAAT,
                         subsetvars=c("subjectid","is_pull","is_target"),
                         stratvars="stimid",
                         splits=1)
half1<-foodAAT[ mysplits[,1],]
half2<-foodAAT[!mysplits[,1],]


[Package rapidsplithalf version 0.2 Index]