[R] Redirecting print output

Vladimir Eremeev wl2776 at gmail.com
Tue Jul 24 10:11:50 CEST 2007




Stan Hopkins wrote:
> 
> I see a rich set of graphic device functions to redirect that output.  Are
> there commands to redirect text as well.  I have a set of functions that
> execute many linear regression tests serially and I want to capture this
> in a file for printing.
> 
> Thanks,
> 
> Stan Hopkins
> 

Yes, there are.
?sink

You could also run your functions from a batch mode:
R < your_script.R > output.txt
or
Rscript your_script.R > output.txt

This, however, will give you a single file, while sink() allows creation of
multiple files.

capture.output can store the output in an array of character strings.

-- 
View this message in context: http://www.nabble.com/Redirecting-print-output-tf4134131.html#a11758652
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list