[R] How to link two R packages together

Xuan Zhao xuan.zhao at sentrana.com
Thu Aug 2 16:57:17 CEST 2012


Hi Michael,
Thank you so much for the help Michael! When I put my package 'PKG2' (on which PKG1 is depending on) in the regular place, perhaps a place R CMD check won't look at, then when I try to build PKG1, they will say PKG2 required but not found, so I have to put it under a directory R looks at, just the paths under '.libPaths()'. 
I read through the manual (the 7th section entitled "tools"of "R internals"), and they suggest changing check.Environ under ~/.R, so I have tried to put check.Environ "~/.R", "~/" is my home directory which is just the path shown after typing cd &&pwd. But It doesn't work, so I thought "~/" might be something else.
Thank you so much for the help, I really appreciate that!
Yours,
Xuan

-----Original Message-----
From: R. Michael Weylandt [mailto:michael.weylandt at gmail.com] 
Sent: Thursday, August 02, 2012 10:46 AM
To: Xuan Zhao
Cc: r-help at r-project.org
Subject: Re: [R] How to link two R packages together

On Thu, Aug 2, 2012 at 9:02 AM, Xuan Zhao <xuan.zhao at sentrana.com> wrote:
> Hi All,
> Thank you so much for all the help you have provided, I really appreciate it!
> The problem is solved, I just added PKG2 to the dependency of PKG1 in the description file, also (I don't know if it's necessary or not), I added "import(PKG2)" to the NAMESPACE file. In addition to that, I install PKG2 under a path R can recognize, namely, belong to ".libPaths()".
> I have tried other ways besides install it under the path R can recognize, like  adding a file ~/.R/check.Environ, whose contents are: 'R_LIBS_SITE=${R_LIBS_SITE-'directoryunderwhichPKG2isinstalled'}', but it still doesn't work.

By which you mean .... ?

> I looked through the manual, they just say the file 'check.Environ' should be put under '~/.R', but I am not should what the "~/" should be. Is that my home directory or what? Should that be the host? I am not the host of the server, does that matter?
> Thank you so much for the help!
> Yours,
> Xuan

"~" is a standard UNIX (POSIX?) shorthand for the user's home directory. On my Mac it is "/Users/mweylandt" and I imagine you'd get something similar on all Linux and BSD systems -- one easy way to see where it is: go to your terminal and type "cd && pwd" which will print it out. No idea what the parallel on Windows is: possibly something under C:/Documents and Settings but it's been so long since I've had the misfortune of doing serious work on Windows, I can't remember.

Incidentally, is there a reason you can't put your package in the "regular" place?

Finally, see the manuals that Bert, Josh, and I have pointed you to:
they are much more authoritative on these matters than any of us.

Best,
Michael



More information about the R-help mailing list