Skip to content
Prev 41405 / 63424 Next

suppressing stderr output from system() calls

On 10/05/2011 02:36 AM, Mark Cowley wrote:
Hi Mark --

For download.file, the argument quiet=TRUE suppresses output messages; 
this option can be used in ... for install.packages, too (according to 
the documentation). This is good enough to quieten the regular chatter 
on a successful operation. To catch errors and suppress warnings also, 
maybe a construct like

url = "http://r-project.org/doesnotexist"
tryCatch(suppressWarnings(
     capture.output(download.file(url, tempfile(), quiet=TRUE))),
     error=function(...) {})

Martin