tidyverse / magrittr

Improve the readability of R code with the pipe
https://magrittr.tidyverse.org
Other
957 stars 157 forks source link

Why does magrittr export extract as "[" ? #246

Closed torbjorn closed 3 years ago

torbjorn commented 3 years ago

Why does magrittr export extractas

> magrittr::extract
.Primitive("[")

When tidyr exports it as:

> tidyr::extract
function (data, col, into, regex = "([[:alnum:]]+)", remove = TRUE, 
    convert = FALSE, ...) 
{
    ellipsis::check_dots_used()
    UseMethod("extract")
}

This will for sure cause ugly breakage when you accidentally load these packages in the wrong order (just happened to me)

lionel- commented 3 years ago

magrittr and tidyr were designed separately. In general, the tidyverse reexports %>% so you don't have to library(magrittr). If you want attach the package, you'll need to manage the exports.

torbjorn commented 3 years ago

Sorry, hope I can discuss briefly without reopening this as an issue;

Just checked the git log of both projects. Are you saying that tidyr caused this problem when they created the extract verb in june 2014, seeing as you had already created the extract export february 2014?

lionel- commented 3 years ago

Yes, some of the functions exported in magrittr have high-value names. This increases the chance of conflicts with other packages, including some attached by library(tidyverse).