[R] Makefile for installing all available packages

Warnes, Gregory R gregory_r_warnes at groton.pfizer.com
Wed Apr 14 04:42:08 CEST 2004


Below is a makefile I wrote to download and install all available R packages
from the CRAN and BioConductor package repositories.  

The primary advantage of using this makefile instead of R's built-in
install.package() and update.packages() is the creation of a separate
installation log for every package.   Further, if make is invoked with '-k',
failure to install a single package will not derail the installation of
other packages.

I hope that this script may be useful to other folks.  

-Greg

# Download and install all available R packages from the CRAN and
Bioconductor 
# package repositories
#
RCMD ?= R-1.9.0
WGET ?= wget -N -nd -r -A gz -r -l 1 -nv

PACKAGE_FILES = $(wildcard *.gz ) 
PACKAGE_LOGS  = $(addsuffix .log, $(basename $(basename $(PACKAGE_FILES))))

default: cran bioconductor install

cran: 
	$(WGET) "http://cran.r-project.org/src/contrib/PACKAGES.html"

bioconductor: bioCmain bioCcontrib bioCdata

bioCmain:
	$(WGET)
"http://www.bioconductor.org/repository/release1.3/package/html/index.html"

bioCcontrib:
	$(WGET) "http://www.bioconductor.org/contrib/index.html"

bioCdata:
	$(WGET) "http://www.bioconductor.org/data/metaData.html"

install: $(PACKAGE_LOGS)

%.log: %.tar.gz
	$(RCMD) INSTALL $< > $@.broken 2>&1 
	mv $@.broken $@



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




More information about the R-help mailing list