[R] editor for MacOS

Gene gcutler at amgen.com
Fri Dec 17 22:27:30 CET 2010


I'm the original author of the R colorzing code for TextWrangler/BBEdit
mentioned by Steve (it was later updated and maintained by Jonathan Marc
Bearak:
http://homepages.nyu.edu/~jmb736/code/R_language_module_for_BBEdit/R.plist),
and highly recommend the use of BBEdit or TextWrangler along with this
syntax highlighting code for R coding on the Mac.

The applescript code at
https://stat.ethz.ch/pipermail/r-sig-mac/2008-November/005541.html doesn't
quite work for me, but I use something similar.  Paste the following into
AppleScript editor then save it as a script file in "~/Library/Application
Support/BBEdit/Scripts/" (substitute TextWrangler for BBEdit if
appropriate), named something like "Run in R.scpt":

set selectedText to selection as string
tell application "R64"
	activate
	cmd selectedText
end tell

Do the same for this second version, which I call "Run in R
background.scpt":

set selectedText to selection as string
tell application "R64"
	activate
	cmd selectedText
end tell
tell application "BBEdit"
	activate
end tell

Then, I assign the following keyboard shortcuts for the two scripts:
Run in R = command-option-period
Run in R background = command-option-slash

The first script will send the highlighted text to the R GUI to have it run,
while the second script will do the same, but then switch back to BBEdit
after running it.  That way I can just type away, hit command-option-slash,
and keep typing without interruption.  I find this workflow to be very
efficient.

- Gene

-- 
View this message in context: http://r.789695.n4.nabble.com/editor-for-MacOS-tp3091083p3093142.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list