rsalad icon indicating copy to clipboard operation
rsalad copied to clipboard

add a quiet() function

Open daattali opened this issue 10 years ago • 1 comments

Some functions annoyingly ALWAYS write out some text, for example mixtools::normalmixEM. capture.output can suppress it, but the syntax is different on different OS, so it's hard to use in a package. It's be nice to write something generic. Maybe even make sure that warnings and messages are suppressed as well

Something like this

function(expr) {
  expr <- suppressWarnings(suppressMessages(exp))
  if (Sys.info()['sysname'] == "Windows") {
    capture.output(expr, file = "NUL")  
  } else {
    capture.output(expr, file = "/dev/null")
  }
}

daattali avatar Mar 30 '15 06:03 daattali

from ddpcr

daattali avatar May 01 '16 22:05 daattali