我如何强制 R 在我的包的 citation() 输出中包含贡献者(或其他角色)?
How can I force R to include contributors (or other roles) in my package's citation() output?
我目前正在编写我的第一个 R 程序包,遵循 Hadley Wickham 关于该主题的出色 book。上面链接的书籍部分包括通过包的 DESCRIPTION
文件添加作者的示例。
博士。威克姆注意到 "The full list of roles is extremely comprehensive. Should your package have a woodcutter ('wdc'), lyricist ('lyr') or costume designer ('cst'), rest comfortably that you can correctly describe their role in creating your package."
我遇到的问题是只有具有 'author' 角色的人才会包含在包的 citation()
输出中——伐木工、作词家和服装设计师不包含。我希望我的包的非作者贡献者包含在引文中,但不想(错误地)将他们列为作者(即具有 "author" / [=16= 的角色) ]).
例如,如果我在 DESCRIPTION
文件中包含以下内容(csp
是 listed as "Consultant to a project"):
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
returns [NA]
"Author(s)"下的贡献者:
Maintainer: John Doe jdoe@example1.com
Other contributors:
Jane Smith jsmith@example2.com (Provided intellectual overview.) [NA]
为了解决这个问题,Hmisc
包 uses the following 的作者在他的 DESCRIPTION
文件中:
Author: Frank E Harrell Jr <f.harrell@vanderbilt.edu>, with
contributions from Charles Dupont and many others.
如何强制 R 在 citation()
输出中包含非作者贡献者(其他角色)? Hmisc
作者的方法在这里最好吗?似乎这可能会破坏 Authors@R
提供的干净的元数据解析,所以我对使用这种方法犹豫不决。
如有指点,我将不胜感激!
您不能在 citation()
输出中包含其他角色。检查the source of 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 包的示例。
我目前正在编写我的第一个 R 程序包,遵循 Hadley Wickham 关于该主题的出色 book。上面链接的书籍部分包括通过包的 DESCRIPTION
文件添加作者的示例。
博士。威克姆注意到 "The full list of roles is extremely comprehensive. Should your package have a woodcutter ('wdc'), lyricist ('lyr') or costume designer ('cst'), rest comfortably that you can correctly describe their role in creating your package."
我遇到的问题是只有具有 'author' 角色的人才会包含在包的 citation()
输出中——伐木工、作词家和服装设计师不包含。我希望我的包的非作者贡献者包含在引文中,但不想(错误地)将他们列为作者(即具有 "author" / [=16= 的角色) ]).
例如,如果我在 DESCRIPTION
文件中包含以下内容(csp
是 listed as "Consultant to a project"):
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
returns [NA]
"Author(s)"下的贡献者:
Maintainer: John Doe jdoe@example1.com
Other contributors:
Jane Smith jsmith@example2.com (Provided intellectual overview.) [NA]
为了解决这个问题,Hmisc
包 uses the following 的作者在他的 DESCRIPTION
文件中:
Author: Frank E Harrell Jr <f.harrell@vanderbilt.edu>, with
contributions from Charles Dupont and many others.
如何强制 R 在 citation()
输出中包含非作者贡献者(其他角色)? Hmisc
作者的方法在这里最好吗?似乎这可能会破坏 Authors@R
提供的干净的元数据解析,所以我对使用这种方法犹豫不决。
如有指点,我将不胜感激!
您不能在 citation()
输出中包含其他角色。检查the source of 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 包的示例。