[R-SIG-Mac] shell.exe() equivalent?

Rolf Turner r.turner at auckland.ac.nz
Thu Mar 25 01:35:23 CET 2010


On 25/03/2010, at 1:26 PM, Kasper Daniel Hansen wrote:

> There might be a better way, but on the mac "open" opens a file as if
> you doubleclick on it in Finder, and the "system" command in R
> executes a shell command, so you should be able to do
> 
> R> system(paste("open", filename))

Note that Mac OSX is really Unix (with an annoying point-and-click veneer
pasted on top of it) so you don't need to mess around with this ``open''
nonsense.  Just make ``filename'' executable.  Then you can do

 > system(filename)

Or if ``filename'' is not executable and you don't want to bother making
it so, do

 > system(paste("source",filename))

(That's the ***right*** --- i.e. Unix --- way of doing things.)

	cheers,

		Rolf Turner
> 
> Kasper
> 
> On Wed, Mar 24, 2010 at 7:37 PM, Gi-Mick Wu <mick.wu at mail.mcgill.ca> wrote:
>> Greetings R Mac users,
>> 
>> I switched from windows to mac relatively recently (better late than never), and am still adjusting.
>> 
>> Does anyone know whether there is the equivalent of shell.exe(filename)?
>> 
>> Basically, I used the command to view a graph that was just saved in a pdf/png or other formats without having to manually open the file.
>> 
>> ### Example:
>> pdf(filename, ... )
>>   plot( ... )
>> dev.off()
>> shell.exec(filename)
>> 
>> ###
>> 
>> Thanks!
>> Mick
>> PS I searched the list, R help, & google, but did not find it
>> 
>> _______________________________________________
>> R-SIG-Mac mailing list
>> R-SIG-Mac at stat.math.ethz.ch
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>> 
> 
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac

######################################################################
Attention: 
This e-mail message is privileged and confidential. If you are not the 
intended recipient please delete the message and notify the sender. 
Any views or opinions presented are solely those of the author.

This e-mail has been scanned and cleared by MailMarshal 
www.marshalsoftware.com
######################################################################



More information about the R-SIG-Mac mailing list