5 Big Ideas Behind Tidy Evaluation

Ever wondered, how easy it is to write dataframe manipulation code without repeating yourself while using dplyr ? For example, if you are filtering a dataframe, you simply write

filter(df, x == 1, y == 2)

instead of writing like this

df[df$x==1, df$y == 1]

where you need to refer the dataframe multiple times and use “$” to access variables in the dataframe.

The reason why dplyr makes it easy for use is dplyr functions evaluate statements in a very different way than your standard R code is evaluated. This evaluation is called non-standard evaluation (NSE) or specifically tidy-eval.

Tidy evaluation comes with a price and tidyverse has the functionality to get around those issues and that is why it is important to understand tidy-eval.

If you feel blown away, the first time you saw tidy-eval, you are not alone. Here is Hadley Wickham going over the 5 big ideas behind the tidy eval in 5 minutes.

If you want more of tidy evaluation, check here