| fac.uncombine {dae} | R Documentation |
Cleaves a single factor, each of whose levels has delimited strings, into several factors using the separated strings.
Description
Cleaves a single factor into several factors whose levels,
the levels of the original factor consisting of several delimited strings that
can be separated to form the levels of the new.factors. That is, it reverses the process
of combining factors that fac.combine performs.
Usage
fac.uncombine(factor, new.factors, sep=",", ...)
Arguments
factor |
A |
new.factors |
A |
sep |
A |
... |
Further arguments passed to the |
Value
A data.frame whose columns consist of the factors listed in
new.factors and whose values have been computed from the values of the combined
factor.
Author(s)
Chris Brien
See Also
fac.split, fac.combine, fac.divide in package dae and
strsplit.
Examples
## set up two factors and combine them
facs <- fac.gen(list(A = letters[1:3], B = 1:2), each = 4)
facs$AB <- with(facs, fac.combine(list(A, B), combine.levels = TRUE))
## now reverse the proces and uncombine the two factors
new.facs <- fac.uncombine(factor = facs$AB,
new.factors = list(A = letters[1:3], B = NULL),
sep = ",")
new.facs <- fac.uncombine(factor = facs$AB,
new.factors = list(A = NULL, B = NULL),
sep = ",")