[R] Command equivalent of rgui "File, Save to File"?
murdoch at stats.uwo.ca
Tue Sep 12 02:37:52 CEST 2006
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.
Of course, we could write an Rgui-specific C function that put that text
into an R character vector so you could do what you liked with it, but
since sink() exists and is portable, there isn't a lot of motivation to
do that. This will happen automatically if we ever get around to
defining an abstract GUI interface all controllable and configurable
from R, but I don't know anyone working on that right now.
> Mike Prager
> Southeast Fisheries Science Center, NOAA
> Beaufort, North Carolina USA
> R-help at stat.math.ethz.ch mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help