# A simple classification structure
# 1
# |-----+-----|
# 11 12
# |---+---| |
# 111 112 121
expand_classification(c("111", "112", "121"))
# Expanding more complex classifications
# ... if last 'digit' is either TA or TS
expand_classification(
c("111TA", "112TA", "121TS"),
width = c(1, 1, 1, 2)
)
# ... if first 'digit' is either 11 or 12
expand_classification(c("111", "112", "121"), width = c(2, 1))
# ...if there are delimiters in the classification (like COICOP)
expand_classification(c("01.1.1", "01.1.2", "01.2.1"), width = 2)
Run the code above in your browser using DataLab