I have tried expressions with suppressMessages(expr), suppressWarnings(expr), but they keep outputting messages.
eg:
suppressWarnings(ksvm(y~., data=data, type='C-svc', cross=5, kernel=kernel))
keeps generating this message.
Setting default kernel parameters
How do I suppress messages from libraries? Is there a way to do this globally?
Have tried:
{r messages=FALSE, warnings=FALSE}
Here is the link to the line where the output is generated: https://github.com/cran/kernlab/blob/master/R/ksvm.R#L88
Looking at that we see that the message is displayed with cat()
not with message()
. suppressMessages()
does not suppress the cat output.
There are multiple ways to get rid of the cat
output. One is to capture the message and then hide it like so:
invisible(capture.output(ksvm(...)))