[R] Usage of sink()

Jianwen Luo goutyl at 163.com
Fri Jun 26 09:18:18 CEST 2015


just use same file handle.



 
From: My List
Date: 2015-06-26 15:37
To: R-help
Subject: [R] Usage of sink()
All:
 
I have the following code segment.
 
msg <- file("msg.txt", open="wt")
out   <- file("out.txt", open="wt")
sink(msg, type="message")
sink(out, type="output")
write("write() to stderr", stderr())
write("write() to stdout", stdout())
 
This works fine, when I want the messages to goto mes.txt and output to
out.xt.
 
My desire is now to get to send both the output and messages( i.e stdout
and stderr) to ONE file.
 
How do I accomplish this?
 
Thanks in Advance,
- Harmeet
 
[[alternative HTML version deleted]]
 
______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

	[[alternative HTML version deleted]]



More information about the R-help mailing list