nest_dictionary: Utility function to generate a nested list

View source: R/dictionaries.R

nest_dictionaryR Documentation

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

lis <- list("A" = c("a", "aa", "aaa"), "B" = c("b", "bb"), "C" = c("c", "cc"), "D" = c("ddd"))
dict <- quanteda:::list2dictionary(lis)
quanteda:::nest_dictionary(dict, c(1, 1, 2, 2))
quanteda:::nest_dictionary(dict, c(1, 2, 1, 2))


quanteda documentation built on Sept. 11, 2024, 6:08 p.m.