应该" onLoad.R"包含在描述文件"整理"领域?

时间:2014-07-08 06:53:28

标签: r

我需要在加载软件包时显示免责声明消息。看完帖子后

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

我有两个问题:

  1. 我是否必须在某个地方拨打.onLoad?或者这是自动发生的吗?

  2. 我正在使用Collate文件中的DESCRIPTION字段。 zzz.R是否需要添加到该列表中?


  3. 作为检查,我运行以下代码。使用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
    

0 个答案:

没有答案