harmonize.levels: harmonize.levels

Description Usage Arguments Details Examples

Description

make two factors have the same levels

Usage

1
harmonize.levels(fac1, fac2)

Arguments

fac1

the first factor

fac2

the second factor

Details

given two factors, where the second factor has the same levels as the first, or where the second factor's levels are a superset of the first's, return a new factor to replace the first one whose levels are the same as the second's. so if we have
fac1 <- c("old", "young", "old") # levels are c("old", "young")
fac2 <- c("young", "old", "infant") # levels are c("infant", "young", "old")
then
res <- harmonize.levels(fac1, fac2)
will return a factor c("old", "young", "old") whose levels are c("infant", "young", "old")

Examples

1
2
3
4
## Not run: 
   ## TODO add examples

## End(Not run)

dfeehan/dhstools documentation built on May 15, 2019, 5:12 a.m.