con_check: Check connectedness of multiple factors in a dataframe

View source: R/functions.R

con_checkR Documentation

Check connectedness of multiple factors in a dataframe

Description

Multiple factors in a dataframe are said to be connected if a model matrix based on those factors is full rank.

This function provides a formula interface to the lfe::compfactor() function to check for connectedness of the factors.

Usage

con_check(data = NULL, formula = NULL, WW = TRUE, dropNA = TRUE)

Arguments

data

A dataframe

formula

A formula with multiple factor names in the dataframe, like y ~ f1 + f2 + f3

WW

Pass-through argument to compfactor

dropNA

If TRUE, observed data that are NA will be dropped.

Value

A vector with integers representing the group membership of each observation.

Author(s)

Kevin Wright

References

None

Examples

# In the data_eccleston dataframe, each pair of factors is connected.
con_check(data_eccleston, ~ row + trt)
con_check(data_eccleston, ~ col + trt)
con_check(data_eccleston, ~ row + col)
# But all three factors are COMPLETELY disconnected into 16 groups.
con_check(data_eccleston, ~ row + col + trt)


connected documentation built on April 12, 2025, 2:24 a.m.