Skip to content
Prev 43878 / 63424 Next

data() documentation ambiguous about loaded versus attached packages?

Under ?data

  package: a character vector giving the package(s) to look in for data
           sets, or 'NULL'.

           By default, all packages in the search path are used, then
           the 'data' subdirectory (if present) of the current working
           directory.

which I think is accurate -- packages have to be attached for their data 
to be found; being loaded (as when PkgB Imports: PkgA) is not 
sufficient. Later we have

      If 'lib.loc' and 'package' are both 'NULL' (the default), the data
      sets are searched for in all the currently loaded packages then in
      the 'data' directory (if any) of the current working directory.

which I think is incorrect ('currently attached packages') and

      If 'lib.loc = NULL' but 'package' is specified as a character
      vector, the specified package(s) are searched for first amongst
      loaded packages and then in the default library/ies (see
      '.libPaths').

which I'm unsure of -- probably 'amongst attached packages'.

FWIW most Bioconductor packages that use data() in function calls 
currently do so without specifying 'package', and without specifying an 
'envir' argument (hence overwriting user objects in the global environment).

 > R.version.string
[1] "R Under development (unstable) (2012-08-17 r60296)"

Martin