Learn R Programming

lfe (version 1.0-418)

compfactor: Finding the connection components

Description

'compfactor' computes the connection components of the dummy-part of the model with multiple fixed effects.

Usage

compfactor(fl)

Arguments

fl
a list of factors defining the fixed effects

Value

  • A factor of the same length as the factors in the input argument. It defines the connection components. E.g. nlevels(compfactor(fl)) will yield the number of connection components.

Examples

Run this code
## create two factors
f1 <- factor(sample(300,400,replace=TRUE))
f2 <- factor(sample(300,400,replace=TRUE))

## find the components
cf <- compfactor(list(f1=f1,f2=f2))

## show the third largest component
fr <- data.frame(f1,f2,cf)
fr[cf==3,]

Run the code above in your browser using DataLab