From bolker@zoo.ufl.edu  Wed Jul  4 21:47:07 2001
From: bolker@zoo.ufl.edu (Ben Bolker)
Date: Wed, 4 Jul 2001 16:47:07 -0400 (EDT)
Subject: [Rd] indexing
Message-ID: <Pine.GSO.4.33.0107041644440.2140-100000@eno.Princeton.EDU>



  OK, several boneheaded mistakes -- sorry.
  Replace the last two functions with the following:

create.index <- function(CRAN=getOption("CRAN"),
                         contriburl=contrib.url(CRAN),
                        descrip=paste(contrib.url(CRAN),"/Descriptions",sep=""),
                         local.ext=".INDEX.tmp",
                         save=TRUE,savefile="CRAN-index",
                         download=TRUE) {
  if (download) {
    pkglist <- CRAN.packages(contriburl=contriburl)
    sapply(pkglist[,1],get.ind,CRAN=CRAN,descrip=descrip,
           local.ext=local.ext)
  }
  indfiles <- list.files(pattern=paste("*",local.ext,sep=""))
  CRAN.index <- do.call("rbind",lapply(indfiles,tr.index))
  answer <- substr(readline("Delete temporary index files (y/N)? "), 1, 1)
  if (answer == "y" | answer == "Y")
    unlink(indfiles, TRUE)
  if (save) save(CRAN.index,file=savefile)
  CRAN.index
}

search.ind <- function(str,indexmat=CRAN.index,ignore.case=TRUE) {
noquote(indexmat[unique(c(grep(str,indexmat[,"Function"],ignore.case=ignore.case),
            grep(str,indexmat[,"Description"],ignore.case=ignore.case))),])
}

CRAN.index <- create.index()

** NEW ADDRESS as of Aug. 1 ***
Zoology Department, University of Florida
bolker@zoo.ufl.edu
(352) 392-5697

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] indexing
Ben Bolker