How to tell my R package to download the dependent libraries if not available to the user?

I am working on one of my functions which eventually wanted to publish as a package through my Github page.
One of the dependent library is dplyr .
I am importing the function mutate, group_by using the following code.

@importFrom dplyr mutate group_by 

in my script.
I was wondering whether this will automatically suggest the user download the dplyr package if the user didn't install it. If not, how can I do it?

Thank you

You don't need to do anything else , but run roxygen2 (or devtools::document()) which generates a NAMESPACE file, and your package cannot be loaded without dplyr.

Using the common ways to install packages, your package cannot even be installed without dplyr.


@meitei, also make sure that the DESCRIPTION file includes dplyr under Imports


This topic was automatically closed after 45 days. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.