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

Jonathan Baron baron at psych.upenn.edu
Mon May 18 18:47:46 CEST 2009

Replying to my own message, I've now fixed up the bash script so that
it works (below).  I don't think that buildVignettes does anything I
need, so I commented it out (but now runs).  Rscript, and not R CMD
(which I was mistakenly using before), seems to be the way to run
arbitrary R functions from a script like this, although R CMD works
for the perl script.

But the main problem remains.  Still no 00Index.html filles or
CONTENTS.  I suppose I could write a script to generate the
00Index.html file from the Rd files, but I'm sure I'd be reinventing
the wheel.

Reminder: The main purpose of this is to set up a site with all the
help files of all the packages available in html format, and pdf files
of vignettes.  Once I figure this out, it will be much easier for
someone else to reproduce the site I have at
http://finzi.psych.upenn.edu, and easier for me to maintain it.

# makes indexable help files for R packages, including pdf vignettes
# usage inst.bat "[files]" (in quotes, if wildcards)
for PKG in `ls $1`
    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)
    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
#      Rscript --default-packages="tools" --no-init-file --no-save \
#        -e "buildVignettes('$PK','/usr/lib/R/library/$PK')"
# make html files
    R CMD perl /usr/share/R/perl/build-help.pl --html \
      /home/baron/$PK /usr/lib/R/library
    rm -rf $PK
Rscript --no-init-file --no-save -e "make.packages.html()"

More information about the R-help mailing list