在 DESCRIPTION 中声明作者的 R 包

R package declaring author in DESCRIPTION

我的 DESCRIPTION 文件如下所示(仅显示相关部分)。

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 checkR CMD build 完成得很好。但是,CRAN 提交 returns 这个注意:

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

不知道那是什么。无论如何,检查 documentation,它说:

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

所以,我删除了作者和维护者。现在当我 运行 R CMD check 在本地时:

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

最好的方法是什么?

更新

我删除了 Authors@R 并保留了 AuthorMaintainer。所有本地测试都通过了。但是,CRAN 对此表示不满。

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

但是,我不明白。

更新

此问题已记录在案 here

似乎R CMD check . 没有编译Authors@R 字段。 运行 R CMD build . 然后 R CMD check mypkg.tar.gz 似乎可以更好地重现构建系统上发生的情况。我也喜欢使用 devtools::check(),因为它会在 运行 检查之前重建 roxygen 文档。

顺便说一句,根据您链接的文档,我认为您应该使用 person("John", "Doe", role = c("aut", "cre")) 而不是 John Doe [aut, cre]

您可以使用 Author and Maintainer 或 Authors@R。在后一种情况下,我会省略 Author 和 Maintainer,因为它们由 R CMD build 填充。这让我想到了最重要的一点:永远不要在源目录上 运行 R CMD check,而只能在 R CMD build!

创建的 tar.gz

否则你会因为不寻常的文件(.Rbuildignore没有考虑在内),src中存在目标文件,....

而得到奇怪的警告

顺便说一句,根据我的经验,使用 devtools::check() 很好,但了解幕后发生的事情总是好的。