我遇到的问题是,包装的citation()输出中仅包含具有作者"角色的人员-wood夫,抒情诗人和服装设计师没有.我希望我的软件包中的非作者贡献者被包括在引用中,但不想(不正确地)将他们列为作者(即,扮演作者"/aut的角色). /p>例如,如果我在DESCRIPTION文件中包含以下内容(csp为列为项目顾问"):Authors@R: c( person("John", "Doe", email = "[email protected]", role = c("aut", "cre")), person("Jane", "Smith", email = "[email protected]", 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/mypackagenameA 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 [email protected] contributors:Jane Smith [email protected] (Provided intellectual overview.) [NA]似乎是为了解决这个问题,Hmisc包的作者在其DESCRIPTION文件中使用以下:Author: Frank E Harrell Jr <[email protected]>, with contributions from Charles Dupont and many others.如何强制R在citation()输出中包括非作者(其他角色)? Hmisc作者的方法在这里最好吗?看来这可能会破坏Authors@R提供的干净的元数据解析,因此我不愿意使用该方法.任何指针,我将不胜感激!解决方案您不能在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 = "[email protected]", role = c("aut", "cre")), person("Jane", "Smith", email = "[email protected]", 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/mypackagenameA 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 [email protected] contributors:Jane Smith [email protected] (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 <[email protected]>, 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()输出中包括贡献者(或其他角色)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-06 05:39