R: could not find function

Error in R: could not find function “%>%”

Error in R – could not find function “%>%” – means that you don’t have loaded or installed the R package that is using that. The same is with any other “could not find function” R error.

One of the most popular R packages that are using %>% or pipe operator is dplyr. This package might not be installed or attached when the code is executed. It might happen if there is a new R session or you are using code from someone else.

If dplyr is already installed, you can load it like this.


If there is an additional error that you don’t have this package, then use function install.packages to do that.

Other popular packages that are using pipe operators and might be missing are magrittr and knitr.

The same principles are useful on any other “could not find function” error. If you don’t know which package is necessary, then use Google to find that out.

If the problem is solved, don’t forget to check out my favorite RStudio tips and tricks. There might be something useful for you.