49

Intro: R is a open-source software tool for statistical analyses and graphics, which is heavily used in different science disciplines and which is becoming more and more popular (although it is already quite popular in many areas). In addition to the base version, people from all over the place develop so-called packages, upload them, for example, to CRAN, where they can be freely downloaded to use.

Q: I am writing a manuscript for a peer-reviewed psychology journal and used a lot of R packages in my work. Of course, I want to and will cite R itself and the packages that I relied on heavily (e.g., to simulate or analyze data). However, I have also some packages, of which I used only a single, little function. For example, I used the odd function from the gtools package to determine whether an integer is odd or even. As far as I can see, the function is only a single line long, and I could have written it myself (but I didn't!). On the one hand, I want to give credit to these developers, on the other hand I don't want to blow up my reference list and confuse readers. So the question is, should I cite every single R package I used?

BTW: Note that R has the nice function citation("some package") to access citation information provided by the package authors; see also citation() to cite R itself.

| improve this question | | | | |
  • 8
    Here is kind of a similar question: tex.stackexchange.com/questions/156189/…. I think the bottom line is that you should cite all packages that affected your results (for reproducibility), but you do not need to cite the ones you used for plotting, table making, etc. Acknowledgments are the correct place for that kind of packages. – Mikko Aug 28 '14 at 12:52
  • 12
    toLatex(sessionInfo()) gives you all you need for people to be able to replicate your environment. – James Aug 28 '14 at 12:59
  • 4
    more important than citing is sharing the data and code. – phonixor Aug 28 '14 at 14:52
  • 4
    Citing R and its packages (in the light of the answers below) would support the development of such great, yet free of charge, open source tools. – Orion Feb 14 '15 at 18:11
27

Overall, I would suggest you err on the side of rather citing too many packages (with version numbers, please!), although odd quite probably is a borderline case. I'd rationalize this tendency as a bit of balance for all the people who use packages extensively but do not cite them.

In general, I would certainly cite anything that saved me a non-trivial amount of own work (as in, "I could have done this myself, but it would likely have cost me half a day").

The length of your literature list should not really be a concern in the days of PDF publishing. And "we used R [3], packages foo [4] and bar [5] as well as multiple helper functions [6-10]" should not be too confusing to your readers.


This would possibly be more appropriate for Academia.SE.com. Perhaps you want to edit your question (explaining what R is, so the question is understandable outside the tag at SO) and flag it for migration.

| improve this answer | | | | |
  • +1. I also thought about Academia.SE but wanted the opinion of the R guys. If there is a consensus that this is the more appropriate site, I'd agree to flag it for migration. – hplieninger Aug 28 '14 at 15:55
  • 2
    You should cite everything you use. Maybe many won't do it because they just use too many packages. This shouldn't hinder you from citing. So here's how to cite multiple packages at once: blogs.ethz.ch/mylifesciencejourney/2017/07/14/… – walls Jul 14 '17 at 12:12
  • Unfortunately, there is a practical limit to this strategy in some cases: at least in my case, there are still a lot of page limits around, which severely limit the number of references one wants to give in an article... – jhin May 9 at 13:58
29

YES.

There are lots of reasons to and no reasons not to (unless you're under some kind of strange space/ink constraint).

Here is an important and underappreciated reason why:

Most of the people who make the kind's of R packages, in fact the people who made R itself, are other academics. Meaning: They didn't get paid specifically for the time they spent making lme4, ggplot2, stargazer etc. Software development is very unappreciated in academia. Imagine spending a lot of time writing and maintaining a package that is used by thousands of people in your field and then being asked by a tenure/promotion committee why you didn't write more papers or do more experiments. It's very difficult to get someone who isn't a user (or even a software-minded person) to properly appreciate the time and skill involved in making good software.

The only way to convince university systems and leaders that the work you spent writing that software is to show them in a way they understand, that means citations. They're not going to care about your StackExchange reputation or how much juice you've got on github, they need something Scopus can compute and they can itemize and count.

Much of the workings of academia is based on beans. Much of the effort at universities is dedicated to counting and managing those beans. How many students are in your program, how many grants are awarded, how many Ph.D. defend, and how many papers are published and cited are all very important beans which decide who gets resources. It would be sad indeed if someone who wrote a useful R package didn't get the credit they're due and thus be allowed to make more wonderful tools. Imagine if Hadley hadn't started working for R-Studio, he might be standing in front of some committee someday asking him why he spent so much time writing "software" instead of "papers," or trying to explain why he can't take on a third course this semester because the dept chair doesn't understand that writing software is something that actually takes real time.

Also consider this: Most scientific papers are cited fewer than 10x, if ever. A reasonably useful R package is likely to impact many more people than any "real" publication, but that person get's no credit if you don't cite it.

| improve this answer | | | | |
  • 1
    I very much agree with the importance of citation to generate measurable numbers for science administration. I develop packages and yes, it is important to be able to justify the effort - the more so if your institute is still rather reluctant about open source (not to speak of open data...). In my field pointing out how many people cite the package is an important and easy to gather number. This is IMHO even more important for small niche packages than, say, for ggplot2. (Nevertheless I also cite the packages I use "only" for graphical display etc). – cbeleites unhappy with SX Apr 6 '16 at 9:29
11

Absolutely! Citations are free, and they are a blessing to the creators of those packages. Unless you're held to a strict page limit, there's no reason not to have a "methods" section in which you list all of the packages you used. It can be a single sentence. If you want to give pride of place to a few key packages that your work relied on, then give them a sentence each, but don't snub the others. Some day, you'll be happy when others cite your work.

| improve this answer | | | | |
7

There's no definite answer to this, but here's what I do.

  1. I cite R itself and the packages I need to perform the actual analysis I report in my paper. I do not cite packages I consider to provide various tools (graphic tools, mathematical tools, etc.). The line between these can be difficult to draw sometimes, of course.
  2. Always, always make your data and your code publicly available. You need to make sure that other people can replicate your result. Other people can also see there what packages you have used.

Nit-picking: There's no question in the paragraph you've named Q(uestion) ...

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.