Using .data[[.x]] or similar with pmap

Hi all,

I've written the code below which produces a data table of results based on a custom function I wrote, check_dart_score(). I'm trying to become more proficient with the purrr package, and would like to abstract this function to the pmap() series of functions.

However, I can't seem to figure out an equivalent in pmap() for the map() and map2 .data[[.x]] method. Would anyone be able to help me understand how these results can be achieved with pmap()? I've come across some conversations in GitHub that indicate the context of .data/.l doesn't exist within pmap, but I'm not sure how to make my code below work otherwise. Thanks!

map2_dfc(pull(dart_labels,1), pull(dart_labels,2), 
          ~dart %>% 
            check_dart_score(var = .data[[.x]], value = .y)
          )

Hi!

To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

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.