代码之家  ›  专栏  ›  技术社区  ›  J L

如何强制R在我的包的引文()输出中包含贡献者(或其他角色)?

  •  1
  • J L  · 技术社区  · 7 年前

    我目前正在写我的第一个R软件包,在哈德利·威克姆的优秀作品之后 book 关于这个话题。上面链接的这本书的这一部分包括通过软件包的 DESCRIPTION 文件

    威克姆博士指出,“这个 full list of roles 非常全面。如果你的包裹上有樵夫(“wdc”)、作词人(“lyr”)或服装设计师(“cst”),请放心,你可以正确描述他们在创建包裹中的角色。"

    citation() 对于包装而言,樵夫、抒情诗人和服装设计师并非如此。我希望我的文件包中的非作者贡献者被包括在引用中,但不想(错误地)将他们列为作者(即,作为“作者”的角色)/ aut

    例如,如果我在我的 描述 文件( csp listed as

    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 uses the following 描述 文件:

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

    引文() 输出是 作者的方法在这里最好?这似乎可能会打破 Authors@R

    1 回复  |  直到 7 年前
        1
  •  1
  •   Tim    7 年前

    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包示例中所示。