我需要在加载包时显示免责声明消息。看完帖子后
\n\n库/包开发 - 加载时的消息
\n使用 .onLoad 加载依赖包
我现在有一个zzz.R文件只包含
.onLoad <- function(libname, pkgname){\n packageStartupMessage(\'Regarding data obtained from www.retrosheet.org:\\n\n The information used here was obtained free of charge from \n and is copyrighted by Retrosheet. Interested parties may\n contact Retrosheet at "www.retrosheet.org"\', domain = NULL, appendLF = TRUE)\n}\nRun Code Online (Sandbox Code Playgroud)\n\n我有两个问题:
\n\n我需要打电话到.onLoad某个地方吗?或者这会自动发生吗?
我正在使用文件Collate中的字段DESCRIPTION。是否zzz.R需要添加到该列表中?
作为检查,我运行以下代码。包启动消息在使用时出现install,但在调用时不会出现library,这是我所期望的。
> library(devtools)\n> install()\n...\nReloading installed saber\nRegarding data obtained from www.retrosheet.org:\n\nThe information used here was obtained free of charge from \nand is copyrighted by Retrosheet. Interested parties may\ncontact Retrosheet at "www.retrosheet.org"\n...\n\n> detach(package:saber)\n> library(saber)\n\nAttaching package: \xe2\x80\x98saber\xe2\x80\x99\n\nThe following objects are masked _by_ \xe2\x80\x98.GlobalEnv\xe2\x80\x99:\n\n getTeamData, relatedBatting\nRun Code Online (Sandbox Code Playgroud)\n