EVOLUTION-MANAGER
Edit File: parse_Rd.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: Parse an Rd File</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 parse_Rd {tools}"><tr><td>parse_Rd {tools}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Parse an Rd File</h2> <h3>Description</h3> <p>This function reads an R documentation (Rd) file and parses it, for processing by other functions. </p> <h3>Usage</h3> <pre> parse_Rd(file, srcfile = NULL, encoding = "unknown", verbose = FALSE, fragment = FALSE, warningCalls = TRUE, macros = file.path(R.home("share"), "Rd", "macros", "system.Rd"), permissive = FALSE) ## S3 method for class 'Rd' print(x, deparse = FALSE, ...) ## S3 method for class 'Rd' as.character(x, deparse = FALSE, ...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>file</code></td> <td> <p>A filename or text-mode connection. At present filenames work best.</p> </td></tr> <tr valign="top"><td><code>srcfile</code></td> <td> <p><code>NULL</code>, or a <code>"srcfile"</code> object. See the ‘Details’ section.</p> </td></tr> <tr valign="top"><td><code>encoding</code></td> <td> <p>Encoding to be assumed for input strings.</p> </td></tr> <tr valign="top"><td><code>verbose</code></td> <td> <p>Logical indicating whether detailed parsing information should be printed.</p> </td></tr> <tr valign="top"><td><code>fragment</code></td> <td> <p>Logical indicating whether file represents a complete Rd file, or a fragment.</p> </td></tr> <tr valign="top"><td><code>warningCalls</code></td> <td> <p>Logical: should parser warnings include the call?</p> </td></tr> <tr valign="top"><td><code>macros</code></td> <td> <p>Filename or environment from which to load additional macros, or a logical value. See the Details below.</p> </td></tr> <tr valign="top"><td><code>permissive</code></td> <td> <p>Logical indicating that unrecognized macros should be treated as text with no warning.</p> </td></tr> <tr valign="top"><td><code>x</code></td> <td> <p>An object of class Rd.</p> </td></tr> <tr valign="top"><td><code>deparse</code></td> <td> <p>If <code>TRUE</code>, attempt to reinstate the escape characters so that the resulting characters will parse to the same object.</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>Further arguments to be passed to or from other methods.</p> </td></tr> </table> <h3>Details</h3> <p>This function parses ‘<span class="file">Rd</span>’ files according to the specification given in <a href="https://developer.r-project.org/parseRd.pdf">https://developer.r-project.org/parseRd.pdf</a>. </p> <p>It generates a warning for each parse error and attempts to continue parsing. In order to continue, it is generally necessary to drop some parts of the file, so such warnings should not be ignored. </p> <p>Files without a marked encoding are by default assumed to be in the native encoding. An alternate default can be set using the <code>encoding</code> argument. All text in files is translated to the UTF-8 encoding in the parsed object. </p> <p>As from <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> version 3.2.0, User-defined macros may be given in a separate file using <span class="samp">\newcommand</span> or <span class="samp">\renewcommand</span>. An environment may also be given: it would be produced by <code><a href="loadRdMacros.html">loadRdMacros</a></code>, <code><a href="loadRdMacros.html">loadPkgRdMacros</a></code>, or by a previous call to <code>parse_Rd</code>. If a logical value is given, only the default built-in macros will be used; <code>FALSE</code> indicates that no <code>"macros"</code> attribute will be returned with the result. </p> <p>The <code>permissive</code> argument allows text to be parsed that is not completely in Rd format. Typically it would be LaTeX code, used in an Rd fragment, e.g. in a <code><a href="../../utils/html/bibentry.html">bibentry</a></code>. With <code>permissive = TRUE</code>, this will be passed through as plain text. Since <code>parse_Rd</code> doesn't know how many arguments belong in LaTeX macros, it will guess based on the presence of braces after the macro; this is not infallible. </p> <h3>Value</h3> <p><code>parse_Rd</code> returns an object of class <code>"Rd"</code>. The internal format of this object is subject to change. The <code>as.character()</code> and <code>print()</code> methods defined for the class return character vectors and print them, respectively. </p> <p>Unless <code>macros = FALSE</code>, the object will have an attribute named <code>"macros"</code>, which is an environment containing the macros defined in <code>file</code>, in a format that can be used for further <code>parse_Rd</code> calls in the same session. It is not guaranteed to work if saved to a file and reloaded in a different session. </p> <h3>Author(s)</h3> <p> Duncan Murdoch </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="Rd2HTML.html">Rd2HTML</a></code> for the converters that use the output of <code>parse_Rd()</code>. </p> <hr /><div style="text-align: center;">[Package <em>tools</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>