Blame | Last modification | View Log | Download | RSS feed
\name{help.search}\alias{help.search}\alias{print.hsearch}\title{Search the Help System}\description{Allows for searching the help system for documentation matching agiven character string in the (file) name, alias, title, or keywordentries (or any combination thereof), using either fuzzy matching orregular expression matching. Names and titles of the matched helpentries are nicely displayed.}\usage{help.search(pattern, fields = c("alias", "concept", "title"),apropos, keyword, whatis, ignore.case = TRUE,package = NULL, lib.loc = NULL,help.db = getOption("help.db"),verbose = getOption("verbose"),rebuild = FALSE, agrep = NULL)}\arguments{\item{pattern}{a character string to be matched in the specifiedfields. If this is given, the arguments \code{apropos},\code{keyword}, and \code{whatis} are ignored.}\item{fields}{a character vector specifying the fields of the helpdata bases to be searched. The entries must be abbreviations of\code{"name"}, \code{"title"}, \code{"alias"}, \code{"concept"}, and\code{"keyword"}, corresponding to the help page's (file) name, itstitle, the topics and concepts it provides documentation for, andthe keywords it can be classified to.}\item{apropos}{a character string to be matched in the help pagetopics and title.}\item{keyword}{a character string to be matched in the help pagekeywords.}\item{whatis}{a character string to be matched in the help pagetopics.}\item{ignore.case}{a logical. If \code{TRUE}, case is ignored duringmatching; if \code{FALSE}, pattern matching is case sensitive.}\item{package}{a character vector with the names of packages tosearch through, or \code{NULL} in which case \emph{all} availablepackages in the specified library trees \code{lib.loc} aresearched.}\item{lib.loc}{a character vector describing the location of \Rlibrary trees to search through, or \code{NULL}. The default valueof \code{NULL} corresponds to all libraries currently known.}\item{help.db}{a character string giving the file path to a previouslybuilt and saved help data base, or \code{NULL}.}\item{verbose}{logical; if \code{TRUE}, the search process is traced.}\item{rebuild}{a logical indicating whether the help data base shouldbe rebuilt.}\item{agrep}{if \code{NULL} (the default) and the character string tobe matched consists of alphanumeric characters, whitespace or a dashonly, approximate (fuzzy) matching via \code{\link{agrep}} is usedunless the string has fewer than 5 characters; otherwise, it istaken to contain a regular expression to be matched via\code{\link{grep}}. If \code{FALSE}, approximate matching is notused. Otherwise, one can give a numeric or a list specifying themaximal distance for the approximate match, see argument\code{max.distance} in the documentation for \code{\link{agrep}}.}}\details{Upon installation of a package, a contents data base which containsthe information on name, title, aliases and keywords and, conceptsstarting with \R 1.8, is computed from the Rd files in the package andserialized as \file{Rd.rds} in the \file{Meta} subdirectory of thetop-level package installation directory (or, prior to \R 1.7, as\file{CONTENTS} in Debian Control Format with aliases and keywordscollapsed to character strings in the top-level package installationdirectory). This, or a pre-built help.search index serialized as\file{hsearch.rds} in the \file{Meta} directory, is the data basesearched by \code{help.search()}.The arguments \code{apropos} and \code{whatis} play a role similar tothe Unix commands with the same names.If possible, the help data base is saved to the file \file{help.db} inthe \file{.R} subdirectory of the user's home directory or the currentworking directory.Note that currently, the aliases in the matching help files are notdisplayed.}\value{The results are returned in an object of class \code{"hsearch"}, whichhas a print method for nicely displaying the results of the query.This mechanism is experimental, and may change in future versions ofR. In RAqua, this will show up a browser with selectable items. Onexiting this browser, the help pages for the selected items will beshown in separate help windows.}\seealso{\code{\link{help}};\code{\link{help.start}} for starting the hypertext (currently HTML)version of \R's online documentation, which offers a similar searchmechanism.\code{\link{apropos}} uses regexps and has nice examples.}\examples{help.search("linear models") # In case you forgot how to fit linear# modelshelp.search("non-existent topic")\dontrun{help.search("print") # All help pages with topics or title# matching 'print'help.search(apropos = "print") # The samehelp.search(keyword = "hplot") # All help pages documenting high-level# plots.## Help pages with documented topics starting with 'try'.help.search("\\\\btry", fields = "alias")## Do not use '^' or '$' when matching aliases or keywords## (unless all packages were installed using R 1.7 or newer).}}\keyword{documentation}