From sleepingwell at gmail.com  Tue Jul  3 04:53:57 2012
From: sleepingwell at gmail.com (Simon Knapp)
Date: Tue, 3 Jul 2012 12:53:57 +1000
Subject: [Rd] Questions about imports to a namespace
Message-ID: <CAA+5f=3wxx+A3yXuuTYD_6YkfPZBuaPiW1mCKfU3hQAJD=B2GA@mail.gmail.com>

Hi,

I am a bit unsure about using imports in packages and have a few
questions. I'm sure the answer to some of these is 'it depends', but
I'm interested in what others think and 'best practices' when this is
the case.



1) If I use an import or importFrom declaration in a NAMESPACE, should
I also qualify the package in calls to the imported function (e.g.
maptools::readShapePoly)?

2) If the 'best practice' is to qualify the calls, when does one stop;
e.g. is it good/bad to say base::sapply?

3) If one is calling a (S3) generic, should one qualify the namespace?
Can this cause problems?

4) Is it better to check for arguments that are missing, or use a
default value of, say, NA; i.e. is missing(arg) preferable to
is.na(arg)?

5) I would like to declare a (S3) generic 'cleanup(x)' but
'cleanup(...)' already exists in R.utils, which my package depends on.
Should I do it?

6) I am used to writing 'requires(package)' for each package I use
within a function. If I have used import or importFrom in my
NAMESPACE, should I still do this?



Looking forward to your advice,
Simon Knapp



[Rd] Questions about imports to a namespace
Simon Knapp