View source: R/walk_nested_dict.R
walk_nested_dict | R Documentation |
This function performs a recursive search through a nested dictionary-like structure in R, looking for a specific term and collecting its values. It's useful for extracting specific pieces of data from complex, deeply nested results.
walk_nested_dict(my_result, term, outputs = list(), depth = 0, maxdepth = 25)
my_result |
The nested dictionary-like structure to search through. |
term |
The term to search for within the nested dictionary. |
outputs |
An initially empty list to store the results of the search, default is an empty list. |
depth |
The current depth of the recursion, default is 0. |
maxdepth |
The maximum depth to recurse, default is 25. If exceeded, the function issues a warning and returns NULL. |
A list of values associated with the term found in the nested dictionary. Returns NULL if the term is not found or if maximum recursion depth is exceeded.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.