[R] install.packages and dependencies=TRUE

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Dec 17 23:04:41 CET 2013


On 17/12/2013 22:02, Duncan Murdoch wrote:
> 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.

On Linux/OS X/Solaris I do use a soft link.

I have used junctions on Windows.  (I know they do not always work on 
Windows, but they do on the Win 7 systems I use.)

>
> 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.
>>
>>
>


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list