FindHierarchies: Finding hierarchies automatically from data

View source: R/FindHierarchies.R

FindHierarchiesR Documentation

Finding hierarchies automatically from data

Description

FindDimLists and AutoHierarchies wrapped into a single function.

Usage

FindHierarchies(data, total = "Total")

Arguments

data

Matrix or data frame containing the variables (micro data or cell counts data).

total

String used to name totals. A vector of length ncol(data) is also possible (see examples).

Value

List of hierarchies

Author(s)

Øyvind Langsrud

Examples

dataset <- SSBtoolsData("example1")
FindHierarchies(dataset[1:2])
FindHierarchies(dataset[2:3])
FindHierarchies(dataset[1:4])

FindHierarchies(SSBtoolsData("magnitude1")[1:4], 
                total = c("TOTAL", "unused1", "Europe", "unused2"))

x <- rep(c("A", "B", "C"), 3)
y <- rep(c(11, 22, 11), 3)
z <- c(1, 1, 1, 2, 2, 2, 3, 3, 3)
zy <- paste(z, y, sep = "")
m <- cbind(x, y, z, zy)
FindHierarchies(m)
FindHierarchies(m, total = paste0("A", 1:4))

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