我目前正在编写我的第一个R包,遵循Hadley关于这个主题的优秀书。书中链接的部分包括通过包的DESCRIPTION文件添加作者的示例。
韦翰博士指出:“角色的完整列表是非常全面的。如果你的包裹里有伐木工('wdc')、抒情诗者('lyr')或服装设计师('cst'),请放心,你可以正确地描述他们在创建包中的角色。”
我正在经历的问题是,只有具有“作者”角色的人才会被包括在citation()的产品中--伐木工人、抒情家和服装设计师。我希望我的包中的非作者贡献者被包括在引文中,但是我不想(错误地)将他们作为作者列出(也就是说,作为“作者”/aut的角色)。
例如,如果我在DESCRIPTION文件中包括以下内容(csp是列成“项目顾问”):
Authors@R: c(
person("John", "Doe", email = "jdoe@example1.com", role = c("aut", "cre")),
person("Jane", "Smith", email = "jsmith@example2.com", role = "csp", comment = "Provided intellectual overview.")).citation('mypackagename')将提供以下信息:
To cite package ‘mypackagename’ in publications use:
John Doe (NA). mypackagename: My package description. R package version 0.1.0.
https://github.com/link/to/mypackagename
A BibTeX entry for LaTeX users is
@Manual{,
title = {mypackagename: My package description},
author = {John Doe},
note = {R package version 0.1.0},
url = {https://github.com/link/to/mypackagename},
}此外,?mypackagename在“Author(S)”项下返回贡献者的[NA]:
Maintainer: John Doe jdoe@example1.com
Other contributors:
Jane Smith jsmith@example2.com (Provided intellectual overview.) [NA]为了解决这个问题,Hmisc package 使用以下内容的作者在他的DESCRIPTION文件中:
Author: Frank E Harrell Jr <f.harrell@vanderbilt.edu>, with
contributions from Charles Dupont and many others.我如何强迫R在citation()输出中包括非作者贡献者(其他角色)?Hmisc作者的方法在这里是最好的吗?这似乎会破坏Authors@R提供的干净的元数据解析,所以我对使用这种方法犹豫不决。
如果你能给我指点,我将不胜感激!
发布于 2017-09-05 21:25:00
不能在citation()输出中包括其他角色。检查citation(),它只解析作者字段,甚至在源代码中有一个注释:
## <NOTE>
## Older versions took persons with no roles as "implied" authors.
## Now we only use persons with a name and a 'aut' role. If there
## are none, we use persons with a name and a 'cre' role.
## If this still gives nothing (which really should not happen), we
## fall back to the plain text Author field.
## Checking will at least note the cases where there are no persons
## with names and 'aut' or 'cre' roles.因此,包含其他角色的唯一方法是使用纯文本描述,如Hmisc包的示例所示。
https://stackoverflow.com/questions/46062908
复制相似问题