fac.uncombine {dae}R Documentation

Cleaves a single factor, each of whose levels has delimited strings, into several factors using the separated strings.


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.


fac.uncombine(factor, new.factors, sep=",", ...)



A factor or character that has values that aare strings deleimited by the delimiter specified by sep.


A list, the names of whose components are the names of the new factors to be performed. If the contents of a component is not NULL, then they are used as the levels of the corresponding factor.


A character string that separates the levels of the new.factors in the levels factor.


Further arguments passed to the factor call creating the new factor.


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.


Chris Brien

See Also

fac.split, fac.combine, fac.divide in package dae and strsplit.


## 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 = ",")

[Package dae version 3.2.19 Index]