Learn R Programming

SSBtools (version 0.8.0)

HierarchyComputeDummy: HierarchyComputeDummy

Description

From hierarchies to a sparse model matrix with possible cross table by wrapping HierarchyCompute

Usage

HierarchyComputeDummy(
  data,
  hierarchies,
  inputInOutput = TRUE,
  crossTable = FALSE,
  ...
)

Arguments

data

data

hierarchies

hierarchies

crossTable

Cross table in output when TRUE

...

Further parameters sent to HierarchyCompute

Value

A sparse model matrix or a list of model matrix and cross table

Details

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).

Examples

Run this code
# NOT RUN {
# 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)
# }

Run the code above in your browser using DataLab