Learn R Programming

quanteda (version 1.1.1)

nest_dictionary: Utility function to generate a nested list

Description

Utility function to generate a nested list

Usage

nest_dictionary(dict, depth)

Arguments

dict

a flat dictionary

depth

depths of nested element

Examples

Run this code
# NOT RUN {
list_flat <- list('A' = c('a', 'aa', 'aaa'), 'B' = c('b', 'bb'), 'C' = c('c', 'cc'), 'D' = c('ddd'))
dict_flat <- quanteda:::list2dictionary(list_flat)
quanteda:::nest_dictionary(dict_flat, c(1, 1, 2, 2))
quanteda:::nest_dictionary(dict_flat, c(1, 2, 1, 2))

# }

Run the code above in your browser using DataLab