I want to keep all the elements of a list where the children contain a certain named element. For example, in this I only want the elements that contain the child "phone" (elements, 1, 3 and 5).
my_list <- list(list(phone = "123-124-1234",
school = "Midvale"),
list(address = "123 Main Street",
color = "blue"),
list(phone = "124345654"),
list(color = "green"),
list(color = "red",
phone = "12453466"))
Using the purrr
package is ideal for me. Related to this question.