[R] Package dependencies in building R packages

Duncan Murdoch
Mon, 30 Dec 2013 18:51:20 -0000

On 13-12-30 1:24 PM, Axel Urbiz wrote:
> Dear users,
>
> My package {foo} depends on a function "miscFUN" which is on
package
> {foo_depend}. This last package also depends on other packages, say {A, B,
> C}, but miscFUN is not dependent on A, B, C (only on foo_depend).
>
> In my package {foo}, is there a way to only have it depend on the function
> miscFUN from {foo_depend} without having the user to have installed A, B,
> C? (as none of those packages are needed for my package to work properly).
> Also, is this a best practice?

There's no way for your package to tell R to ignore the dependencies
declared by foo_depend.

If you really only need one function from that package, simply copy the
source of miscFUN into your package (assuming foo_depend's license
permits that).  But this is not best practice, unless that function is
very simple.  Best practice is to declare your dependence by importing
that function from foo_depend.

Duncan Murdoch