Learn R Programming

lfe (version 1.4-709)

compfactor: Find the connected components

Description

'compfactor' computes the connected components of the dummy-part of the model.

Usage

compfactor(fl)

Arguments

Value

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

Details

If there are more than two factors, only the first two will be used.

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