[R-SIG-Mac] trace(..., edit=TRUE) with external editor
goedman at mac.com
Tue Jul 22 16:55:19 CEST 2008
It takes a few more steps in an external editor:
1. In your example below, with TextMate as the external editor
preference, change the 1st line in the newly opened Textmate edit
window from 'function (x, y, ...)', e.g. to e.g. 'myplot <-function
(x, y, ...)'
2. Add, again following your example, the 'message("Hi")' line
3. Send the document to R (you can't use Command-R immediately as the
Textmate edit window is likely in default mode (unless you saved the
file with a .R extension). Change it to R mode and Command-R should do
the trick. Or select the appropriate entry from the R command group.
Using the external editor, R is not kept 'waiting' for the editor to
close, so above steps are required.
For this reason, I rarely define TextEdit etc. as an external editor
in R.app's preferences. All edit work I do inside a TextMate project
and 'source' (command-R) files from there. Your example then happily
uses the internal editor. By saving the edited trace file from within
the internal editor in your TextMate project directory, it will be
added to your project list in TextMate. This way I can also use the
other nifty features of the internal editor (almost as a different
kind of help window).
Hope this helps,
On Jul 21, 2008, at 7:43 PM, Ryan Hafen wrote:
> I am using an external editor (TextMate) with R and I want to be
> able to successfully use trace(function, edit=TRUE). Has anyone
> been able to do this?
> I am using Leopard, R version 2.7.0 R.app GUI 1.24 (5102). I've
> tried it with other external editors as well. For example, set an
> external editor (TextEdit, for example) in the Preferences and then
> try "trace(plot, edit=TRUE)" and add something like "message('hi')"
> to the top of the function, save and exit the text editor. Then
> call "body(plot" in R - the added line is not there. Is it not
> possible? Thanks!
> R-SIG-Mac mailing list
> R-SIG-Mac at stat.math.ethz.ch
More information about the R-SIG-Mac