find_element | R Documentation |
Find the value of the element that contains the given string in its name in a nested list. Based off of advice here.
find_element(nested_list, search_for)
nested_list |
a nested list, such as the type returned by fromJSON |
search_for |
a character string that is the name of the element we want to find in |
any values of the list where the name contains the substring search_for
{ # create list of data frames for example df_nest <- list( Y = data.frame(x.test = c(1, 2, 3)), Z = data.frame(w = c("a", "b", "c")) ) # extract element containing 'test' find_element(df_nest, "test") # create nested list for example list_nest <- list( Y = c(1, 2, 3), z = list( x.test = c(1, 2, 3), y = c("no", "yes") ) ) find_element(list_nest, "test") }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.