Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Package Conflicts in R

Tags:

r

tidyverse

When I load tidyverse [or type tidyverse_conflicts()] a warning message appears telling me there is a conflict between two functions dplyr::filter() and dplyr::lag(). How can we avoid such conflict? Thanks for your response! Here is a snapshot:

tidyverse conflicts


1 Answers

When we load tidyverse a messege says "Use the conflicted package to force all conflicts to become errors".

Therefore all you have to do is:

library(conflicted)  

library(tidyverse)
conflict_prefer("filter", "dplyr")
conflict_prefer("lag", "dplyr")

But if you prefer, you can just write your code using the package::funcion() format, for exemple: dplyr::filter() and dplyr::lag()

like image 149
Enoch Avatar answered Mar 31 '26 06:03

Enoch



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!