[R-SIG-Mac] New user question

Linda Palmer lpalmer at cmu.edu
Thu Mar 29 00:34:43 CEST 2007


Many thanks to everyone for your responses!

The information has all been very helpful. So I should be able to put 
something simple together now. (It is just script running, maybe with 
some options, but pathnames seem to make the biologists uneasy...) And 
maybe dream about getting fancy in the future with tcl/tk or Cocoa.

Thanks again!
Linda

stefano iacus wrote:
> Hi All,
> R.app, as Jorg says, has very-very limited apple script support. I 
> originally implemented it and it is very weak (for several reasons, e.g. 
> no feedback is returned from the executed command; no synch, etc)
> Any contribution to add more scriptability to R.app is welcome.
> 
> If it is just a matter of running R scripts, then going directly to 
> R.app :File-> Source file is enough. You can also configure R to source 
> scripts by default on drag&drop, which should be also an interesting 
> shortcut.
> Of course, you can create an applescript to source a script into R, i.e 
> with something like "tell R.app cmd source(file)"
> 
> The tcltk package might be a solution but you need the user to install 
> X11, which is usually not installed by default of OS X machines.
> 
> An alternative is to create a Cocoa app on top of the cmd line version 
> of R for each of your ad-hoc scripts. There are several examples of 
> Cocoa GUIs built on top of unix commands (i.e. mplayer, ffmpegx, etc)
> 
> stefano
> 
> 
> On 28/mar/07, at 20:19, Jörg Beyer wrote:
> 
>> 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
>>
>> _______________________________________________
>> R-SIG-Mac mailing list
>> R-SIG-Mac at stat.math.ethz.ch
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
> 
> 

-- 
Linda Palmer
Research Scientist
Department of Philosophy and Center for the Neural Basis of Cognition
Carnegie Mellon University
135 Baker Hall, Pittsburgh, PA 15213
(412) 268-8046



More information about the R-SIG-Mac mailing list