On Wed, 12 Nov 2008, Michael Friendly wrote:

One could complement that by a
  url = {http://CRAN.R-project.org/package=tweedie}

In two recent in press articles where I cited R packages,
I was asked by the copy-editor to add a location or url to the references. Could I suggest that citation() be modified to include
the URL automatically?

That's a good suggestion and one that I discussed several times with Kurt. The problem is that citation() only looks at the installed package which doesn't know where it came from. Thus, I have AFAIK no simple means of checking whether a particular package I'm using was obtained from CRAN, Bioc, R-Forge, or some local source package. Hence, the URL cannot be included automatically.

I agree that this would be nice to have. One idea would be that the CRAN maintainer adds a line to the DESCRIPTION file upon release to CRAN. There are a few ideas how to do this exactly and it's not yet implemented.

As a package maintainer, however, you can improve the situation for your own packages by writing a CITATION file that has the CRAN URL in it. For example, the first citEntry() in the "colorspace" package has:

## R >= 2.8.0 passes package metadata to citation().
if(!exists("meta") || is.null(meta)) meta <- packageDescription("colorspace")
year <- sub("-.*", "", meta$Date)
note <- sprintf("R package version %s", meta$Version)

citEntry(entry = "Manual",
         title = "{colorspace}: Color Space Manipulation",
         author = personList(as.person("Ross Ihaka"),
                             as.person("Paul Murrell"),
                             as.person("Kurt Hornik"),
                             as.person("Achim Zeileis")),
         year = year,
         note = note,
         url = "http://CRAN.R-project.org/package=colorspace";,

         textVersion =
         paste("Ross Ihaka, Paul Murrell, Kurt Hornik, Achim Zeileis",
               sprintf("(%s).", year),
               "colorspace: Color Space Manipulation.",
               paste(note, ".", sep = ""),
               "URL http://CRAN.R-project.org/package=colorspace";)
)

Best wishes,
Z

In the function, this would entail replacing the line

 z$url <- meta$URL

with something like

z$url <- if (is.null(meta$URL) paste("http://CRAN.R-project.org/package=";, package, sep="") else meta$URL

I say "something like" because I'm not sure how to handle other repositories.

Along similar lines, someone recently posted a script to generate
a .bib file for all packages installed.  It would be useful if someone
were to implement that script for CRAN and make the resulting
R-packages.bib file available on the CRAN site.

-Michael


--
Michael Friendly     Email: friendly AT yorku DOT ca
Professor, Psychology Dept.
York University      Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Street    http://www.math.yorku.ca/SCS/friendly.html
Toronto, ONT  M3J 1P3 CANADA




______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to