开发者

How to avoid printing a package's author message? [duplicate]

开发者 https://www.devze.com 2023-03-14 11:28 出处:网络
This question already has answers here: 开发者_开发知识库Closed 11 years ago. Possible Duplicate:
This question already has answers here: 开发者_开发知识库 Closed 11 years ago.

Possible Duplicate:

Library/package development - message when loading

I want to set up a web interface using Rapache; however, the underlying R code uses packages that display a quick message from the author. E.g., for data.table,

Quick start guide : vignette("datatable-intro") Homepage : http://datatable.r-forge.r-project.org/

Is there a way to avoid this? I tried suppressMessages(), and the quietly option to library(), but to no avail.

Thanks


For data.table, this was done in commit 233 (2011.06.11 01:04:27) :

"onAttach now uses packageStartupMessage so the banner can be suppressed by those annoyed by banners, whilst still being helpful to new users"

This is in v1.6.1 available from R-Forge, and may be released to CRAN soon.

I'll add a note to NEWS ...


The brute force way of suppressing all output and messages for chatty packages is to use sink:

t <- tempfile()
tcon <- file(t,open="w+")
sink(file=tcon,type='output')
sink(file=tcon,type='message')
require(YOURLIBRARY)
sink(NULL,type='output')
sink(NULL,type='message')
unlink(t)

TAKE THAT YOU CHATTY PACKAGE!

0

精彩评论

暂无评论...
验证码 换一张
取 消