如何强制R在包的citation()输出中包括贡献者(或其他角色)? [英] How can I force R to include contributors (or other roles) in my package's citation() output?

查看:262
本文介绍了如何强制R在包的citation()输出中包括贡献者(或其他角色)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hadley Wickham出色的完整的角色列表非常全面.如果您的包裹有have夫(wdc),作词人(lyr)或服装设计师(cst),请放心,您可以正确地描述他们在创建包裹中的作用."

我遇到的问题是,包装的citation()输出中仅包含具有作者"角色的人员-wood夫,抒情诗人和服装设计师没有.我希望我的软件包中的非作者贡献者被包括在引用中,但不想(不正确地)将他们列为作者(即,扮演作者"/aut的角色). /p>

例如,如果我在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在作者"下为贡献者返回[NA]:

Maintainer: John Doe jdoe@example1.com

Other contributors:

Jane Smith jsmith@example2.com (Provided intellectual overview.) [NA]

似乎是为了解决这个问题,Hmisc包的作者解决方案

您不能在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软件包示例中那样使用纯文本描述.

I'm currently writing my first R package, following Hadley Wickham's excellent book on the topic. The section of the book linked above includes examples for adding authors through the package's DESCRIPTION file.

Dr. Wickham notes that "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."

The problem that I'm experiencing is that only people with the 'author' role are included in the output of citation() for the package -- woodcutters, lyricists, and costume designers are not. I'd like for non-author contributors to my package to be included in the citation, but don't want to (incorrectly) list them as authors (i.e., as having the role of "author" / aut).

For example, if I include the following in my DESCRIPTION file (csp is 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') will give the following:

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},
  }

In addition, ?mypackagename returns [NA] for the contributor under "Author(s)":

Maintainer: John Doe jdoe@example1.com

Other contributors:

Jane Smith jsmith@example2.com (Provided intellectual overview.) [NA]

Seemingly to get around this, the author of the Hmisc package uses the following in his DESCRIPTION file:

Author: Frank E Harrell Jr <f.harrell@vanderbilt.edu>, with
  contributions from Charles Dupont and many others.

How can I force R to include non-author contributors (of other roles) in the citation() output? Is the Hmisc author's approach best here? It seems like that could break the clean metadata parsing provided by Authors@R, so I'm hesitant to use that approach.

I would be grateful for any pointers!

解决方案

You can't include other roles in citation() output. Check the source of citation(), it parses only the author fields, there is even a note in the source code on it:

    ## <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.

So the only way for you to include other roles is to use plain text description as in the example of Hmisc package.

这篇关于如何强制R在包的citation()输出中包括贡献者(或其他角色)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆