Skip to content
Back to formatted view

Raw Message

Message-ID: <21246.24892.859506.688029@max.nulle.part>
Date: 2014-02-14T18:32:28Z
From: Dirk Eddelbuettel
Subject: contrib.url in non-interactive mode
In-Reply-To: <CAHavPHFuH55iuFjH9h5MdZkVqjS_=urDw_t-GcK8y5rxVj8SpA@mail.gmail.com>

Renaud,

The script below has been in use for about as long as littler existed, and
also ships with it. I use it, and its sibbling 'update.r' all the time. Doing
this at the command-line frees the R prompt during compilations too...

As Barry suggests, the RStudio-provided CDN is not a bad choice either as a
repo. 

Dirk

edd at max:~$ cat bin/install.r 
#!/usr/bin/env r
#
# a simple example to install one or more packages

if (is.null(argv) | length(argv)<1) {

  cat("Usage: installr.r pkg1 [pkg2 pkg3 ...]\n")
  q()

}

## adjust as necessary, see help('download.packages')
#repos <- "http://cran.us.r-project.org"
repos <- "http://cran.r-project.org"

## this makes sense on Debian where no packages touch /usr/local
lib.loc <- "/usr/local/lib/R/site-library"

install.packages(argv, lib.loc, repos)
edd at max:~$ 

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com