简体   繁体   中英

R package declaring author in DESCRIPTION

My DESCRIPTION file looks like this (showing only relevant part).

Author: John Doe
Authors@R: person("John", "Doe", email = "john.doe@email.com",role = c("aut", "cre"))
Maintainer: John Doe <john.doe@email.com>

devtools::check() , R CMD check and R CMD build completes fine. But, CRAN submission returns this NOTE:

  * checking DESCRIPTION meta-information ... NOTE
Author field differs from that derived from Authors@R
Author:    'John Doe'
Authors@R: 'John Doe [aut, cre]'

Not sure what that's about. Anyway, checking documentation , it says:

Fields 'Author' and 'Maintainer' can be auto-generated from 'Authors@R', and may be omitted if the latter is provided.

So, I removed Author and maintainer. Now when I run R CMD check locally:

* checking for file ‘./DESCRIPTION’ ... ERROR
Required fields missing or empty:
  ‘Author’ ‘Maintainer’

What's the best way to do this?

UPDATE

I removed Authors@R and left Author and Maintainer as is. All local tests passed. But, CRAN complaints about this.

* checking CRAN incoming feasibility ... NOTE
Maintainer: 'John Doe <john.doe@email.com>'

But, I don't get this.

UPDATE

This issue has been documented here .

You can either use Author and Maintainer or Authors@R. In the latter case I would leave out Author and Maintainer, since these are populated by R CMD build . This brings me to the most important point: Never run R CMD check on a source directory but only on the tar.gz created by R CMD build !

Otherwise you will get strange warnings due to unusual files ( .Rbuildignore is not taken into account), the existence of object files in src , ....

BTW, using devtools::check() is fine from my experience, but it is always good to know what is going on behind the scenes.

It seems that R CMD check . does not compile the Authors@R field. Running R CMD build . then R CMD check mypkg.tar.gz seems to better reproduce what happens on build systems. I also like using devtools::check() as it rebuilds roxygen documentation before running check.

btw I think instead of John Doe [aut, cre] you should use person("John", "Doe", role = c("aut", "cre")) , per the documentation you linked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM