[R] install.packages and dependencies=TRUE

Duncan Murdoch murdoch.duncan at gmail.com
Tue Dec 17 23:02:04 CET 2013


On 13-12-17 1:18 PM, Prof Brian Ripley wrote:
> The obvious idea to set up a local repository works.  It takes 5 mins at
> most.

That makes a lot of sense to do on Unix-alikes, but less so on Windows. 
  A local repository of tarballs needs to be in src/contrib below the 
URL of the repository.  On Unix setting that up as a soft link to the 
real location would be trivial, but on Windows you'd probably want that 
to be the only path to the files, and that's not very convenient when 
you're already used to keeping them elsewhere.

Duncan Murdoch

>
> On 17/12/2013 18:08, Duncan Murdoch wrote:
>> So apparently not as simple as I thought it would be.  So I'll tell you
>> what I actually do:
>>
>> I have a number of packages under development, some on CRAN, some not. I
>> also work in multiple builds of R pretty frequently, so I like to
>> install all my packages and commonly used ones from other people.  So I
>> put together a little script that I can run that will install or update
>> a list of about 20 packages.  Here it is, with the names deleted.
>>
>> # Script to install current versions of commonly used packages
>>
>> installed <- rownames(installed.packages())
>> old <- old.packages()
>>
>> oldoptions <- options(repos =
>> c(CRAN="http://probability.ca/cran",CRANextra="http://www.stats.ox.ac.uk/pub/RWin"))
>>
>> pkgs <-    ------ a character vector of packages on CRAN ------
>> oldPkgs <- old[intersect(pkgs, rownames(old)),,drop=FALSE]
>> if (length(oldPkgs))
>>     update.packages(oldPkgs = oldPkgs)
>> pkgs <- setdiff(pkgs, installed)
>> if (length(pkgs))
>>     install.packages(pkgs, dep=c("Depends", "Imports"))
>>
>> options(repos = c(options("repos"),
>> "R-forge"="http://R-Forge.R-project.org"))
>> pkgs <- ------ packages to install from R-forge ------
>> oldPkgs <- old[intersect(pkgs, rownames(old)),,drop=FALSE]
>> if (length(oldPkgs))
>>     update.packages(oldPkgs = oldPkgs)
>> pkgs <- setdiff("patchDVI", installed)
>> if (length(pkgs))
>>     install.packages(pkgs)
>>
>> MyR <- ------ the source directory where I keep my own packages ------
>> pkgs <- ------ packages to install from local source ------
>> pkgs <- setdiff(pkgs, installed)
>> if (length(pkgs))
>>     install.packages(file.path(MyR, pkgs), type="source", repos=NULL)
>>
>> options(oldoptions)
>>
>> ______________________________________________
>> 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