[R] Windows-GUI: "Install Packages from local zip files" and dependencies

Duncan Murdoch murdoch at stats.uwo.ca
Mon Feb 18 14:30:07 CET 2008


On 18/02/2008 7:51 AM, Johannes Graumann wrote:
> Duncan Murdoch wrote:
> 
>>> 2) If that's not the default: is there a way to make it so?
>> Not simply, but of course it's possible with some work.  The problem is
>> that with repos = NULL, R doesn't know where to look for dependencies.
>> So you need to make two passes:  First, install the package, and second,
>> install its dependencies.
>>
>> You can use code like this to find the dependencies:
>>
>> library(tools)
>>
>> allpkgs <- installed.packages()
>> deps <- package.dependencies(allpkgs["test",])[[1]][,1]
>>
>> to find the dependencies of package test after you've installed it, and
>>
>> setdiff(deps, rownames(allpkgs))
>>
>> to find the ones that are not installed.  Where to find them to install
>> is the hard part:  are they also local, or on CRAN, or where?
> CRAN/BioC (both of which are set to Default == TRUE in the repository conf
> file.
> 
> This doesn't sound like something I can automate easily to appease the
> userbase of my little toolbox ...
> Is there a way to have a package upon installation run a post-install script
> with the functions you outline above?

We don't have post-install scripts, and you can't put this in the load 
hook, because that won't run without the dependencies.  So I think you 
need to offer something like biocLite, outside of your package.  Or set 
up a repository, and have your users install from there.

Duncan Murdoch



More information about the R-help mailing list