EVOLUTION-MANAGER
Edit File: Rd2HTML.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Rd Converters</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for Rd2HTML {tools}"><tr><td>Rd2HTML {tools}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2> Rd Converters </h2> <h3>Description</h3> <p>These functions take the output of the <code><a href="parse_Rd.html">parse_Rd</a></code> function and produce a help page from it. As they are mainly intended for internal use, their interfaces are subject to change. </p> <h3>Usage</h3> <pre> 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 = "UTF-8", fragment = FALSE, ..., writeEncoding = TRUE) Rd2ex(Rd, out = "", defines = .Platform$OS.type, stages = "render", outputEncoding = "UTF-8", commentDontrun = TRUE, commentDonttest = FALSE, ...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>Rd</code></td> <td> <p> a filename or <code>Rd</code> object to use as input. </p> </td></tr> <tr valign="top"><td><code>out</code></td> <td> <p> a filename or connection object to which to write the output. </p> </td></tr> <tr valign="top"><td><code>package</code></td> <td> <p> the package to list in the output. </p> </td></tr> <tr valign="top"><td><code>defines</code></td> <td> <p> string(s) to use in <code style="white-space: pre;">#ifdef</code> tests. </p> </td></tr> <tr valign="top"><td><code>stages</code></td> <td> <p> at which stage (<code>"build"</code>, <code>"install"</code>, or <code>"render"</code>) should <code style="white-space: pre;">\Sexpr</code> macros be executed? See the notes below.</p> </td></tr> <tr valign="top"><td><code>outputEncoding</code></td> <td> <p> see the ‘Encodings’ section below.</p> </td></tr> <tr valign="top"><td><code>dynamic</code></td> <td> <p>logical: set links for render-time resolution by dynamic help system.</p> </td></tr> <tr valign="top"><td><code>no_links</code></td> <td> <p>logical: suppress hyperlinks to other help topics. Used by <code>R CMD <a href="../../base/html/RdUtils.html">Rdconv</a></code>.</p> </td></tr> <tr valign="top"><td><code>fragment</code></td> <td> <p>logical: should fragments of Rd files be accepted? See the notes below.</p> </td></tr> <tr valign="top"><td><code>stylesheet</code></td> <td> <p>character: a URL for a stylesheet to be used in the header of the HTML output page.</p> </td></tr> <tr valign="top"><td><code>Links, Links2</code></td> <td> <p><code>NULL</code> or a named (by topics) character vector of links, as returned by <code><a href="HTMLlinks.html">findHTMLlinks</a></code>.</p> </td></tr> <tr valign="top"><td><code>options</code></td> <td> <p>An optional named list of options to pass to <code><a href="Rd2txt_options.html">Rd2txt_options</a></code>.</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p> additional parameters to pass to <code><a href="parse_Rd.html">parse_Rd</a></code> when <code>Rd</code> is a filename. </p> </td></tr> <tr valign="top"><td><code>writeEncoding</code></td> <td> <p>should <code style="white-space: pre;">\inputencoding</code> lines be written in the file for non-ASCII encodings?</p> </td></tr> <tr valign="top"><td><code>commentDontrun</code></td> <td> <p>should <code style="white-space: pre;">\dontrun</code> sections be commented out?</p> </td></tr> <tr valign="top"><td><code>commentDonttest</code></td> <td> <p>should <code style="white-space: pre;">\donttest</code> sections be commented out?</p> </td></tr> </table> <h3>Details</h3> <p>These functions convert help documents: <code>Rd2HTML</code> produces HTML, <code>Rd2txt</code> produces plain text, <code>Rd2latex</code> produces LaTeX. <code>Rd2ex</code> extracts the examples in the format used by <code><a href="../../utils/html/example.html">example</a></code> and <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> utilities. </p> <p>Each of the functions accepts a filename for an Rd file, and will use <code><a href="parse_Rd.html">parse_Rd</a></code> to parse it before applying the conversions or checks. </p> <p>The difference between arguments <code>Link</code> and <code>Link2</code> 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. </p> <p>Note that the default for <code>Rd2latex</code> is to output ASCII, including using the second option of <code style="white-space: pre;">\enc</code> 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 Latin-1). </p> <p><code>Rd2txt</code> will format text paragraphs to a width determined by <code>width</code>, with appropriate margins. The default is to be close to the rendering in versions of <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> < 2.10.0. </p> <p><code>Rd2txt</code> will use directional quotes (see <code><a href="../../base/html/sQuote.html">sQuote</a></code>) if option <code>"useFancyQuotes"</code> is true (the default) and the current encoding is UTF-8. </p> <p>Various aspects of formatting by <code>Rd2txt</code> are controlled by the <code>options</code> argument, documented with the <code><a href="Rd2txt_options.html">Rd2txt_options</a></code> function. Changes made using <code>options</code> are temporary, those made with <code><a href="Rd2txt_options.html">Rd2txt_options</a></code> are persistent. </p> <p>When <code>fragment = TRUE</code>, the <code>Rd</code> file will be rendered with no processing of <code style="white-space: pre;">\Sexpr</code> elements or conditional defines using <code style="white-space: pre;">#ifdef</code> or <code style="white-space: pre;">#ifndef</code>. 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. </p> <h3>Value</h3> <p>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 <code>Rd2latex</code>, the output name is given an attribute <code>"latexEncoding"</code> giving the encoding of the file in a form suitable for use with the LaTeX <span class="samp">inputenc</span> package. </p> <h3>Encodings</h3> <p>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 <span class="samp">encoding</span> section for there to be any hope of correct rendering. </p> <p>For output, the <code>outputEncoding</code> argument will be used: <code>outputEncoding = ""</code> will choose the native encoding for the current system. </p> <p>If the text cannot be converted to the <code>outputEncoding</code>, byte substitution will be used (see <code><a href="../../base/html/iconv.html">iconv</a></code>): <code>Rd2latex</code> and <code>Rd2ex</code> give a warning. </p> <h3>Note</h3> <p>The <code style="white-space: pre;">\Sexpr</code> macro is a new addition to Rd files. It includes <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> code that will be executed at one of three times: <em>build</em> time (when a package's source code is built into a tarball), <em>install</em> time (when the package is installed or built into a binary package), and <em>render</em> time (when the man page is converted to a readable format). </p> <p>For example, this man page was: </p> <ol> <li><p> built on 2019-05-31 at 18:36:20, </p> </li> <li><p> installed on 2019-05-31 at 18:36:20, and </p> </li> <li><p> rendered on 2019-05-31 at 18:36:36. </p> </li></ol> <h3>Author(s)</h3> <p>Duncan Murdoch, Brian Ripley </p> <h3>References</h3> <p><a href="https://developer.r-project.org/parseRd.pdf">https://developer.r-project.org/parseRd.pdf</a> </p> <h3>See Also</h3> <p><code><a href="parse_Rd.html">parse_Rd</a></code>, <code><a href="checkRd.html">checkRd</a></code>, <code><a href="HTMLlinks.html">findHTMLlinks</a></code>, <code><a href="Rd2txt_options.html">Rd2txt_options</a></code>. </p> <h3>Examples</h3> <pre> ## Not run: ## Simulate install and rendering of this page in HTML and text format: Rd <- file.path("src/library/tools/man/Rd2HTML.Rd") outfile <- tempfile(fileext = ".html") browseURL(Rd2HTML(Rd, outfile, package = "tools", stages = c("install", "render"))) outfile <- tempfile(fileext = ".txt") file.show(Rd2txt(Rd, outfile, package = "tools", stages = c("install", "render"))) checkRd(Rd) # A stricter test than Rd2HTML uses ## End(Not run)</pre> <hr /><div style="text-align: center;">[Package <em>tools</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>