edit
Text Editor
Description
Invokes a text editor on an object and returns the edited version.
Usage
edit(name, ...)
## 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 = "")
Arguments
name |
any object to be edited. If missing, an empty function is edited.
|
file |
the name of the file in which the object should be written while the editing
is done.
If file is missing, edit uses the tempfile function to
generate a unique file name beginning with the character string specified
under editor.
|
editor |
a character string containing the name the edit.
The editor should be in your path or the string must be the full path to the
editor.
By having the text editor as an argument,
edit can be used as a building block to write other editor functions.
If editor is missing,
edit defaults to options()$editor.
If options()$editor is NULL,
the value of Sys.getenv("EDITOR") is used.
|
title |
an optional character string to use as the title of the editor window.
|
dots |
additional arguments to be passed to or from other functions.
|
Details
Note that edit does not change data; the returned value
must be reassigned to save your editing changes, as in the examples.
If errors resulted during the evaluation of the expression containing the
editing, the file is retained and calling edit with no arguments allows
re-editing of the file. This is typically useful when you edit a function
definition that produced a syntax error.
The functions vi, emacs, pico, xedit, xemacs
are edit.default methods
with the editor set to "vi", "emacs", "pico", "xedit", "xemacs", respectively.
At this time,
the vi, emacs, pico, xedit, xemacs functions
work only under Linux.
If any of these functions is called under Windows, the notepad editor is used.
Value
returns the edited value of the object.
See Also
fix
Examples
## Not run:
ttt <- edit(123)
ttt <- edit()
ttt <- edit(123, editor="c:/apps/notepad++/notepad++.exe")
## End(Not run)