Written and maintained by CASRAI Editorial Board
Published · Last updated
On this page
To reference R in a paper, run citation() in your own R session and cite what it prints: it gives the current R Core Team reference for the exact version you used. For any package you loaded, run citation("packagename"). For a BibTeX entry, wrap either call in toBibtex().
R’s own documentation asks for this directly: “Please give credit where credit is due and cite R and R packages when you use them for data analysis” (R documentation for citation, checked 2026-10-29). The sections below cover the three calls that matter and why you should generate the reference rather than copy one from an old paper.
Ask CASRAI · free to tryQuestion about this guide? Ask CASRAI answers with linked sources. 2 free questions a day, no account.
What it is used for in research
Methods sections that report an analysis run in R should name R and the packages that did the work, so readers can identify the software and reproduce the result. R has a built-in function for this, citation(), so the reference comes from the software itself instead of from memory or from another author’s bibliography. Related practice for software more generally is described in the software citation working group entry.
Install or access (official source only)
You need R installed to generate the citation for the version you used. R is distributed from CRAN, the Comprehensive R Archive Network, at cran.r-project.org. The reference function citation() is part of the utils package that ships with R, so nothing extra has to be installed or loaded.
Step-by-step: reference R and its packages
- Cite base R. Open the R session (or the same R installation) that ran your analysis and call
citation()with no arguments. With no package named, it returns the reference for R itself. - Get BibTeX if you write in LaTeX or use a reference manager. Store the result and convert it:
x <- citation()followed bytoBibtex(x). The documentation shows exactly this pattern as its example. - Cite each package that shaped your results. Pass the package name as a string:
citation("lattice"). Repeat for each package you want to credit, for example the modelling or plotting package your figures and estimates depend on. - Force a generated reference if you need one.
citation("lattice", auto = TRUE)builds a Manual-type reference from the package’s DESCRIPTION metadata instead of using the author-written one. - Paste the output into your reference list or import the BibTeX into your manager. See the guide on getting citations from Zotero for the import side.
Take the year and version from your own install
The R FAQ (question 2.8, “Citing R”, cran.r-project.org/doc/FAQ/R-FAQ.html, checked 2026-10-29) gives a BibTeX template with the title, the author R Core Team, the organization R Foundation for Statistical Computing, address Vienna, Austria, a DOI of 10.32614/R.manuals and the URL https://www.R-project.org. Its year field is left as YEAR: “where YEAR is the release year of the version of R used and can determined as R.version$year.” In practice this means two things:
- Run
citation()rather than copying a reference from a published paper. The year belongs to the R version you ran, and the FAQ says the same output can be obtained fromcitation(). - Check
R.version$yearin the session if you fill in a template by hand.
The current FAQ template uses R Core Team as the author and a DOI, so prefer what your installed R prints today over a reference copied from elsewhere.
Output and how to read it
citation() prints a human-readable reference you can use as a text citation. toBibtex() turns the same object into BibTeX fields. For packages, where the text comes from depends on the package:
- If the package ships a CITATION file (kept in the package’s
instsubdirectory),citation("pkg")returns what the authors wrote there, which may include a paper they ask users to cite. - If there is no CITATION file, R generates the reference from the package’s DESCRIPTION.
That is why two packages can print references in different shapes. Both are the package authors’ preferred form, so cite what is printed rather than reformatting it into a pattern you remember.
Troubleshooting
Only the text version prints
The documentation says the BibTeX display is governed by options("citation.bibtex.max"). If a reference does not show a BibTeX version, call toBibtex() on the stored object, as in step 2, instead of relying on the default print.
The package reference looks generic
That usually means the package has no CITATION file, so R built the reference from DESCRIPTION. This is expected behaviour; use it as printed or read the package’s own documentation for any paper its authors ask you to cite.
The year looks wrong
The year should match the release year of the R version you used, which you can read from R.version$year. If it does not match, generate the reference again with citation() in the session you used.
Free ways to get an R reference
| Method | What you get | Source |
|---|---|---|
citation() |
Reference for R itself, generated for the installed version | R documentation for citation |
toBibtex(citation()) |
The same reference as BibTeX fields | R documentation for citation |
citation("pkg") |
The package’s reference, from its CITATION file or its DESCRIPTION | R documentation for citation |
citation("pkg", auto = TRUE) |
A Manual-type reference generated from package metadata | R documentation for citation |
| BibTeX template in the R FAQ | A BibTeX entry with the year left for you to fill in from R.version$year |
R FAQ 2.8 |
If you manage references in a tool, the Zotero and JabRef comparison for LaTeX writing covers the BibTeX side. If you are still choosing between statistical packages, see R vs SAS, and if you are learning the language, the guide to commenting code in R is a short next read.
FAQ
How do I reference R in a paper?
Run citation() in R and use the reference it returns, which is the R Core Team reference for your installed version. Add toBibtex(citation()) if you need BibTeX.
How do I cite an R package?
Run citation("packagename") and use the output. R uses the package’s CITATION file when there is one and builds the reference from DESCRIPTION when there is not.
Do I need to cite R if I only used it for a few calculations?
R’s documentation asks users to cite R and R packages when they use them for data analysis. Check your journal’s or funder’s instructions for anything stricter.
Can I copy the R reference from another paper?
It is better not to. The year is tied to the R version used. Generate your own with citation().
Sources (official docs)
- R documentation:
citation(utils package), checked 2026-10-29. - R FAQ, question 2.8 “Citing R”, CRAN, checked 2026-10-29.







