Have you ever installed a package in R and noticed a conflict issued? I for one didn’t understand the output on the conflict.

The output is worded like so:

── Conflicts ────────────────────────────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()

In the case above it’s specific to the tidyverse package. I thought it meant that the package I was installing (in this case Tidyverse) failed to install.

Quite wrong of me. The package did install just fine. What I’m being told here, is that some of the method names in Tidyverse are the SAME method names in R’s base (standard library.)

Now that I’ve installed this package (Tidyverse), when I run the filter or lag method, I’ll be defaulting to the Tidyverse version, and not the standard library.

If you want to use the original methods you simply use the syntax provided above:

stats::filter()
# or
stats::lag()

Leave a Reply

Your email address will not be published. Required fields are marked *