Dear R-help, Can some one tell me if it's possible to have conditional importFrom() in the package NAMESPACE file? Basically I'd like to know if it's possible to make the NAMESPACE file compatible with R 1.9.0 and those 1.8.1 and earlier. The problem is that I want to import cmdscale(), which is in `mva' prior to 1.9.0 but in `stats' post 1.9.0. Any pointer much appreciated! Best, Andy Andy Liaw, PhD Biometrics Research PO Box 2000, RY33-300 Merck Research Labs Rahway, NJ 07065 mailto:andy_liaw at merck.com 732-594-0820
"Liaw, Andy" <andy_liaw at merck.com> writes:> Can some one tell me if it's possible to have conditional importFrom() in > the package NAMESPACE file? Basically I'd like to know if it's possible to > make the NAMESPACE file compatible with R 1.9.0 and those 1.8.1 and earlier. > The problem is that I want to import cmdscale(), which is in `mva' prior to > 1.9.0 but in `stats' post 1.9.0.Well, we've got good news and bad news. The good news is that there are facilities for conditionals in the NAMESPACE file. The bad news is that they were introduced in 1.9.0 so you can't use them for the purpose you have in mind. The way many of us have approached this is to freeze a version of the package that works for R-1.8.1 and add R(<= 1.8.1) to Depends: in the DESCRIPTION file. Then bump the version number, switch to importFrom(stats, ...) in the NAMESPACE and add R(>= 1.9.0) to the Depends: line.
> From: Douglas Bates [mailto:bates at bates4.stat.wisc.edu] On > > "Liaw, Andy" <andy_liaw at merck.com> writes: > > > Can some one tell me if it's possible to have conditional > importFrom() in > > the package NAMESPACE file? Basically I'd like to know if > it's possible to > > make the NAMESPACE file compatible with R 1.9.0 and those > 1.8.1 and earlier. > > The problem is that I want to import cmdscale(), which is > in `mva' prior to > > 1.9.0 but in `stats' post 1.9.0. > > Well, we've got good news and bad news. The good news is that there > are facilities for conditionals in the NAMESPACE file. The bad news > is that they were introduced in 1.9.0 so you can't use them for the > purpose you have in mind. > > The way many of us have approached this is to freeze a version of the > package that works for R-1.8.1 and add R(<= 1.8.1) to Depends: in the > DESCRIPTION file. > > Then bump the version number, switch to importFrom(stats, ...) in the > NAMESPACE and add R(>= 1.9.0) to the Depends: line.Thanks very much, Doug. I suppose one ugly way of getting around this is not to import cmdscale in NAMESPACE, but to check for R version and do the appropriate require() inside the function that needs cmdscale(). Or is that really too ugly? Best, Andy
Reasonably Related Threads
- 64-bit R on Opteron [was Re: Windows R 1.8.0 hangs when M em Usage >1.8GB]
- 64-bit R on Opteron [was Re: Windows R 1.8.0 hangs when M em Usage >1.8GB]
- can you library(MASS) with R 1.9.0?
- make check failed for R-1.9.0alpha (2004-03-16) when link against Goto's BLAS
- cmdscale in package mva (PR#1027)