[R] Advice about system for installing & updating all R packa ge in a Linux Lab?

Warnes, Gregory R gregory.r.warnes at pfizer.com
Wed Aug 31 21:19:19 CEST 2005


If you have several different versions of R installed, you might want to use
a script like this one, which should work on (at least) 1.9.1 and newer.

<script>
#!/bin/sh

echo "##############"
echo "## This script will attempt to install all available R packages"
echo "## from the package repositories:"
echo "##"
echo "##   - CRAN:  http://cran.r-project.org/"
echo "##   - BioCondictor:  http://www.bioconductor.org"
echo "##"
echo "## As well as Pfizer custom packages"
echo "## "
echo "##   - Rlsf:  ~warneg/src/R/Rlsf"
echo "##   - AffyTool: nlvfs016:rstat-data/"
echo "##               ExpressionAnalysis/StandardAffyAnalysis/AffyTool"
echo "##"
echo "##############"
echo "##"

if [ -z '$1' ]; then
  RCMD="R"
  echo "## Parameter 1 : R Command Name = $RCMD (Default)"
else
  RCMD=$1
  echo "## Parameter 1 : R Command Name = $RCMD"
fi
export RCMD
echo $RCMD

echo "##"
echo "##############"
echo "##"
echo "## Starting R ..."
echo "##"

$RCMD --vanilla <<EOF

##
## Update installed packages
##
update.packages (repos ="http://cran.r-project.org",ask = FALSE,
installWithVers=TRUE )

##
## Install New Packages from CRAN
##
#
if (exists("new.packages",mode="function"))
   {
     options(repos="http://cran.r-project.org")
     new.list <- new.packages(ask=FALSE)
   } else
   {
     CRAN.list <- CRAN.packages()[,1]
     here.list <- installed.packages()[,1]
     new.list <- CRAN.list[ ! CRAN.list  %in% here.list ]
     
   }
   install.packages(pkgs=new.list, dependencies=TRUE, installWithVers=TRUE )

##
## Install (New) Bioconductor Packages
##
source("http://www.bioconductor.org/getBioC.R") 
getBioC(groupName="all")
y

EOF

echo "##############"
echo "## All Done!"
echo "##"
echo "## *Check the log for failed package installs*"
echo "##"
echo "##############"
</script>





> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch]On Behalf Of Prof 
> Brian Ripley
> Sent: Saturday, August 20, 2005 1:28 AM
> To: Paul Johnson
> Cc: r-help at stat.math.ethz.ch
> Subject: Re: [R] Advice about system for installing & updating all R
> package in a Linux Lab?
> 
> 
> This is based on the pre-2.1.0 ideas.  Try
> 
> update.packages(ask=FALSE)
> install.packages(new.packages(), dependencies=TRUE)
> 
> However, I would suggest that you set up each student with a 
> library, say 
> ~/R/library, and point R_LIBS at it (set in Renviron.site).  
> That's what 
> we do for Windows, and it seems successful.  (We have other 
> reasons to 
> want very complete central Linux setups, one being that we 
> run more than 
> one archtecture where personal libraries are a little harder 
> to manage.)
> 
> On Fri, 19 Aug 2005, Paul Johnson wrote:
> 
> > Good day:
> >
> > I'm administering 6 linux systems (FC4) in a student lab 
> and worry that
> > users may want packages that are not installed.  I get 
> tired of adding
> > them one by one.  Then I happened upon this page
> >
> > http://support.stat.ucla.edu/view.php?supportid=30
> 
> Many of the commands there are now or about to be deprecated.  See my 
> article in the current R-News.
> 
> > about installing all R packages from CRAN.  That did not 
> run as it was,
> > but after some fiddling I arrived at the following script, 
> which does
> > run and it builds many packages and reports failures on the rest:
> >
> > #R_installAll.R
> > options(repos = "http://lib.stat.cmu.edu/R/CRAN/")
> > update.packages(ask=F)
> > x <- 
> packageStatus(repositories="http://cran.r-project.org/src/contrib")
> > st <- x$avai["Status"]
> > install.packages(rownames(st)[which(st$Status=="not installed")],
> > dependencies=T)
> >
> > If I run that in batch mode (as root, of course)
> >
> > >  R CMD BATCH R_installAll.R
> >
> > It produces some informative output. Some packages don't 
> build because
> > they are for Windows.  As Prof Ripley mentioned recently, 
> some packages
> > don't build because of gcc-4.0.1. Some fail because I don't 
> have some
> > requisite libraries installed.  I try to deduce which FC 
> packages may be
> > used to fix that and iterate the process now and then.
> >
> > But, for the most part, the packages to be OK (as far as I 
> can tell).
> > The output of a recent update is posted on the net here, in 
> case you are
> > interested to see (this lists the ones that don't build plus the
> > successful updates):
> >
> > http://lark.cc.ku.edu/~pauljohn/software/R/R_installAll.Rout
> >
> > I can't see how this does any damage, since the packages that don't
> > build are very graceful about erasing themselves, and the 
> ones that do
> > build are automatically available for the users.
> >
> > Can you see any downside to scheduling this process to run as a cron
> > job, say once per week, to keep packages up to date?
> 
> None at all.  We do something similar (but based on 
> new.packages and with 
> a stoplist of packages that we know will not install).
> 
> -- 
> 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
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 
> 


LEGAL NOTICE\ Unless expressly stated otherwise, this messag...{{dropped}}




More information about the R-help mailing list