edit()
and you go for it.
There is a potential trap here. If you happen to like the system's preferred
editor (which happens to be vi
on my system - it will probably be
Notepad on Windows), you will probably be overjoyed. The first time I found
myself in vi
, I didn't know how to use it.
Even worse, I didn't know how to exit from it. So the first thing you may
want to do is change the editor to your preference.
First invoke the function
> options()
you'll see, right up near the top of the list,
$editor [1] "vi"
Now you can temporarily change the default editor with:
> options(editor="my_favorite_editor")
but you might not want to do this every time you start up R. The .First() function can do the work for you.
> .First<-function() { + options(editor="my_favorite_editor") + }
You may prefer to put this into one of the
initialization files
Use .Rprofile
to limit this preference to your home directory, or
Rprofile
to make it system-wide.
For more information, see An Introduction to R: Appendix B.