[Rd] Namespace dependency not required

From: Patrick Giraudoux <patrick.giraudoux_at_univ-fcomte.fr>
Date: Sun, 18 Mar 2012 11:21:47 +0100


Hi,

I am working at adding namespace to my packages, carefully following the doc "Writing R extensions" and some threads on the web. However I cannot find clear explanation about how to best deal with the import or importFrom functions in the name space. To make it short:

To declare dependencies in the description file either after Depends: (packages including functions that are called from a package function) or after Suggests: (packages that are called eg from the doucmentation examples), works well. In this case one does not need to declare import in the namespace file.

However, declaring dependencies sometimes for using only one function in a given package looks a bit over the top, and I though I could use importFrom in the namespace to deal with that. So removing the corresponding declaration in Depends (description file) and declaring eg importFrom(splancs, inout) in the namespace always led to:

Same thing with import(sp). I have the same trouble if I do not remove the declarations in Depends.

So, I can hardly follow the meaning of the "Writing R extension" doc:

Packages implicitly import the base namespace. Variables exported from other packages with namespaces need to be imported explicitly using the directives |import| and |importFrom|. The |import| directive imports all exported variables from the specified package(s). Thus the directives

      import(foo, bar)

specifies that all exported variables in the packages *foo* and *bar* are to be imported. If only some of the exported variables from a package are needed, then they can be imported using |importFrom|. The directive

      importFrom(foo, f, g)

specifies that the exported variables |f| and |g| of the package *foo* are to be imported.

Can anybody tell us the conditions for which import and importFrom commands should be used in the NAMESPACE rather than in the Depends and Suggests declarations of the description file, and the conditions of their applicability (without error message... eg with a working example) ?

        [[alternative HTML version deleted]]



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Sun 18 Mar 2012 - 10:24:25 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 18 Mar 2012 - 14:50:30 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive