9

In a thesis, when referring to an R package (a statistical software), how should I write it?

Should it be italicized/treated like a title?

Or just like any other word. The package name is not a "normal word" so it seems out of place to just write it like

"...using the R package XYZ."

4
  • 1
    Why not using the convention employed in the R documentation (package names are typeset with a bold font)? Jan 1, 2018 at 21:52
  • 1
    Also remember to include what version of R and package you used.
    – Bluebird
    Jan 1, 2018 at 22:00
  • You may be overthinking this. I think the text version is okay. You may or may not emphasise the package name but the reader will get that it is a R package from the sentence, so the rest is a question how you like it better yourself.
    – allo
    Feb 2, 2018 at 9:39
  • 1
    As far as I've seen there isn't an agreed-upon convention here, but people often distinguish package names with a different font than the regular text. A monospace typeface (e.g. \texttt{ggplot2} in LaTeX) or bold font is common choice.
    – postylem
    Oct 31, 2023 at 12:51

2 Answers 2

2

In LaTeX, you can do this by adding the following to your preamble. Something like this:

\newcommand{\pkg}[1]{{\normalfont\fontseries{b}\selectfont #1}}
\let\proglang=\textsf \let\code=\texttt

\begin{document}

Then you can refer to R as \proglang{R}, to a package
\pkg{packagename}, and to a function as \code{functionname}.

\end{document}
7
  • 1
    The OP didn't mention they were working in LATEX. Feb 8, 2021 at 1:49
  • @AzorAhai-him- That is correct! I just assumed OP is writing a thesis and using R; therefore, in the science field, where most of the thesis is written in Latex!
    – Smith Pay
    Feb 8, 2021 at 4:41
  • Biologists still write papers by emailing each other word documents. The really clever ones might be on Google docs now.
    – user133933
    Feb 8, 2021 at 4:52
  • @AhmadTalafha I don't think you can say most of the sciences use LaTeX - most of math, maybe. Feb 8, 2021 at 6:23
  • @AzorAhai-him- While it is true, check out this post tex.stackexchange.com/questions/940/…
    – Smith Pay
    Feb 8, 2021 at 13:38
1

In R, use the citation function and inside the function use the argument package and then put the name of the package you wish to cite in quotations. Below is an example of the code.

citation(package = "NAME OF PACKAGE HERE")

You can copy the output to place in your document in the references.

For in-text citations, you can follow APA recommendations for citing software. Below is an example

  • The Foo package was used in the analysis (Version number; Author last name, year).
1
  • 3
    The question isn't about how to cite the package, it's about how to format the name of the package when referring to it in text. e.g.: "We use the foo package to parse the data and..."
    – ff524
    Jan 2, 2018 at 1:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .