View source: R/DataDummyHierarchies.R
DataDummyHierarchy | R Documentation |
Create a (signed) dummy matrix for hierarcical mapping of codes in data
DataDummyHierarchy(dataVector, dummyHierarchy)
DataDummyHierarchies(data, dummyHierarchies, colNamesFromData = FALSE)
dataVector |
A vector of codes in data |
dummyHierarchy |
Output from |
data |
data |
dummyHierarchies |
Output from |
colNamesFromData |
Column names from data when |
DataDummyHierarchies
is a user-friendly wrapper for the original function DataDummyHierarchy
.
When colNamesFromData
is FALSE
(default), this function returns
mapply(DataDummyHierarchy,
data[names(dummyHierarchies)],
dummyHierarchies)
.
A sparse matrix. Column names are taken from dataVector (if non-NULL) and row names are taken from the row names of dummyHierarchy.
Øyvind Langsrud
z <- SSBtoolsData("sprt_emp_withEU")[1:9, ]
hi <- FindHierarchies(z[, c("geo", "eu", "age", "year")])
dhi <- DummyHierarchies(hi, inputInOutput = TRUE)
DataDummyHierarchies(z, dhi, colNamesFromData = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.