Should "onLoad.R" be included in the "Collate" field of the DESCRIPTION file?

I need to display a failure message when downloading my package. After reading the posts

Library / Package Development - Download Message
Downloading Various Packages Using .onLoad

Now I have a file zzz.Rcontaining only

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

I have two questions:

  • Do I need to call .onLoadsomewhere? Or does this happen automatically?

  • I use the field Collatein the file DESCRIPTION. Do I need to add zzz.Rto this list?


As a check, I run the following code. A message when starting the package appears when using install, but not when calling library, which I expect.

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

Source: https://habr.com/ru/post/1547537/


All Articles