From edd at debian.org  Fri Feb 14 19:32:28 2014
From: edd at debian.org (Dirk Eddelbuettel)
Date: Fri, 14 Feb 2014 12:32:28 -0600
Subject: [Rd] contrib.url in non-interactive mode
In-Reply-To: <CAHavPHFuH55iuFjH9h5MdZkVqjS_=urDw_t-GcK8y5rxVj8SpA@mail.gmail.com>
References: <CAHavPHFuH55iuFjH9h5MdZkVqjS_=urDw_t-GcK8y5rxVj8SpA@mail.gmail.com>
Message-ID: <21246.24892.859506.688029@max.nulle.part>


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



[Rd] contrib.url in non-interactive mode
Dirk Eddelbuettel