Tal Galili
2010-May-21 21:02 UTC
[R] Getting sink to work with “message” on R 2.11.0 - what did I miss?
Hi all, I am trying to use type message with sink, like this: sink("all.Rout", type="message") 1+3 sink() readLines(con = "all.Rout") So to get the following output:> 1+3[1] 4 Obviously this doesn't work. I tried some variations (based on the explanations in the help) but am missing something on how to make it work. Any suggestions? (p.s: I need this so to help Faiz Rasool in his latest post) Thanks, Tal ----------------Contact Details:------------------------------------------------------- Contact me: Tal.Galili@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) ---------------------------------------------------------------------------------------------- [[alternative HTML version deleted]]
David Winsemius
2010-May-21 21:17 UTC
[R] Getting sink to work with “message” on R 2.11.0 - what did I miss?
On May 21, 2010, at 5:02 PM, Tal Galili wrote:> Hi all, > > I am trying to use type message with sink, like this: > > sink("all.Rout", type="message") > 1+3 > > sink() > > readLines(con = "all.Rout") > > So to get the following output: > >> 1+3 > [1] 4 > > Obviously this doesn't work. >What are you trying to do? The sink help page has two rather dire warnings about not using type="message", and using type="output would give you what you ask: > sink("all.Rout", type="output") > 1+3 > > sink() > > readLines(con = "all.Rout") [1] "[1] 4" The extra "[1]" and quotes are from the readLines function, not from all.Rout.> I tried some variations (based on the explanations in the help) but am > missing something on how to make it work. > > Any suggestions? > > (p.s: I need this so to help Faiz Rasool in his latest post) > > Thanks, > > Tal-- David Winsemius, MD West Hartford, CT
Bert Gunter
2010-May-21 22:49 UTC
[R] Getting sink to work with "message" on R 2.11.0 - what did I miss?
I probably shouldn't be replying, as I believe this may require system specific tricks that I don't know. To that end, you should probably provide the minimum required information (e.g. from sessionInfo() + any other OS/shell info) requested by the posting guide. AFAIK, this can't be done in R. The history mechanism -- ?history -- (details of which are system dependent) records typed commands. sink() records output. The twain don't meet. -- Bert Bert Gunter Genentech Nonclinical Statistics -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Tal Galili Sent: Friday, May 21, 2010 2:02 PM To: r-help at r-project.org Subject: [R] Getting sink to work with "message" on R 2.11.0 - what did I miss? Hi all, I am trying to use type message with sink, like this: sink("all.Rout", type="message") 1+3 sink() readLines(con = "all.Rout") So to get the following output:> 1+3[1] 4 Obviously this doesn't work. I tried some variations (based on the explanations in the help) but am missing something on how to make it work. Any suggestions? (p.s: I need this so to help Faiz Rasool in his latest post) Thanks, Tal ----------------Contact Details:------------------------------------------------------- Contact me: Tal.Galili at gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) ---------------------------------------------------------------------------- ------------------ [[alternative HTML version deleted]] ______________________________________________ R-help at r-project.org mailing list 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.
Apparently Analagous Threads
- Capturing R console output into a file (sink+savehistory ??)
- Two questions, first about contingency tables, and second about table () and data.frame (), from a visually impaired user.
- Reading results of commands in Microsoft Word typed in the terminal window, A question from a Blind R user.
- Problem in performing goodness of fit test in R.
- How to Save the residuals of an LM object greater or less than a certin value to an R object?