[R] Package dependencies in building R packages

Duncan Murdoch murdoch.duncan at gmail.com
Mon Dec 30 19:51:20 CET 2013


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



More information about the R-help mailing list