简体   繁体   English

R 包在描述中声明作者

[英]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. devtools::check()R CMD checkR CMD build完成。 But, CRAN submission returns this NOTE:但是,CRAN 提交返回此注意:

  * 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.字段 'Author' 和 'Maintainer' 可以从 'Authors@R' 自动生成,如果提供了后者,可以省略。

So, I removed Author and maintainer.所以,我删除了作者和维护者。 Now when I run R CMD check locally:现在,当我在本地运行R CMD check

* 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.我删除了Authors@R并保留了AuthorMaintainer原样。 All local tests passed.所有本地测试均通过。 But, CRAN complaints about this.但是,CRAN 对此有所抱怨。

* 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.您可以使用作者和维护者或作者@R。 In the latter case I would leave out Author and Maintainer, since these are populated by R CMD build .在后一种情况下,我会忽略作者和维护者,因为它们由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 !这让我想到了最重要的一点:永远不要在源目录上运行R CMD check ,而只能在R CMD build创建的tar.gz上运行!

Otherwise you will get strange warnings due to unusual files ( .Rbuildignore is not taken into account), the existence of object files in src , ....否则,由于异常文件(不考虑.Rbuildignore ), src存在目标文件,....

BTW, using devtools::check() is fine from my experience, but it is always good to know what is going on behind the scenes.顺便说一句,根据我的经验,使用devtools::check()很好,但了解幕后发生的事情总是好的。

It seems that R CMD check .似乎R CMD check . does not compile the Authors@R field.不编译Authors@R字段。 Running R CMD build .运行R CMD build . then R CMD check mypkg.tar.gz seems to better reproduce what happens on build systems.然后R CMD check mypkg.tar.gz似乎可以更好地重现构建系统上发生的情况。 I also like using devtools::check() as it rebuilds roxygen documentation before running check.我也喜欢使用devtools::check()因为它在运行检查之前重建 roxygen 文档。

btw I think instead of John Doe [aut, cre] you should use person("John", "Doe", role = c("aut", "cre")) , per the documentation you linked.顺便说一句,根据您链接的文档,我认为您应该使用person("John", "Doe", role = c("aut", "cre"))而不是John Doe [aut, cre]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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