Dear R-devel, I've noticed that when I place a `NEWS' file in the top-level directory for a package, then do R CMD build mypkg, the file gets included in the .tar.gz file. However, if I do R CMD build --binary mypkg, the `NEWS' file does not get included in the .zip file. Is this intentional? Is there a way I can get such a file included in the pre-compiled package automatically? Best, Andy Andy Liaw, PhD Biometrics Research PO Box 2000, RY33-300 Merck Research Labs Rahway, NJ 07065 mailto:andy_liaw@merck.com 732-594-0820
Roger D. Peng
2004-Jun-24 15:54 UTC
[Rd] news file included in source but not binary package
I think you need to put it in the inst/ subdirectory. -roger Liaw, Andy wrote:> Dear R-devel, > > I've noticed that when I place a `NEWS' file in the top-level directory for > a package, then do R CMD build mypkg, the file gets included in the .tar.gz > file. However, if I do R CMD build --binary mypkg, the `NEWS' file does not > get included in the .zip file. Is this intentional? Is there a way I can > get such a file included in the pre-compiled package automatically? > > Best, > Andy > > Andy Liaw, PhD > Biometrics Research PO Box 2000, RY33-300 > Merck Research Labs Rahway, NJ 07065 > mailto:andy_liaw@merck.com 732-594-0820 > > ______________________________________________ > R-devel@stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-devel >-- Roger D. Peng http://www.biostat.jhsph.edu/~rpeng/
Prof Brian Ripley
2004-Jun-24 15:59 UTC
[Rd] news file included in source but not binary package
Use the inst directory - it's documented in Writing R Extensions, and has lots of examples on CRAN. On Thu, 24 Jun 2004, Liaw, Andy wrote:> I've noticed that when I place a `NEWS' file in the top-level directory for > a package, then do R CMD build mypkg, the file gets included in the .tar.gz > file. However, if I do R CMD build --binary mypkg, the `NEWS' file does not > get included in the .zip file. Is this intentional? Is there a way I can > get such a file included in the pre-compiled package automatically?-- Brian D. Ripley, ripley@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Thanks to Brian, Roger and Dirk for the pointer to inst. I do remember it, but R-exts doesn't really suggest what that directory is for, merely what would happen to files placed there. For a source package, though, that seems a rather obscure place to put a `NEWS' file... On a slightly different topic: May I suggest inclusion of something like the following (suitably modified, if need be) in the next version of R (and perhaps even advertise it in the startup message)? news <- function(package=NULL, lib.loc=NULL) { if (is.null(package)) { file.show(file.path(R.home(), "NEWS"), title=paste("NEWS for R-", paste(R.version[c("major", "minor")], collapse="."))) } else { ## check if package is installed pkgs <- installed.packages(lib.loc=lib.loc) which <- match(package, pkgs[, "Package"]) if (is.na(which)) stop(package, "not found") newsfile <- file.path(pkgs[which, "LibPath"], "NEWS") if (!file.exists(newsfile)) stop("Sorry, no news from Lake Wobegon...") file.show(newsfile, title=paste("NEWS for ", paste(pkgs[which, c("Package", "Version")], collapse="_"))) } } Best, Andy> From: Prof Brian Ripley > > Use the inst directory - it's documented in Writing R > Extensions, and has > lots of examples on CRAN. > > On Thu, 24 Jun 2004, Liaw, Andy wrote: > > > I've noticed that when I place a `NEWS' file in the > top-level directory for > > a package, then do R CMD build mypkg, the file gets > included in the .tar.gz > > file. However, if I do R CMD build --binary mypkg, the > `NEWS' file does not > > get included in the .zip file. Is this intentional? Is > there a way I can > > get such a file included in the pre-compiled package automatically? > > > -- > Brian D. Ripley, ripley@stats.ox.ac.uk > Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ > University of Oxford, Tel: +44 1865 272861 (self) > 1 South Parks Road, +44 1865 272866 (PA) > Oxford OX1 3TG, UK Fax: +44 1865 272595 > > ______________________________________________ > R-devel@stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-devel > >
> From: Friedrich Leisch >[snip]> You might want to take a look at the system.file() function, that > reduces the above quite considerably :-)Indeed: news <- function(package=NULL, lib.loc=NULL) { if (is.null(package)) { newsfile <- file.path(R.home(), "NEWS") title <- paste("NEWS for R-", paste(R.version[c("major", "minor")], collapse=".")) } else { newsfile <- file.path(system.file(package=package, lib.loc=lib.loc), "NEWS") title <- paste("NEWS for", package) } file.show(newsfile, title=title) } [One might want to add the pager argument as in file.show.]> But to get to the heart of the email (something similar was proposed > by Greg Warnes a few weeks ago): We should definetely provide a simple > mechanism to see the latest changes in a package. > > Question: I am aware of files calles NEWS and ChangeLog (or CHANGELOG, > etc.) holding the relevant information ... are there any others we > want/need to respect?Yes, I do recall the thread that Greg started. This is sort of trying to get it going again... Could we just settle on a standard name and be done with it? Since base R uses NEWS, why not just use that for all packages, and use NEWS.platform as Duncan suggested (in the top-level directory, rather than platform-specific directories)? [A saying I've heard mentioned in an industry-standard committee meeting: `Demoncracy is not about what you want, but what you can live with.'] Best, Andy> best, > fritz > >