42

我使用 R 包“stats”(版本 2.15.3)分析了我的数据。一位审阅者问我这个包的正确引用,而不仅仅是常见的

R 核心团队 (2012)。R:统计计算的语言和环境。R 统计计算基金会,奥地利维也纳。ISBN 3-900051-07-0,网址http://www.R-project.org/

有人知道我在哪里可以找到有效的引文插入我的论文吗?谢谢

4

5 回答 5

71

审稿人错了:

 citation("stats")

The ‘stats’ package is part of R.  To cite R in publications use:

  R Core Team (2013). R: A language and environment for statistical computing. R
  Foundation for Statistical Computing, Vienna, Austria. ISBN 3-900051-07-0, URL
  http://www.R-project.org/.

A BibTeX entry for LaTeX users is

  @Manual{,
    title = {R: A Language and Environment for Statistical Computing},
    author = {{R Core Team}},
    organization = {R Foundation for Statistical Computing},
    address = {Vienna, Austria},
    year = {2013},
    note = {{ISBN} 3-900051-07-0},
    url = {http://www.R-project.org/},
  }

We have invested a lot of time and effort in creating R, please cite it when
using it for data analysis. See also ‘citation("pkgname")’ for citing R
packages.
于 2013-03-28T17:52:29.880 回答
17

正如hrbrmstr 所指出的,创建仅加载包的引用列表的函数会派上用场。由于他只向我们展示了一个示例而不是函数,因此我自己编写了一个,我经常在科学分析和论文中使用它(有时与 R Markdown 结合使用)。

citations <- function(includeURL = TRUE, includeRStudio = TRUE) {
    if(includeRStudio == TRUE) {
        ref.rstudio <- RStudio.Version()$citation
        if(includeURL == FALSE) {
            ref.rstudio$url <- NULL;
        }
        print(ref.rstudio, style = 'text')
        cat('\n')
    }

    cit.list <- c('base', names(sessionInfo()$otherPkgs))
    for(i in 1:length(cit.list)) {
        ref <- citation(cit.list[i])
        if(includeURL == FALSE) {
            ref$url <- NULL;
        }
        print(ref, style = 'text')
        cat('\n')
    }
}

因此,例如,在运行之后

library(readr)
library(dplyr)
library(ggplot2)
library(knitr)

该功能 citations() 将打印:

RStudio 团队 (2016)。RStudio:R 的集成开发环境。RStudio, Inc.,马萨诸塞州波士顿。 http://www.rstudio.com

R 核心团队(2017 年)。R:统计计算的语言和环境。R 统计计算基金会,奥地利维也纳。https://www.R-project.org

谢毅(2016)。knitr:R 中用于动态报告生成的通用包。R 包版本 1.15.1,http: //yihui.name/knitr

谢毅(2015)。带有 R 和 knitr 的动态文档,第 2 版。佛罗里达州博卡拉顿的查普曼和霍尔/CRC。ISBN 978-1498716963,http: //yihui.name/knitr

谢毅(2014)。“knitr:R 中可重复研究的综合工具。” 在 Stodden V、Leisch F 和 Peng RD (eds.),实施可重复计算研究。查普曼和霍尔/CRC。ISBN 978-1466561595, http: //www.crcpress.com/product/isbn/9781466561595 。

威克姆 H (2009)。ggplot2:用于数据分析的优雅图形。施普林格出版社纽约。ISBN 978-0-387-98140-6,http ://ggplot2.org 。

威克姆 H 和弗朗索瓦 R (2016)。dplyr:数据操作语法。R 包版本 0.5.0,https: //CRAN.R-project.org/package=dplyr 。

威克姆 H、海丝特 J 和弗朗索瓦 R(2016 年)。readr:读取表格数据。R 包版本 1.0.0,https://CRAN.R-project.org/package=readr

于 2017-05-10T09:06:19.963 回答
13

在我们最近的一本书中,我和我的合著者做了 R 引用(在 frontmatter 中),但也让出版商让我们也给每个包的信用:

在此处输入图像描述

我们认为重要的是要确保那些从事这项工作的人一直得到赞誉。

(我只做了一个评论,但不能轻易地以这种方式嵌入 pix 并且 rly 不想在某处托管 img。)

于 2014-05-07T20:44:09.253 回答
8

现在有一个grateful可以派上用场的包:

感恩的目标是让引用任何报告或出版物中使用的 R 包变得非常容易。通过调用单个函数,它将扫描项目中使用的 R 包,并以所需的输出格式(Word、PDF、HTML、Markdown)生成带有引用的文档。重要的是,这些参考文献可以针对特定期刊进行格式化,以便我们可以将它们直接粘贴到我们的手稿或报告的参考书目列表中。

https://github.com/Pakillo/grateful

如果stats加载了包,可以通过运行获取引用:

library(grateful)
cite_packages()

—假设grateful已经通过运行安装:

library(devtools)
install_github("Pakillo/grateful")
于 2017-10-17T02:52:10.293 回答
0

我喜欢MS Berends的解决方案,但想要一个带有类似这个答案的版本号的表格。我还想摆脱由产生的降价,format(citation(pkg), style = 'text')这样我就可以轻松地复制粘贴到 MS Word 中。

require(pacman)
require(gt)
require(stringr)
require(dplyr)
get_package_citation_table <- function(){
  appendix_packages <- data.frame(Package = character(),
                                  Version = character(),
                                  Maintainer = character(),
                                  Citation = character())
  
  for (pkg in p_loaded()){
    appendix_packages <- appendix_packages %>% add_row(
      Package = pkg,
      Version = as.character(packageVersion(pkg)),
      Maintainer = maintainer(pkg),
      Citation = format(citation(pkg), style = 'text')
    )
  }
  appendix_packages <- appendix_packages %>% 
    add_row(
      Package = "RStudio",
      Version = as.character(RStudio.Version()$version),
      Maintainer = "",
      Citation = format(RStudio.Version()$citation, style = "text") 
    ) %>%
    add_row(
      Package = "R",
      Version = paste(version$major,version$minor, sep="."),
      Maintainer = "",
      Citation = format(citation(), style = "text")
    )
  
  appendix_packages %>%
    mutate( Citation = Citation %>% # strip out the markdown
              str_replace_all("_","") %>%
              str_replace_all("[*]", "") %>%
              str_replace_all("<URL:", "") %>%
              str_replace_all(">","")) %>% 
    arrange(Package)
  
}

t<- get_package_citation_table() 
t %>% gt()
于 2021-03-25T23:50:36.017 回答