2.2 Good reasons to learn (at least a bit) how to use it

  • More intuitive programming: the names of functions speak for themselves.
  • The code is easier to read than with R base: it facilitates code sharing.
  • More efficient: the functions are quite quick (coded more efficiently).
  • Very good documentation and tutorials.

Here is a piece of R base code:

diamonds2 <- diamonds[diamonds$cut == "Ideal", c("cut", "color", "carat", "price")]
diamonds2[order(diamonds2$price, decreasing=TRUE),]

And its equivalent in the tidyverse:

diamonds %>% 
  select(cut, color, carat, price) %>%
  filter(cut=="Ideal") %>%