Skip to content
Prev 41415 / 63421 Next

suppressing stderr output from system() calls

Thanks Martin, Simon and Brian,
They're all good suggestions for code that I write, however how can I suppress stderr from pre-existing code. For instance, install.packages has 3 system calls.
Perhaps a better worded question would be: how can I redirect the output of this command:

install.packages("MASS", lib="/tmp", type="source")

As I mentioned before, sink doesn't do the trick
con <- file("stderr.txt", "w")
sink(con, type="message")
install.packages("MASS", lib="/tmp", type="source")
sink(NULL, type="message")
close(con)

Martin will be familiar with the Bioconductor package oligo, which likes to download pd info package on the fly and install them - the embedded call to download.file is noisy, as is the resulting installation of said package.

Short of rewriting install.package & all code which has embedded install.packages calls, are there any other ways?

@Brian, thanks for the pointer to the news article on connections - I did learn something there
cheers,

Mark
On 06/10/2011, at 3:59 AM, Martin Morgan wrote: