From Matthias.Kohl at stamats.de  Mon Nov 28 12:16:33 2005
From: Matthias.Kohl at stamats.de (Matthias Kohl)
Date: Mon, 28 Nov 2005 12:16:33 +0100
Subject: [Rd] import of Namespaces
Message-ID: <438AE711.4000708@stamats.de>

Dear R devels,

let's say I have three packages "pkg1", "pkg2" and "pkg3" which all 
contain new S4 classes and methods. Where "pkg3" depends on "pkg2" and 
"pkg2" depends on "pkg1". Moreover, all three packages have namespaces.

1) I use ".onLoad <- function(lib, pkg) require(methods)". Do I also 
have to import the namespace of "methods" package?

2) If I use import("pkg1") in the namespace of "pkg2", does this also 
(correctly) import the S4 classes and methods of "pkg1"? Or do I 
explicitly have to use importClassesFrom resp. importMethodsFrom?

3) If I import the Namespace of "pkg2" in "pkg3", where the namespace of 
"pkg2" has import("pkg1") (or maybe importClassesFrom, 
importMethodsFrom) and I also want to use S4 classes and methods of 
"pkg1" in "pkg3". Is it sufficient to have import("pkg2") in the 
Namespace of "pkg3" or do I need import("pkg1") and import("pkg2")?

Many thanks for your help and advice
Matthias

-- 
StaMatS - Statistik + Mathematik Service
Dipl.Math.(Univ.) Matthias Kohl
www.stamats.de



[Rd] import of Namespaces
Matthias Kohl