View source: R/Hierarchies2ModelMatrix.R
HierarchyComputeDummy | R Documentation |
From hierarchies to a sparse model matrix with possible cross table by wrapping HierarchyCompute
HierarchyComputeDummy(
data,
hierarchies,
inputInOutput = TRUE,
crossTable = FALSE,
...
)
data |
data |
hierarchies |
hierarchies |
crossTable |
Cross table in output when TRUE |
... |
Further parameters sent to |
This function is a special wrapper of HierarchyCompute
and the input argument hierarchies is specified the same way.
That is, variables can also be coded by "rowFactor"
( but not colFactor).
A sparse model matrix or a list of model matrix and cross table
Øyvind Langsrud
# Data and hierarchies used in the examples
x <- SSBtoolsData("sprt_emp") # Employment in sport in thousand persons from Eurostat database
geoHier <- SSBtoolsData("sprt_emp_geoHier")
ageHier <- SSBtoolsData("sprt_emp_ageHier")
HierarchyComputeDummy(x, list(age = ageHier, geo = geoHier, year = "rowFactor"),
inputInOutput = FALSE, crossTable = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.