[R-SIG-Mac] New user question
J ö rg Beyer
Beyerj at students.uni-marburg.de
Wed Mar 28 20:19:42 CEST 2007
Hi Linda,
I think there is currently no direct, easy and/or satisfying solution for
your scenario. The probably most convenient solution is to set up your
scripts in a way that they can be "source"d in via the menu command "File >
Source File...", which gives you a file selection dialog; R.app will then
generate a source()-command, read the selected file and execute the found
code. This is the same as _manually_ typing "source("path/to/R-script")" in
R.app's console window.
As for Automator, AppleScript and friends, the big picture is a bit more
complex (apologies if you already know that): The question is not in the
first place, whether Automator or AppleScript can accomplish this or that,
it rather depends on the scripting support an application offers. It's a
design decision made by the application's developer(s). No scripting support
in the application -- no scriptability; weak scripting support -- weak
scriptability; ...
So the question is "Does R.app offer scripting support, and to which
extend?" A look at R.app's AppleScript dictionary shows that the only
command that could be useful here is "cmd" to send and execute R-code. There
is no "source file" command or something comparable in R.app's scriptability
features.
You could of course develop an AppleScript-, AppleScript Studio- or
Automator-based solution that simply uses R.app's "cmd" to build and send
"source("path/to/R-script")" commands and wrap some GUI elements around it.
But I doubt that such a solution would be worth the effort, and of course it
depends on the skills you already have with one of Apple's automation
technologies.
BTW, some month ago I suggested to add a configurable script palette to
R.app's feature set (similar to the palettes in TextWrangler and BBEdit),
which would provide a way to easily select and execute script files. We will
have to wait and see what the future brings. It depends on whether or not
the developers of R.app find the idea useful, and of course whether they
find the time to implement it.
Hope this helps.
Jörg
> Dear R Mac developers group,
>
> I hope this question is appropriate for this list.
>
> I'm a new user (a few months) and R has been great. Thank you!
>
> If it's possible, I'd like to make a simple GUI or other front end to a
> few of my R scripts for my non-coding colleagues to use (or even little
> stand-alone apps.)
>
> Could Automator or AppleScript, or something else, be used to do this?
> (I don't know either yet; looking at Automator it wasn't immediately
> clear to me whether or not it can talk to R.) Any recommendations
> appreciated!
>
> Many thanks,
> Linda Palmer
============================================================
Jörg Beyer
e-mail: Beyerj at students.uni-marburg.de
PHILIPPS-University Marburg
Dept. of Psychology
Germany
More information about the R-SIG-Mac
mailing list