Comparing columns with same names in map function

In a purrr map function, can you compare columns with the same names from different dataframes, or, like below, would I have to first rename the columns from one of the dataframes?

beaver1 %>%
  mutate(ntile = pmap_dbl(., function(day, time, temp, activ, ...){
    beaver2 %>%
      rename(day2 = day, time2 = time, temp2 = temp, activ2 = activ) %>%
      filter(activ2 == activ,
             temp2 > temp) %>%
      top_n(-1, time2) %>%
      pull(day2)
  }))


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