Dplyr
Use this tag for questions relating to functions from the dplyr package, such as group_by, summarize, filter, and select.
Purrr
Purrr enhances R’s functional programming toolkit by providing a complete and consistent set of tools for working with functions and vectors, such as map() and reduce().
Others
Example |
---|
We recommend using dplyr for data frames or purrr for lists instead from question Find first occurrence in two variables in df |
Note that while you could use purrr for the job it s not particularly better suited than regular dplyr from question Purrr-Fection: In Search of An Elegant Solution to Conditional Data Frame Operations Leveraging Purrr |
With library purrr you can have a prettier more compact form see soto s answer for an even more compact one with dplyr from question Combining columns, update columns based on other df, fill NAs |
With purrr reduce and dplyr full_join the result can be obtained purrr reduce transformed dplyr full_join # type one two # 1 1 a a # 2 2 a a # 3 3 b b from question How to change the df column name within a list |
We found for example that purrr map is much slower than dplyr do which is deprecated we also found that functions like pull are very slow from question Programming using the tidyverse: speed issues |
I am more familiar with dplyr and purrr and used them to implement it below from question How to check for each country if date falls within specific interval across rows? |