Search code examples
rnamespacesmulti-level

Does R support multi-level namespaces?


Is it possible to have a function in R under multiple levels of namespaces?

For example, can these functions exist?

Mymath::Trig::cosine( )
A::B::C::D::foo( )

Solution

  • I don't think so, because the parser doesn't even handle this syntax: a::b::c gives

    Error: unexpected '::' in "a::b::"

    i.e., we don't even get as far as searching for a thing in a namespace. In contrast a::b gives

    Error in loadNamespace(name) : there is no package called ‘a’