[R] Exporting tables to RTF?

Aaron Solomon Adelman aaron.solomon.adelman at gmail.com
Tue Jul 4 20:26:07 CEST 2006


Yesterday I managed to jury-rig a system to get a table out of R and  
import it into Nisus Writer Express (a word processor for Mac OS X).   
What I came up with is brittle, since it depends on an AppleScript  
script which has to be in a specific location and on no one touching  
the computer, since the AppleScript remotely controls Nisus Writer  
Express rather blindly and will make it do something wrong if  
everything is not exactly where it expects it to be.

There has to be a more robust way of doing this.

Ideally, I'd like to have R translate one of its tables into a table  
in an RTF file and then have Nisus Writer Express open the file.  Has  
anyone written any code to do the RTF file-writing part?  (I didn't  
find anything in CRAN.  The second part I can do easily enough.)

Alternatively, I could try to get rid of the external AppleScript and  
control Nisus Writer Express directly from R.  However, to do that, I  
need to use system() to pass commands to the shell to pass commands  
to AppleScript to pass commands to Nisus Writer Express.  I haven't  
gotten this to work because I haven't managed to figure out how to  
formulate the escape codes.  My AppleScript commands have to be in  
the form of:

tell application "Nisus Writer Express" to <do something or other>

Can anyone tell me how to escape such statements so I can pass them  
to osascript (a shell program that runs AppleScript) and (by  
extension) pass them to system()?

Thanks in advance for any help anyone can provide.


Aaron Solomon (ben Saul Joseph) Adelman
E-mail:  Aaron.Solomon.Adelman at gmail.com, adelmaas at musc.edu
Web-sites:  http://weirdthingoftheday.blogspot.com/ , http:// 
AOL Instant Messenger & Yahoo! Messenger:  Hiergargo
ICQ:  258691118
Jabber:  Aaron.Solomon.Adelman at gmail.com

More information about the R-help mailing list