如何引用R语言以及R包:文献引用

2022-12-13 17:23:40 浏览数 (1)

数据分析中经常使用R语言以及相关R包,写文章时就需要引用。这里介绍两种方法。

1. 默认的citeation函数

1.1 引用R语言

包括R版本和相关信息:

注意,函数中什么参数都不添加,会返回R语言的版本和相关信息。

代码语言:javascript复制
citation()
代码语言:javascript复制
> citation()

To cite R in publications use:

  R Core Team (2022). R: A language and environment for statistical
  computing. R Foundation for Statistical Computing, Vienna,
  Austria. URL https://www.R-project.org/.

LaTeX的用户的BibTeX条目是

  @Manual{,
    title = {R: A Language and Environment for Statistical Computing},
    author = {{R Core Team}},
    organization = {R Foundation for Statistical Computing},
    address = {Vienna, Austria},
    year = {2022},
    url = {https://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.

提取相关信息,就是:

❝R Core Team (2022). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. URL https://www.R-project.org/.12c ❞

1.2 引用具体R包

比如,这里想引用ggplot2

代码语言:javascript复制
> citation("ggplot2")

To cite ggplot2 in publications, please use:

  H. Wickham. ggplot2: Elegant Graphics for Data Analysis.
  Springer-Verlag New York, 2016.

LaTeX的用户的BibTeX条目是

  @Book{,
    author = {Hadley Wickham},
    title = {ggplot2: Elegant Graphics for Data Analysis},
    publisher = {Springer-Verlag New York},
    year = {2016},
    isbn = {978-3-319-24277-4},
    url = {https://ggplot2.tidyverse.org},
  }

把里面的内容,提取出来,就是:

❝H. Wickham. ggplot2: Elegant Graphics for Data Analysis. Springer-Verlag New York, 2016. ❞

注意:如果R包没有在引号内,会报错:

代码语言:javascript复制
> citation(ggplot2)
Error in system.file(package = package, lib.loc = lib.loc) : 
  object 'ggplot2' not found

2. 使用pacman更友好的形式

2.1 R语言引用

「两种方法:」

  • p_cite()
  • p_citation()
代码语言:javascript复制
library(pacman)
p_citation()

2.2 R包引用

「四种方法:」

具体的R包,可以直接写名称,也可以用引号包裹:

方法1:p_cite("ggplot2")

方法2:p_cite(ggplot2)

方法3:p_citation(ggplot2)

方法4:p_citation("ggplot2")

p_cite和p_citation都可以用,包的名称加不加引号都可以用,更人性化一点。

代码语言:javascript复制
> p_cite("ggplot2")
To cite ggplot2 in publications, please use:

  H. Wickham. ggplot2: Elegant Graphics for Data Analysis.
  Springer-Verlag New York, 2016.

LaTeX的用户的BibTeX条目是

  @Book{,
    author = {Hadley Wickham},
    title = {ggplot2: Elegant Graphics for Data Analysis},
    publisher = {Springer-Verlag New York},
    year = {2016},
    isbn = {978-3-319-24277-4},
    url = {https://ggplot2.tidyverse.org},
  }

0 人点赞