Suppress Messages from zip in R -
i want suppress messages outputted zip
command in r
fail find right command so.
background, use zip-function within function, don't want user see information files (roughly 5.000, clutters console).
here have tried far, functions foo
show either adding: hw.txt (stored 0%)
or updating: hw.txt (stored 0%)
# create small file writelines("hello world", "hw.txt") # use original command zip("zip.zip", "hw.txt") # try different options of capturing/suppressing output! # assignment foo1 <- function() <- zip("zip.zip", "hw.txt") foo1() # capture.output foo2 <- function() <- capture.output(zip("zip.zip", "hw.txt")) foo2() # suppressmessages foo3 <- function() suppressmessages(zip("zip.zip", "hw.txt")) foo3() # invisible foo4 <- function() invisible(zip("zip.zip", "hw.txt")) foo4() # sink foo5 <- function() { sink(tempfile()) zip("zip.zip", "hw.txt") sink() } foo5()
are there other options suppress output of zip
?
the answer depend on system code used on. on windows system, can use
zip("zip.zip", "hw.txt", flags="-q")
and suppresses messages, depends on system uses handle zip files. since message coming zip program, must signal not output messages.
Comments
Post a Comment