HierarchyComputeDummy: HierarchyComputeDummy

View source: R/Hierarchies2ModelMatrix.R

HierarchyComputeDummyR Documentation

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

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

Value

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

Author(s)

Øyvind Langsrud

Examples

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

SSBtools documentation built on Oct. 30, 2024, 5:09 p.m.