Predicate function alternatives in map_if

I have been studying purrr family functions recently and while I was reading the documentation of map_if I came across an alternative form for .p argument aka. predicate function that I could not understand. It say:

"Alternatively, if the elements of .x are themselves lists of objects, a string indicating the name of a logical element in the inner lists"

I was wondering if you could tell me what it means and how I can go about using it while I deal with a list whose elements are also lists. Something like this:

x <- list(a = list(foo = 1:2, bar = 3:4), b = list(baz = 5:6))

Thank you very much in advance.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.