title: Pipe tibble with a list of logical vectors to map2()
body: <p>How could I pipe a data frame consisting of a list of logical vectors and a list of character vectors to <code>purrr::map2()</code> to subset the character vectors using the logical vectors?</p>
  
  <p>My efforts work without pipes, but I'm not sure how to do it with pipes:</p>
  
  <p>For example, using this data frame:</p>
  
  <pre><code>a_pair = tibble(mask = list(TRUE, c(FALSE, TRUE), TRUE, TRUE, 
                              c(FALSE, FALSE, FALSE, TRUE), TRUE, TRUE, TRUE, 
                              TRUE, c(FALSE, FALSE, FALSE, TRUE)),
                  strings = list(".", c("0.29966", "0.31145"), "0.48243", 
                                 "0.55122", 
                                 c("0.10099", "0.10142", "0.49873", "0.56246"), 
                                 "0.56246", "0.10127", "0.70687", "0.68338", 
                                 c("0.03365", "0.16895", "0.68338", "0.82954")))
  </code></pre>
  
  <p>This works:</p>
  
  <pre><code>library(purrr)
  
  map2(a_pair$mask, a_pair$strings, function(logical, string) subset(string, logical))
  </code></pre>
  
  <p>But this (as suggested in <a href="https://stackoverflow.com/questions/45362462/how-do-pipes-work-with-purrr-map-function-and-the-dot-symbol">a related question</a>) doesn't:</p>
  
  <pre><code>a_pair %&gt;% map2(., names(.), ~{subset(.y, .x)})
  Error in subset.default(.y, .x) : 'subset' must be logical
  </code></pre>
  
  <p>Do I need to do some sort of unlisting, or reference the logical vectors in a different way?</p>