홍정의
홍정의

Reputation: 23

R how to select functions between conflicting libraries

When writing scripts on R,

I had trouble choosing functions with overlapping packages.

For example,

library(dplyr)
library(tidyverse)
~~~~~

And in the console,

-- Conflicts ---------------------------- tidyverse_conflicts() ---
x dplyr::filter() masks stats::filter()
x dplyr::lag() masks stats::lag()
~~~~

How can I select the right functions? For example, I want "filter()" from dplyr and lag() from stats.

*p.s. I don't want to write library() every time

Upvotes: 2

Views: 750

Answers (1)

TimTeaFan
TimTeaFan

Reputation: 18551

If you don't want to use dplyr::filter every time, we can use the {conflicted} package.

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

Upvotes: 1

Related Questions