[R] Command equivalent of rgui "File, Save to File"?

Michael Prager mike.prager at noaa.gov
Tue Sep 12 15:27:04 CEST 2006


Duncan Murdoch wrote:

> On 9/11/2006 3:57 PM, Michael Prager wrote:
> > R 2.3.1 on Windows XP Professional.
> > 
> > I am writing some scripts to generate examples.  The Rgui menu
> > item "File, Save to File" is helpful.  Is there perhaps an
> > equivalent R function that can be incorporated into a script?
> 
> I think sink() is the closest you can get: set R to write to a file 
> before generating whatever output you want to save.
> 
> The menu item writes out the GUI text buffer; the R core doesn't know 
> what's in that buffer.  Other front ends don't have a buffer at all.
> 
[...]

Thanks, Duncan, for the helpful response.  Unless I have
overlooked something (quite possible), sink() saves only the
output, not the input as well.  I'll continue using the menu
system -- which I am delighted to have.

Mike

Mike Prager
Southeast Fisheries Science Center, NOAA
Beaufort, North Carolina  USA



More information about the R-help mailing list