[Rd] news file included in source but not binary package

Liaw, Andy andy_liaw at merck.com
Thu Jun 24 16:37:49 CEST 2004


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 at 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 at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-devel
> 
>



More information about the R-devel mailing list