[R] How to link two R packages together

Michael Weylandt michael.weylandt at gmail.com
Thu Aug 2 04:45:59 CEST 2012


I think all you need to do is add /directory/ to the library search path -- see ?.libPaths

Michael

On Aug 1, 2012, at 9:30 PM, Xuan Zhao <xuan.zhao at sentrana.com> wrote:

> Hi Michael,
> Thank you so much for your help!
> But my package is not under a directory that can be searched automatically, namely, when load my package, I have to do: library("PKG1",lib.loc=/directory/), in this case, how to write the dependency?
> Like 'Depends: PKG1', where can I specify the path?
> Thank you so much again!
> Yours,
> Xuan
> 
> -----Original Message-----
> From: Michael Weylandt [mailto:michael.weylandt at gmail.com] 
> Sent: Wednesday, August 01, 2012 9:45 PM
> To: Xuan Zhao
> Cc: r-help at r-project.org
> Subject: Re: [R] How to link two R packages together
> 
> Isn't this what package dependencies are for?
> 
> See the description of the DESCRIPTION file in Writing R Extensions
> 
> Michael
> 
> On Aug 1, 2012, at 5:27 PM, xuan zhao <xuan.zhao at sentrana.com> wrote:
> 
>> Hi,
>> I have built two R packages. One of them (PKG1) needs to use the 
>> functions of the other package (PKG2).
>> So I need to link these two packages together, so that the functions 
>> of PKG2 can be available to PKG1. And when I load one package using 
>> 'library("PKG1")', PKG2 can be loaded at the same.
>> Any ideas welcome.
>> 
>> 
>> 
>> 
>> --
>> View this message in context: 
>> http://r.789695.n4.nabble.com/How-to-link-two-R-packages-together-tp46
>> 38765.html Sent from the R help mailing list archive at Nabble.com.
>> 
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide 
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list