View source: R/DimList2Hierarchy.R
Hierarchy2Formula | R Documentation |
Conversion between to-from coded hierarchy and formulas written with =, - and +.
Hierarchy2Formula(
x,
hierarchyVarNames = c(mapsFrom = "mapsFrom", mapsTo = "mapsTo", sign = "sign", level =
"level")
)
Formula2Hierarchy(s)
Hierarchies2Formulas(x, ...)
x |
Data frame with to-from coded hierarchy |
hierarchyVarNames |
Variable names in the hierarchy tables as in |
s |
Character vector of formulas written with =, - and +. |
... |
Extra parameters. Only |
See Arguments
Hierarchies2Formulas
is a wrapper for lapply(x, Hierarchy2Formula, ...)
Øyvind Langsrud
DimList2Hierarchy
, DimList2Hrc
, AutoHierarchies
.
x <- SSBtoolsData("sprt_emp_geoHier")
s <- Hierarchy2Formula(x)
s
Formula2Hierarchy(s)
# Demonstrate Hierarchies2Formulas and problems
hi <- FindHierarchies(SSBtoolsData("sprt_emp_withEU")[, c("geo", "eu", "age")])
hi
Hierarchies2Formulas(hi) # problematic formula since minus sign in coding
AutoHierarchies(Hierarchies2Formulas(hi)) # Not same as hi because of problems
# Change coding to avoid problems
hi$age$mapsFrom <- gsub("-", "_", hi$age$mapsFrom)
hi
Hierarchies2Formulas(hi)
AutoHierarchies(Hierarchies2Formulas(hi))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.