Site icon R-bloggers

Launch R document from Smultron / Fraise

[This article was first published on Timothée Poisot » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Perhaps you know of the defunct Smultron, a lightweight editor for Mac OS X. There exists a new version called Fraise, with the same features. Among them, R syntax highlighting and the possibility to interact with the R Gui console.

To do so, when in Fraise, just push Cmd-B to open the Commands window, then create a new command, and type

#!/bin/bash
osascript -e ‘tell application "R.app" to activate’
osascript -e "tell application \"R.app\" to cmd \"setwd(‘%%d’)\""
osascript -e "tell application \"R.app\" to cmd \"source(file=’%%p’,
print.eval=TRUE)\""

You can assign a keyboard shortcut to this command. Whenever you will hit the keys, R.app will activate, set the good working directory, and execute your code. Now, you see that it is straightforward to modify this code / create another so that you execute the selected text only.

While Fraise is less powerful than TextMate and its R plugin, it is free, and really easier to instal that SciViews or StatEt.

To leave a comment for the author, please follow the link and comment on their blog: Timothée Poisot » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.