Removing package dependency on magrittr

I have a package that I have been adding functions to for years. It's not something I'm sharing with others (though I might break a few functions out into separate package(s) for sharing with colleagues).

Back in the day, I used devtools::use_pipe() to add the magrittr dependency into the NAMESPACE. I've transitioned the code to use the R 4.1.0 pipe ('|>') and want to remove the dependency on magrittr. I can manually remove it from DESCRIPTION, but when I devtools::document() the dependency is still in the NAMESPACE. Furthermore, because I removed it from DESCRIPTION, I now get an error when I devtools::check().

So how do I remove it? Basically I'd like a 'devtools' function like use_pipe(FALSE) or devtools::unuse_pipe()

[I know that to do so would disallow use of the package with R < 4.1.0, but that isn't an issue in my situation.]

Thanks!

Search your source code for %>% to see where else it appears in your source files. It probably appears in some roxygen import tags if you use roxygen.

2 Likes

If that's true, I don't know where.

I went through all the code files and the vignette. The dplyr pipe does not appear in any of the functions' documentation.

I removed "R/utils-pipe.R".

I fail a 'check()' with "checking package dependencies ... ERROR
Namespace dependency missing from DESCRIPTION Imports/Depends entries: 'magrittr'

See section 'The DESCRIPTION file' in the 'Writing R Extensions'
manual."

From the message it seems that you are still importing at least one function or operator from magrittr in NAMESPACE.

Search your project for "magrittr" and "%>%".

You can search your whole project with grep or rg or ag if you are at the command line. If you are using an IDE like RStudio or Positron, they have functionality to search the whole project.

If your project is on GitHub you can also search there.