[R] build CONTENTS or 00Index.html without installing whole package
Jonathan Baron
baron at psych.upenn.edu
Sun May 24 16:30:59 CEST 2009
OK, one more for the records. This script is now written so that it
uses Rscript instead of bash. The last line still does not work. I
don't know what make.packages.html requires, but apparently it
requires more than DESCRIPTION and 00Index.html in order to include a
package. (The line about buildVignettes seems useless, so I commented
it out.) The command line can include *. So I use this after
download.packages(), with inst.R *.tar.gz. (inst.R is what i call the
script.)
#!/usr/bin/Rscript --vanilla
# makes indexable help files for R packages, including pdf vignettes
# usage inst.R [files]
FILES <- commandArgs(TRUE)
print(FILES)
for (PKG in FILES)
{
system(paste("tar xfz",PKG))
PK <- strsplit(PKG,"_")[[1]][1]
print(PK)
system(paste("mkdir -pv /usr/lib/R/library/",PK,"/html",sep=""))
# copy description (which contains version number)
system(paste("cp ",PK,"/DESCRIPTION /usr/lib/R/library/",PK,sep=""))
# move vignettes if present
system(paste("cp -r ",PK,"/inst/doc /usr/lib/R/library/",PK," >& /dev/null",sep=""))
# buildVignettes(PK,paste("/usr/lib/R/library/",PK,sep=""))
# make html files
system(paste("cd /usr/share/R/perl; ","perl build-help.pl --html /home/baron/",
PK," /usr/lib/R/library/","; cd /home/baron",sep=""))
# make indices
tools:::.writePkgIndices(PK,paste("/usr/lib/R/library/",PK,sep=""))
system(paste("rm -rf",PK))
}
# try to build package list, doesn't work
# make.packages.html()
--
Jonathan Baron, Professor of Psychology, University of Pennsylvania
Home page: http://www.sas.upenn.edu/~baron
More information about the R-help
mailing list