[R] Namespaces of imported packages
mtmorgan at fhcrc.org
Wed Nov 19 02:29:47 CET 2008
Uwe Ligges <ligges at statistik.tu-dortmund.de> writes:
> Hutchinson,David [PYR] wrote:
>> I am trying to build an R package. My existing code makes use of
>> bitops and chron packages. So I have included statements to import
>> required functionality into the NAMESPACE file using import(). When I
>> run Rcmd build, and error is generated "Error: package 'bitops' does not
>> have a name space"
>> I exclude the import(bitops) statement from the NAMESPACE file and
>> rebuild without error. I am just curious as to why I get an error when
>> importing bitops into the namespace of the current build? Including
>> chron package builds fine.
> Obviously, your version of "chron" has a namespace while your version
> of "bitops" has not ....
Less obviously, it's only possible to 'import' from packages with name
spaces. Roughly, a name space allows a package to be loaded (into the
current R session) without being attached (to the global search path),
'Imports:' in the DESCRIPTION file says to load but not attach the
package. 'import' in the NAMESPACE file says to add the specified
symbols to the symbols that the importing package can find. The
distinction between loading and attaching is not available for
packages without name spaces, so it doesn't make (too much) sense (and
is not implemented, even if it did make sense) to 'Import:' or
'import' from packages without name spaces. Some detail is in the R
news article by Luke Tierney
I'm seldom right about these things, so others may well correct me.
> Uwe Ligges
>> Thanks in advance,
>> [[alternative HTML version deleted]]
>> R-help at r-project.org mailing list
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109
Location: Arnold Building M2 B169
Phone: (206) 667-2793
More information about the R-help