Skip to contents

Does every level of f1 occur in conjunction with exactly one level of f2? The function is based on converting a triplet sparse matrix to a compressed column-oriented form in which the nesting can be quickly evaluated.

Usage

isNested(f1, f2)

Arguments

f1

factor 1

f2

factor 2

Value

TRUE if factor 1 is nested within factor 2

Examples

  library(lme4)
  with(Pastes, isNested(cask, batch))   ## => FALSE
#> [1] FALSE
  with(Pastes, isNested(sample, batch))  ## => TRUE
#> [1] TRUE