我需要在加载软件包时显示免责声明消息。看完帖子后
Library/package development - message when loading
Loading depending packages using .onLoad
我现在有一个仅包含
的zzz.R
文件
.onLoad <- function(libname, pkgname){
packageStartupMessage('Regarding data obtained from www.retrosheet.org:\n
The information used here was obtained free of charge from
and is copyrighted by Retrosheet. Interested parties may
contact Retrosheet at "www.retrosheet.org"', domain = NULL, appendLF = TRUE)
}
我有两个问题:
我是否必须在某个地方拨打.onLoad
?或者这是自动发生的吗?
我正在使用Collate
文件中的DESCRIPTION
字段。 zzz.R
是否需要添加到该列表中?
作为检查,我运行以下代码。使用install
时会显示程序包启动消息,但在调用library
时则不会出现此消息。
> library(devtools)
> install()
...
Reloading installed saber
Regarding data obtained from www.retrosheet.org:
The information used here was obtained free of charge from
and is copyrighted by Retrosheet. Interested parties may
contact Retrosheet at "www.retrosheet.org"
...
> detach(package:saber)
> library(saber)
Attaching package: ‘saber’
The following objects are masked _by_ ‘.GlobalEnv’:
getTeamData, relatedBatting