EVOLUTION-MANAGER
Edit File: edit.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: Invoke a Text Editor</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 edit {utils}"><tr><td>edit {utils}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Invoke a Text Editor</h2> <h3>Description</h3> <p>Invoke a text editor on an <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> object. </p> <h3>Usage</h3> <pre> ## Default S3 method: edit(name = NULL, file = "", title = NULL, editor = getOption("editor"), ...) vi(name = NULL, file = "") emacs(name = NULL, file = "") pico(name = NULL, file = "") xemacs(name = NULL, file = "") xedit(name = NULL, file = "") </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>name</code></td> <td> <p>a named object that you want to edit. If name is missing then the file specified by <code>file</code> is opened for editing.</p> </td></tr> <tr valign="top"><td><code>file</code></td> <td> <p>a string naming the file to write the edited version to.</p> </td></tr> <tr valign="top"><td><code>title</code></td> <td> <p>a display name for the object being edited.</p> </td></tr> <tr valign="top"><td><code>editor</code></td> <td> <p>usually a character string naming (or giving the path to) the text editor you want to use. On Unix the default is set from the environment variables <span class="env">EDITOR</span> or <span class="env">VISUAL</span> if either is set, otherwise <code>vi</code> is used. On Windows it defaults to <code>"internal"</code>, the script editor. On the macOS GUI the argument is ignored and the document editor is always used. </p> <p><code>editor</code> can also be an <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> function, in which case it is called with the arguments <code>name</code>, <code>file</code>, and <code>title</code>. Note that such a function will need to independently implement all desired functionality. </p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>further arguments to be passed to or from methods.</p> </td></tr> </table> <h3>Details</h3> <p><code>edit</code> invokes the text editor specified by <code>editor</code> with the object <code>name</code> to be edited. It is a generic function, currently with a default method and one for data frames and matrices. </p> <p><code>data.entry</code> can be used to edit data, and is used by <code>edit</code> to edit matrices and data frames on systems for which <code>data.entry</code> is available. </p> <p>It is important to realize that <code>edit</code> does not change the object called <code>name</code>. Instead, a copy of name is made and it is that copy which is changed. Should you want the changes to apply to the object <code>name</code> you must assign the result of <code>edit</code> to <code>name</code>. (Try <code><a href="fix.html">fix</a></code> if you want to make permanent changes to an object.) </p> <p>In the form <code>edit(name)</code>, <code>edit</code> deparses <code>name</code> into a temporary file and invokes the editor <code>editor</code> on this file. Quitting from the editor causes <code>file</code> to be parsed and that value returned. Should an error occur in parsing, possibly due to incorrect syntax, no value is returned. Calling <code>edit()</code>, with no arguments, will result in the temporary file being reopened for further editing. </p> <p>Note that deparsing is not perfect, and the object recreated after editing can differ in subtle ways from that deparsed: see <code><a href="../../base/html/dput.html">dput</a></code> and <code><a href="../../base/html/deparseOpts.html">.deparseOpts</a></code>. (The deparse options used are the same as the defaults for <code>dump</code>.) Editing a function will preserve its environment. See <code><a href="edit.data.frame.html">edit.data.frame</a></code> for further changes that can occur when editing a data frame or matrix. </p> <p>Currently only the internal editor in Windows makes use of the <code>title</code> option; it displays the given name in the window header. </p> <h3>Note</h3> <p>The functions <code>vi</code>, <code>emacs</code>, <code>pico</code>, <code>xemacs</code>, <code>xedit</code> rely on the corresponding editor being available and being on the path. This is system-dependent. </p> <h3>See Also</h3> <p><code><a href="edit.data.frame.html">edit.data.frame</a></code>, <code><a href="dataentry.html">data.entry</a></code>, <code><a href="fix.html">fix</a></code>. </p> <h3>Examples</h3> <pre> ## Not run: # use xedit on the function mean and assign the changes mean <- edit(mean, editor = "xedit") # use vi on mean and write the result to file mean.out vi(mean, file = "mean.out") ## End(Not run) </pre> <hr /><div style="text-align: center;">[Package <em>utils</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>