I have the following request
library(RCurl)
res=getURL("http://www.google.com/search?hl=en&lr=&ie=ISO-8859-1&q=RCurl&btnG=Search",
.opts=list(verbose = TRUE)
)
and would like to capture the verbose output of the call (i.e., what is printed in red in the R console). I thought that the output lines are messages and are therefore printed to stderr()
. The following works for messages
sink(textConnection("test","w"),type="message")
message("test message")
sink(stderr(),type="message")
test
#[1] "test message"
but not if I replace message("test message")
by the RCurl request res=getURL(.....)
as given above.
Obviously, RCurl's output is not printed to stderr()
. It's also not printed to stdout()
.
So, how do I capture the output?
Bonus question: Is sink(stderr(),type="message")
the correct way of setting the connection back to R's default value?
Thank you for your help!
sink()
for output andsink(type = "message")
for stderr. See examples in? sink
. – Kydstderr()
. Thank you! – Ictinus