These functions take the output of the
and produce a help page from it. As they are mainly
intended for internal use, their interfaces are subject to change.
Rd2HTML(Rd, out = "", package = "", defines = .Platform$OS.type, Links = NULL, Links2 = NULL, stages = "render", outputEncoding = "UTF-8", dynamic = FALSE, no_links = FALSE, fragment = FALSE, stylesheet = "R.css", ...)
Rd2txt(Rd, out = "", package = "", defines = .Platform$OS.type, stages = "render", outputEncoding = "", fragment = FALSE, options, ...)
Rd2latex(Rd, out = "", defines = .Platform$OS.type, stages = "render", outputEncoding = "ASCII", fragment = FALSE, ..., writeEncoding = TRUE)
Rd2ex(Rd, out = "", defines = .Platform$OS.type, stages = "render", outputEncoding = "UTF-8", commentDontrun = TRUE, commentDonttest = FALSE, ...)
- a filename or
Rdobject to use as input.
- a filename or connection object to which to write the output.
- the package to list in the output.
- string(s) to use in
- at which stage (
\Sexprmacros be executed? See the notes below.
- see the ‘Encodings’ section below.
- logical: set links for render-time resolution by dynamic help system.
- logical: suppress hyperlinks to other help topics.
R CMD Rdconv.
- logical: should fragments of Rd files be accepted? See the notes below.
- character: a URL for a stylesheet to be used in the header of the HTML output page.
- Links, Links2
NULLor a named (by topics) character vector of links, as returned by
- An optional named list of options to pass to
- additional parameters to pass to
Rdis a filename.
\inputencodinglines be written in the file for non-ASCII encodings?
\dontrunsections be commented out?
\donttestsections be commented out?
These functions convert help documents:
Rd2HTML produces HTML,
Rd2txt produces plain text,
Rd2latex produces LaTeX.
Rd2ex extracts the examples in the format used by
example and R utilities. Each of the functions accepts a filename for an Rd file, and
parse_Rd to parse it before applying the
conversions or checks. The difference between arguments
Link2 is that
links are looked in them in turn, so lazy-evaluation can be used to
only do a second-level search for links if required. Note that the default for
Rd2latex is to output ASCII,
including using the second option of
\enc markup. This was
chosen because use of UTF-8 in LaTeX requires version
‘2005/12/01’ or later, and even with that version the coverage
of UTF-8 glyphs is not extensive (and not even as complete as
Rd2txt will format text paragraphs to a width determined by
width, with appropriate margins. The default is to be close to
the rendering in versions of R < 2.10.0.
Rd2txt will use directional quotes (see
"useFancyQuotes" is true (the default) and
the current encoding is UTF-8.
the current locale uses a single-byte encoding (except C).
(Directional quotes are not attempted in East Asian locales as they are
usually double-width, which looks wrong with English text.) Various aspects of formatting by
Rd2txt are controlled by the
options argument, documented with the
function. Changes made using
options are temporary, those
Rd2txt_options are persistent. When
fragment = TRUE, the
Rd file will be rendered
with no processing of
\Sexpr elements or conditional defines
#ifndef. Normally a fragment represents
text within a section, but if the first element of the fragment
is a section macro, the whole fragment will be rendered as
a series of sections, without the usual sorting.
These functions are executed mainly for the side effect of
writing the converted help page. Their value is the name of the output
file (invisibly). For
Rd2latex, the output name is given an
"latexEncoding" giving the encoding of the file in a
form suitable for use with the LaTeX inputenc package.
\Sexpr macro is a new addition to Rd files. It includes
R code that will be executed at one of three times: build time
(when a package's source code is built into a tarball),
install time (when the package is installed or
built into a binary package), and render time (when the man
page is converted to a readable format). For example, this man page was:
- built on 2017-03-31 at 05:30:11 ,
- installed on 2017-03-31 at 05:30:11 , and
- rendered on 2017-03-31 at 05:30:11 .
Rd files are normally intended to be rendered on a wide variety of
systems, so care must be taken in the encoding of non-ASCII
characters. In general, any such encoding should be declared using
the encoding section for there to be any hope of correct
rendering. For output, the
outputEncoding argument will be used:
outputEncoding = "" will choose the native encoding for the
current system. If the text cannot be converted to the
substitution will be used (see
Rd2ex give a warning.