losing stdout in R console on Mac OS X
-
19-09-2019 - |
Question
I'm working on a big Sweave document/script on a Mac OS X system, R version 2.9.2. Under some circumstances, it appears as if Sweave is redirecting stdout, so that x <- 1; print(x)
gives nothing at all. (The console is still running, as plot(x)
pops up a plot as normal.) So, two questions:
- How do I force stdout to go back to the console, and,
- Why does Sweave do this, and how?
Solution
Found it, with extensive use of RSeek. The sink()
function redirects the console to a file. sink(NULL)
cancels the redirection. Still not entirely sure why Sweave sets up a sink. I suspect that bugs in my code were causing Sweave to abort without canceling the sink.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow