6

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.

mindlessgreen
  • 11,059
  • 16
  • 68
  • 113

2 Answers2

6

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.

Ralf Stubner
  • 26,263
  • 3
  • 40
  • 75
1

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.

alan ocallaghan
  • 3,116
  • 17
  • 37
  • `John Doe [aut, cre]` was not my doing. I assumed it was done by CRAN. But, perhaps it was done by `R CMD build` when I created the tarball. I have removed `Authors@R` altogether. I am hoping just the `Author` and `Maintainer` should work. – mindlessgreen Feb 12 '20 at 13:21
  • My bad, I missed that you had person calls in Authors@R. Why do you need `R CMD check` anyway? Why not just set up continuous integration? – alan ocallaghan Feb 12 '20 at 13:27
  • So the package installs fine locally and from Github. Everything regarding using the package works. Issues are with submission to CRAN. Not sure if CI is relevant for CRAN submission. – mindlessgreen Feb 12 '20 at 13:39
  • Installation from github works fine with Authors@R. Installing locally as well (`devtools::install` or `R CMD build`). CI is a good idea if you expect people to install from github to ensure master always works. – alan ocallaghan Feb 12 '20 at 13:41