R/cansim.R
categories_for_level.Rd
For tables with data with hierarchical categories, metadata containing hierarchy level descriptions is used to extract categories at a specified level of hierarchy only.
categories_for_level(
data,
column_name,
level = NA,
strict = FALSE,
remove_duplicates = TRUE
)
data table object as returned from get_cansim()
the quoted name of the column to extract categories from
the hierarchy level depth to which to extract categories, where 0 is top category
(default FALSE
) when TRUE
will only extract that specific hierarchy level
(default TRUE
) When set to TRUE
higher level grouping categories already captured by lower level hierarchy data will be removed
A vector of categories
if (FALSE) {
data <- get_cansim("16-10-0117")
categories_for_level(data,"North American Industry Classification System (NAICS)",level=2)
}