Learn R Programming

CCI (version 0.3.6.1)

make_strata_from_categorical_Z: Create strata from the categorical subset of Z

Description

Uses interaction() on the categorical Z columns only. Characters (and logicals, if enabled) are coerced to factor for stable behavior.

Usage

make_strata_from_categorical_Z(
  sub_data,
  Z,
  allow_character = TRUE,
  allow_logical = TRUE
)

Value

A factor defining strata (same length as nrow(sub_data)).

Arguments

sub_data

data.frame containing Z columns.

Z

character vector of Z column names.

allow_character

logical; treat character as categorical. Default TRUE.

allow_logical

logical; treat logical as categorical. Default TRUE.

Details

Rows with NA in any stratification column will receive NA strata.