[R] build CONTENTS or 00Index.html without installing whole package
baron at psych.upenn.edu
Sat May 23 18:13:09 CEST 2009
Replying to myself again, I've now figured out how to build all the
help files, including 00Index.html, without actually building the
package. The point is to construct a complete list of all html help
files for searching.
The one thing I cannot figure out is how to build the index of all
packages which (for me) is at
Apparently this requires something other than DESCRIPTION and
00Index.html files in each package, which is all I have.
Here is the script:
# makes indexable help files for R packages, including pdf vignettes
# usage inst.bat "[files]" --- quotes needed for wildcards like "*.tar.gz"
for PKG in `ls $1`
tar xfz $PKG
PK=`echo $PKG | /bin/sed -e 's/.tar.gz//' | cut -d"_" -f1`
mkdir -pv /usr/lib/R/library/$PK
mkdir -pv /usr/lib/R/library/$PK/html
# copy description (which contains version number)
cp $PK/DESCRIPTION /usr/lib/R/library/$PK
# move vignettes if present
if [ -d $PK/inst/doc ]; then
mkdir -pv /usr/lib/R/library/$PK/doc
cp $PK/inst/doc/* /usr/lib/R/library/$PK/doc
# make html files
R CMD perl /usr/share/R/perl/build-help.pl --html /home/baron/$PK /usr/lib/R/library/
# make indices
Rscript --vanilla -e "tools:::.writePkgIndices('$PK','/usr/lib/R/library/$PK')"
rm -rf $PK
# try to build package list, doesn't work
# Rscript --no-init-file --no-save -e "make.packages.html(packages=FALSE)"
Jonathan Baron, Professor of Psychology, University of Pennsylvania
Home page: http://www.sas.upenn.edu/~baron
More information about the R-help