1

The question of R "stats" citation for a scientific paper makes me wonder how I would enumerate all the R packages that I ought to cite when using R in an academic paper. How would I get a list of packages that I loaded and need citation?

Community
  • 1
  • 1
Kalin
  • 1,691
  • 2
  • 16
  • 22

1 Answers1

2

Using the answer to How to find out which package version is loaded in R? , I see that we can use the sessionInfo() function to see what packages have been loaded (though not necessarily used).

The following gets the base packages as a vector and concatenates it with the names of the loaded packages. Then we apply the citation function to each.

packages_in_use <- c( sessionInfo()$basePkgs, names( sessionInfo()$loadedOnly ) )
the_citations_list <- lapply( X=packages_in_use, FUN=citation)
the_citations_list 
Community
  • 1
  • 1
Kalin
  • 1,691
  • 2
  • 16
  • 22
  • 3
    A blanket **R** citation with the version number should be sufficient for the base packages. But if you used specific, non-base, packages, you could cite them as above. – alexwhitworth Dec 18 '14 at 03:02