Should a package import all the magrittr package just to use the pipe in its functions?

The functions in the package I am developing use the pipe.
I am wondering if writing

Imports: magrittr

in DESCRIPTION is the recomended practice in this case or if it is possible to proceed like in packages import vignettes and, somehow (how?) just

import::from(magrittr, "%>%")

Many thanks!

1 Like

I have followed the advice of the usethis package and done the following:

  • Add magrittr to "Imports" in DESCRIPTION .
  • Import the pipe operator specifically, which is necessary for internal use.
  • Export the pipe operator, if export = TRUE , which is necessary to make %>% available to the users of your package.

You can quickly set this up in your package by running usethis::use_pipe()

3 Likes

Fantastic!! Many thanks, Roberto

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.