2017-09-05 109 views
1

我正在撰寫我的第一個R包,關於這個話題,Hadley Wickham的優秀book。上面鏈接的這一部分包括通過包的DESCRIPTION文件添加作者的示例。如何強制R將貢獻者(或其他角色)包含在我的包的引用()輸出中?

威克姆博士指出,「full list of roles是非常全面的。如果你的包有一個樵夫(‘WDC’),作詞(‘LYR’)或服裝設計師(‘CST’),舒適地休息,你可以準確地描述他們在創建你的軟件包中的作用。「

我遇到的問題是,只有具有「作者」角色的人才會被包含在citation()的包裝中 - 樵夫,詞組作者和服裝設計師都不是。我希望我的軟件包的非作者貢獻者被列入引文中,但不希望(錯誤地)將他們列爲作者(即具有「作者」角色/ aut)。

例如,如果我包括我的DESCRIPTION文件中的以下(csplisted as 「顧問項目」):

[email protected]: 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/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]爲「Author(s)」下的貢獻者:

Maintainer: John Doe [email protected] 

Other contributors: 

Jane Smith [email protected] (Provided intellectual overview.) [NA] 

看似來解決這個問題,在Hmiscuses the following的作者在他的DESCRIPTION文件:

Author: Frank E Harrell Jr <[email protected]>, with 
    contributions from Charles Dupont and many others. 

我怎麼能力R包含在citation()輸出非作家貢獻者(其他角色)? Hmisc作者的方法在這裏最好嗎?看起來這可能會破壞由[email protected]提供的乾淨的元數據解析,所以我很猶豫使用這種方法。

我將不勝感激任何指針!

+1

在爲期刊文章創建引文時,您只列出作者(幾乎所有引文樣式指南);你不列出確認。爲什麼這與包裝的引用不同?引文應該幫助讀者確定所用代碼的來源。這並不意味着所有貢獻的綜合列表。也許你對「引用」有不同的定義。 – MrFlick

+0

@FrankHarrell,或許你可以闡明一下你的想法? – Aaron

+0

糟糕,他在這篇文章中並沒有活躍,所以@ [不會工作](https://meta.stackexchange.com/questions/43019/how-do-comment-replies-work)。但他在網站上,所以也許他會看到它... – Aaron

回答

1

您不能在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包。

+0

謝謝你的參考!我會接受你的回答,並感謝你的解釋。 –

相關問題