The R help system
?x is the usual way to get help on
x; it's primarily a shortcut for
help(x). There are rarer but more flexible variations, such as
help(x,...). See base-R help on help. The versions of
? exported by
mvbutils behave exactly the same as base-R, unless base-R
help fails after being called with a single argument, e.g.
help(topic). In that case, if
topic is an object with an attribute called "doc" (or failing that if
topic.doc is a character vector), then the attribute (or the character object) will be formatted and displayed by the pager (by default) or browser. This lets you write informal documentation for non-package objects that can still be found by
help, and by colleagues you distribute your code to. See
dochelp for more information. The rest of this documentation is copied directly from base-R for
help, except as noted under Arguments for
1 2 3 4
usually, a name or character string specifying the topic for which help is sought. A character string (enclosed in explicit single or double quotes) is always taken as naming a topic. If the value of
a name or character vector giving the packages to look into for documentation, or
a character vector of directory names of R libraries, or
logical; see Note.
character string:the type of help required. Possible values are "text", "html" and "pdf". Case is ignored, and partial matching is allowed. [Note that, for informal doco,
The following types of help are available:
Plain text help
HTML help pages with hyperlinks to other topics, shown in a browser by
browseURL. If for some reason HTML help is unavailable (see
startDynamicHelp), plain text help will be used instead.
helponly, typeset as PDF - see the section on Offline help.
The default for the type of help is selected when R is installed - the
factory-fresh default is HTML help.
The rendering of text help will use directional quotes in suitable locales (UTF-8 and single-byte Windows locales): sometimes the fonts used do not support these quotes so this can be turned off by setting
options(useFancyQuotes = FALSE).
topic is not optional. If it is omitted, R will give:
If a package is specified, (text or, in interactive use only, HTML) information on the package, including hints/links to suitable help topics.
lib.loconly is specified, a (text) list of available packages.
helpitself if none of the first three arguments is specified.
Some topics need to be quoted (by backticks) or given as a character string. These include those which cannot syntactically appear on their own such as unary and binary operators,
function and control-flow reserved words (including
next). The other
reserved words can be used as if they were names, for example
If multiple help files matching
topic are found, in interactive use a menu is presented for the user to choose one: in batch use the first on the search path is used. (For HTML help the menu will be an HTML page, otherwise a graphical menu if possible if
getOption("menu.graphics") is true, the default.)
Note that HTML help does not make use of
lib.loc: it will always look first in the attached packages and then along
Typeset documentation is produced by running the LaTeX version of the help page through
pdflatex: this will produce a PDF file.
The appearance of the output can be customized through a file
Rhelp.cfg somewhere in your LaTeX search path: this will be input as a LaTeX style file after
Rd.sty. Some environment variables are consulted, notably
Making manuals in the
R Installation and Administration Manual).
If there is a function
offline_help_helper in the workspace or further down the search path it is used to do the typesetting, otherwise the function of that name in the
utils namespace (to which the first paragraph applies). It should accept at least two arguments, the name of the LaTeX file to be typeset and the type (which as from R 2.15.0 is ignored). As from R 2.14.0 it should accept a third argument,
texinputs, which will give the graphics path when the help document contains figures, and will otherwise not be supplied.
lib.loc is specified explicitly, the loaded packages are searched before those in the specified libraries. This ensures that if a library is loaded from a library not in the known library trees, then the help from the loaded library is used. If
lib.loc is specified explicitly, the loaded packages are not searched.
If this search fails and argument
TRUE and neither
lib.loc is specified, then all the packages in the known library trees are searched for help on
topic and a list of (any) packages where help may be found is displayed (with hyperlinks for
help_type = "html"). NB: searching all packages can be slow, especially the first time (caching of files by the OS can expedite subsequent searches dramatically).
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.
? for shortcuts to help topics.
dochelp for how to write informal help with
?? for finding help pages on a vague topic;
help.start() which opens the HTML version of the R help pages;
library() for listing available packages and the help objects they contain;
data() for listing available data sets;
prompt() to get a prototype for writing
help pages of your own package.
1 2 3 4 5 6 7 8 9 10 11 12 13
help() help(help) # the same help(lapply) help("for") # or ?"for", but quotes/backticks are needed help(package="splines") # get help even when package is not loaded topi <- "women" help(topi) try(help("bs", try.all.packages=FALSE)) # reports not found (an error) help("bs", try.all.packages=TRUE) # reports can be found # in package 'splines' ## For programmatic use: topic <- "family"; pkg_ref <- "stats" help((topic), (pkg_ref))
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.