Silencing a package load message in Sweave

knitr, r, sweave

Solution

Try loading the package in a hide results chunk:

<<packages,results=hide>>= 
require(optmatch) 
@

If you use the `knitr` package, you need to quote `hide`:

<<packages,results='hide'>>= 
require(optmatch) 
@

Problem

I'm loading `optmatch` in a Sweave document as follows: ``` <<myCodeBlock, echo=FALSE>>= library(optmatch, quietly=TRUE) @ You're loading optmatch, by Ben Hansen, a package for flexible and optimal matching. Important license information: The optmatch package makes essential use of D. P. Bertsekas and P. Tseng's RELAX-IV algorithm and code, as well as Bertsekas' AUCTION algorithm and code. Bertsekas and Tseng freely permit their software to be used for research purposes, but non-research uses, including the use of it to 'satisfy in any part commercial delivery requirements to government or industry,' require a special agreement with them. By extension, this requirement applies to any use of the fullmatch() function. (If you are using another package that has loaded optmatch, then you will probably be using fullmatch indirectly.) For more information, enter relaxinfo() at the command line ``` As you can see, I've tried every way I can think of to silence the package load message, to no avail. I assume this is because they just used a straight-up `cat()` or something like that, but it's mighty annoying. Any thoughts on how to silence this so that those reading my final, beautiful, `LaTeX`ified PDF don't have to read about RELAX-IV? Other things that don't seem to work (take from Andrie's pointer to a related thread): ``` suppressMessages(library(optmatch)) suppressPackageStartupMessages(require("optmatch")) ``` I should note this is pretty obviously an R problem not a Sweave problem, as the messages pop up in R also.

Original source

Related problems