[Rd] data() documentation ambiguous about loaded versus attached packages?

Martin Morgan mtmorgan at fhcrc.org
Fri Aug 17 22:24:30 CEST 2012

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

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

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)"

Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793

More information about the R-devel mailing list