gpt4 book ai didi

r - 在 Sweave 中静音包加载消息

转载 作者:行者123 更新时间:2023-12-04 11:31:12 25 4
gpt4 key购买 nike

我正在加载 optmatch在 Sweave 文档中,如下所示:

<<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

正如您所看到的,我已经尝试了我能想到的所有方法来使包加载消息静音,但无济于事。我认为这是因为他们只是直接使用了 cat()或类似的东西,但它非常烦人。关于如何让这一切保持沉默的任何想法,以便那些阅读我最后的,美丽的, LaTeX化 PDF 不必阅读有关 RELAX-IV 的信息?

其他似乎不起作用的事情(取自 Andrie 指向 related thread 的指针):
suppressMessages(library(optmatch))
suppressPackageStartupMessages(require("optmatch"))

我应该注意到这显然是一个 R 问题而不是 Sweave 问题,因为消息也会在 R 中弹出。

最佳答案

尝试在隐藏结果块中加载包:

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

如果您使用 knitr包,您需要 quote hide :
<<packages,results='hide'>>= 
require(optmatch)
@

关于r - 在 Sweave 中静音包加载消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8143332/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com