is_within: Check whether levels of a factor are within- or between-...

Description Usage Arguments Details Examples

View source: R/misc.R

Description

Check whether levels of a factor are within- or between- unit.

Usage

1

Arguments

data

Unquoted name of a data frame.

x

Unquoted name of variable to check.

unit

Unquoted name of sampling unit factor.

Details

First checks whether the factor x is between unit by testing that each sampling unit has only a single level. If not, then the factor is assumed to be within. The user is warned if some units are missing levels. This behavior can be turned off by wrapping the call in suppressWarnings().

Examples

1
2
3
4
d <- data.frame(
  subject = rep(1:2, each = 2),
  A = rep(paste0("A", 1:2), 2),
  B = rep(paste0("B", 1:2), each = 2))

dalejbarr/exchangr documentation built on March 26, 2021, 9:49 p.m.