EVOLUTION-MANAGER
Edit File: sourceutils.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: Source Reference Utilities</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 sourceutils {utils}"><tr><td>sourceutils {utils}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2> Source Reference Utilities </h2> <h3>Description</h3> <p>These functions extract information from source references. </p> <h3>Usage</h3> <pre> getSrcFilename(x, full.names = FALSE, unique = TRUE) getSrcDirectory(x, unique = TRUE) getSrcref(x) getSrcLocation(x, which = c("line", "column", "byte", "parse"), first = TRUE) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>An object (typically a function) containing source references. </p> </td></tr> <tr valign="top"><td><code>full.names</code></td> <td> <p>Whether to include the full path in the filename result. </p> </td></tr> <tr valign="top"><td><code>unique</code></td> <td> <p>Whether to list only unique filenames/directories. </p> </td></tr> <tr valign="top"><td><code>which</code></td> <td> <p>Which part of a source reference to extract. Can be abbreviated. </p> </td></tr> <tr valign="top"><td><code>first</code></td> <td> <p>Whether to show the first (or last) location of the object. </p> </td></tr> </table> <h3>Details</h3> <p>Each statement of a function will have its own source reference if the <code>"keep.source"</code> option is <code>TRUE</code>. These functions retrieve all of them. </p> <p>The components are as follows: </p> <dl> <dt>line</dt><dd><p>The line number where the object starts or ends.</p> </dd> <dt>column</dt><dd><p>The column number where the object starts or ends.</p> </dd> <dt>byte</dt><dd><p>As for <code>"column"</code>, but counting bytes, which may differ in case of multibyte characters.</p> </dd> <dt>parse</dt><dd><p>As for <code>"line"</code>, but this ignores <code>#line</code> directives.</p> </dd> </dl> <h3>Value</h3> <p><code>getSrcFilename</code> and <code>getSrcDirectory</code> return character vectors holding the filename/directory. </p> <p><code>getSrcref</code> returns a list of <code>"srcref"</code> objects or <code>NULL</code> if there are none. </p> <p><code>getSrcLocation</code> returns an integer vector of the requested type of locations. </p> <h3>See Also</h3> <p><code><a href="../../base/html/srcfile.html">srcref</a></code>, <code><a href="getParseData.html">getParseData</a></code> </p> <h3>Examples</h3> <pre> fn <- function(x) { x + 1 # A comment, kept as part of the source } # Show the temporary file directory # where the example was saved getSrcDirectory(fn) getSrcLocation(fn, "line") </pre> <hr /><div style="text-align: center;">[Package <em>utils</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>