How can I determine who the authors of a package are? Given that we have this widely used code base, I think it is appropriate that I make a reference to the software I use in m
As others have posted functions, and not explanations, I'll fill this in.
Distributed with every package is a DESCRIPTION file. Optionally, a maintainer may include a CITATION file.
The citation(pkgName)
(where pkgName
is a character string) function will look for the CITATION file first, then the DESCRIPTION file. If the former is found, it will present that file's contents. If the latter, it will auto-generate BibTeX output based on the fields in the DESCRIPTION file. This output may require some additional revision, so be careful before using the contents directly in a citation.
In order to view the package description, packageDescription(pkgName)
will do the trick. This will return a list of items, each based on a field from the DESCRIPTION file. This is your best bet if you want to programmatically work with those contents.
One key issue is that the author(s) of a package and the maintainer(s) of the package may not be the same people. If you need assistance with a package, you should contact the maintainer(s). An example is nlme
. First, a snippet from the citation info:
> citation("nlme")
To cite package 'nlme' in publications use:
Jose Pinheiro, Douglas Bates, Saikat DebRoy, Deepayan Sarkar and the R Development Core Team (2011). nlme: Linear and
Nonlinear Mixed Effects Models. R package version 3.1-102.
And a snippet from the DESCRIPTION info:
> packageDescription("nlme")
Package: nlme
Title: Linear and Nonlinear Mixed Effects Models
Author: Jose Pinheiro (S version), Douglas Bates (up to 2007), Saikat DebRoy (up to 2002), Deepayan Sarkar (up to 2005), the
R Core team.
Maintainer: R-core
Note that the authors listed participated over different intervals, but, should you want help today, you'd email R-core@R-project.org.
Finally, as maintainers can create their own CITATION file, the CITATION info need not be a subset of the DESCRIPTION info. An example is from citation("base")
, which includes, among other things, the ISBN record, which is not in the output of packageDescription("base")
.
Update 1. If you'd like to show some love to authors or maintainers, here is some code get a list of the most frequently named authors or maintainers, based on the output of installed.packages()
. (If you'd like to limit it to packages used by some code, then check out the mvbutils
package and the foodweb
function -- one could get crazy and further rank by the frequency of calls or time spent, if using Rprof
.)
Unfortunately, this code doesn't split strings into multiple names, so a collaboration is treated as 1 "person", possibly undercounting the work of individuals. If you want a careful analysis, you'll have to do a little more work. :)
getMaint <- function(x){
return(packageDescription(x)$Maintainer)
}
getAuth <- function(x){
return(packageDescription(x)$Author)
}
nicePrint <- function(x, N = 10){
tmpTable <- head(sort(table(x), decreasing = TRUE), N)
tmpTable <- as.data.frame(tmpTable)
colnames(tmpTable) = "count"
return(tmpTable)
}
vPkgs <- installed.packages()[,"Package"]
listA <- mapply(getAuth, vPkgs)
listM <- mapply(getMaint, vPkgs)
nicePrint(listA)
nicePrint(listM)
Here's an example from one computer; apologies for the ugly obscured email addresses. The code above produces the correct email addresses from the DESCRIPTION file, but I've edited them out.
Authors:
nicePrint(listA) count Diethelm Wuertz and many others, see the SOURCE file 14 Hadley Wickham
7 R Development Core Team and contributors worldwide 7 Henrik Bengtsson 4 Revolution Analytics 4 Brian Ripley . 3 David Scott 3 Luke Tierney 3 R Development Core Team 3
Maintainers:
nicePrint(listM) count Rmetrics Core Team
19 R Core Team 13 Brian Ripley 9 Achim Zeileis 7 Hadley Wickham 7 Torsten Hothorn 7 David Scott 5 Henrik Bengtsson 5 Trevor Hastie 5 Luke Tierney 4