\Header{edit}{Invoke a Text Editor}
\alias{vi}{edit}
\alias{emacs}{edit}
\alias{pico}{edit}
\alias{xemacs}{edit}
\alias{xedit}{edit}
\keyword{utilities}{edit}
\begin{Usage}
\begin{verbatim}
edit(name=NULL, file="", editor = "vi")
vi(name=NULL, file="")
emacs(name=NULL, file="")
pico(name=NULL, file="")
xemacs(name=NULL, file="")
xedit(name=NULL, file="")
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\texttt{name}] a named object that you want to edit. If name is missing then the
file specified by \texttt{file} is opened for editing.
\item[\texttt{file}] a string naming the file to write the edited version to.
\item[\texttt{editor}] a string naming the text editor you want to use.
\end{ldescription}
\end{Arguments}
\begin{Description}
\texttt{edit} invokes the text editor specified by \texttt{editor} with the object
\texttt{name} to be edited.
\texttt{data.entry} can be used to edit data.
It is important to realize that \texttt{edit} does not change
the object called \texttt{name}.
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 \texttt{name}
you must assign the result of \texttt{edit} to \texttt{name}.
(Try \texttt{\Link{fix}} if you want to make permanent changes to an object.)

In the form \texttt{edit(name)},
\texttt{edit} deparses \texttt{name} into a temporary file and invokes the
editor \texttt{editor} on this file. Quiting from the editor causes
\texttt{file} to be parsed and that value returned.
Should an error occur in parsing, possibly due to incorrect syntax, no
value is returned. Calling \texttt{edit()}, with no arguments, will
result in the temporary file being reopened for further editing.\end{Description}
\begin{SeeAlso}
\texttt{\Link{data.entry}}, \texttt{\Link{fix}}.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}

# 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{ExampleCode}
\end{Examples}

