I am reading a remote NetCDF file using the ncdf4
package. The command looks like this:
library(ncdf4)
url <- "http://iridl.ldeo.columbia.edu/SOURCES/.WORLDCLIM/.AMT/X/%28-165.000000%29VALUE/X2/%288.211400%29VALUE/Y/%2845.000000%29VALUE/Y2/%28-6.032500%29VALUE/dods"
nc <- nc_open(url)
The command runs without error. However, it spits out a bunch of output to the R console as it does so, which no combination of sink
, captureOutput
, etc. is able to capture or suppress. I think the reason is that the error messages are printed directly to stderr
by C code that ncdf4
package calls.
My question is: Is there any way to suppress this output from within an R session? I am open to extremely hacky and/or potentially dangerous solutions.