[R] build CONTENTS or 00Index.html without installing whole package

Jonathan Baron baron at psych.upenn.edu
Sun May 17 22:36:08 CEST 2009


To maintain my R site, I'm trying to install html help files only, but
also keep track of the version (with DESCRIPTION).  I have the
following bash script, which works except for 00Index.html.  That is
not a huge problem because the help files are still searchable, but
I'd like to fix it.

A long time ago I asked the same question, and Brian Ripley said to
use --index as an option to build-help.pl, but that isn't an option
anymore.  It seems that the 00Index.html file is built from the
CONTENTS file, but I can't find how to construct that either.  Here's
the script so far.  It works pretty much.  (I'm not sure what happens
if the pdf vignettes don't exist already: so far they have all existed
and it works for those.  And the last line doesn't work, so I just
install a package and then the indices get rebuilt.)

#!/bin/bash
# makes indexable help files for R packages, including pdf vignettes
# usage inst.bat "[files]"
  for PKG in `ls $1`
    do
      echo $PKG
      tar xfz $PKG
      PK=`echo $PKG | /bin/sed -e 's/.tar.gz//' | cut -d"_" -f1`
      echo $PK
      mkdir -pv /usr/lib/R/library/$PK
      mkdir -pv /usr/lib/R/library/$PK/html
# copy description (which contains version number) and CONTENTS (for index)
      cp $PK/DESCRIPTION /usr/lib/R/library/$PK
# build and move vignettes if present
      if [ -d $PK/inst/doc ]; then
       mkdir -pv /usr/lib/R/library/$PK/doc
        R CMD buildVignettes\($PK,$PK\)
        cp $PK/inst/doc/* /usr/lib/R/library/$PK/doc
      fi
# make html files
      R CMD perl /usr/share/R/perl/build-help.pl --html /home/baron/$PK /usr/lib/R/library
      rm -rf $PK
    done
# rebuild indices (doesn't work)
R CMD make.packages.html




More information about the R-help mailing list