Laurent Gautier
2012-Aug-26 16:25 UTC
[Rd] Package "datasets" not exporting anything on a recent R-2.15.1-patched
Hi,
I just stumbled on the following apparent oddity: the package
"datasets"
does not appear to export anything out of its namespace:
> ns_datasets <- getNamespace('datasets')
> getNamespaceExports(ns_datasets)
character(0)
Not the case with other packages (example here with "utils"):
> ns_utils <- getNamespace('utils')
> head(getNamespaceExports(ns_utils))
[1] "?" ".DollarNames" "adist"
"alarm" "apropos"
[6] "aregexec"
Is this a temporary glitch, or is there something new and specific to
"datasets" ?
Best,
Laurent
PS: Obligatory sessionInfo:
> sessionInfo()
R version 2.15.1 Patched (2012-08-24 r60412)
Platform: x86_64-unknown-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_DK.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_DK.UTF-8 LC_COLLATE=en_DK.UTF-8
[5] LC_MONETARY=en_DK.UTF-8 LC_MESSAGES=en_DK.UTF-8
[7] LC_PAPER=C LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_DK.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] tcltk_2.15.1 tools_2.15.1
Dirk Eddelbuettel
2012-Aug-26 16:32 UTC
[Rd] Package "datasets" not exporting anything on a recent R-2.15.1-patched
On 26 August 2012 at 18:25, Laurent Gautier wrote:
| Hi,
|
| I just stumbled on the following apparent oddity: the package
"datasets"
| does not appear to export anything out of its namespace:
|
| > ns_datasets <- getNamespace('datasets')
| > getNamespaceExports(ns_datasets)
| character(0)
|
| Not the case with other packages (example here with "utils"):
| > ns_utils <- getNamespace('utils')
| > head(getNamespaceExports(ns_utils))
| [1] "?" ".DollarNames" "adist"
"alarm" "apropos"
| [6] "aregexec"
|
| Is this a temporary glitch, or is there something new and specific to
| "datasets" ?
Seems to be on purpose -- here is its NAMESPACE file
# This package exports nothing (it uses lazydata)
# exportPattern(".")
ie nuttin' gets exported. It also has no R/ directory.
Dirk
--
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
Prof Brian Ripley
2012-Aug-26 17:03 UTC
[Rd] Package "datasets" not exporting anything on a recent R-2.15.1-patched
On 26/08/2012 17:25, Laurent Gautier wrote:> Hi, > > I just stumbled on the following apparent oddity: the package "datasets" > does not appear to export anything out of its namespace: > > > ns_datasets <- getNamespace('datasets') > > getNamespaceExports(ns_datasets) > character(0) > > Not the case with other packages (example here with "utils"): > > ns_utils <- getNamespace('utils') > > head(getNamespaceExports(ns_utils)) > [1] "?" ".DollarNames" "adist" "alarm" "apropos" > [6] "aregexec" > > Is this a temporary glitch, or is there something new and specific to > "datasets" ?Not new, been so since R 2.14.0. The package contains no R code: the only reason it has a namespace is that since 2.14.0 all packages must have one. There are other data-only packages, but not in base R. Lazy-loaded data has not been part of the namespace for a long time: they are directly in the package's environment. The reason is the namespace scoping rules: if the package's datasets were in its namespace, they would be found before any other dataset of that name by the package's R functions. -- 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