From hadley at rice.edu  Wed Aug 25 14:33:30 2010
From: hadley at rice.edu (Hadley Wickham)
Date: Wed, 25 Aug 2010 07:33:30 -0500
Subject: [Rd] require is to suggests as what is to imports?
In-Reply-To: <alpine.LFD.2.00.1008242144540.20682@gannet.stats.ox.ac.uk>
References: <AANLkTi=EOFdYKP0JUZLCz8r7KRJ1PaYFGQgresAQJ6r1@mail.gmail.com>
	<alpine.LFD.2.00.1008242144540.20682@gannet.stats.ox.ac.uk>
Message-ID: <AANLkTi=uLXuLv8RktxGCcd5L=xMOBpskBFKEXJ3Rn9D2@mail.gmail.com>

On Tue, Aug 24, 2010 at 3:50 PM, Prof Brian Ripley
<ripley at stats.ox.ac.uk> wrote:
> On Tue, 24 Aug 2010, Hadley Wickham wrote:
>
>> Hi all,
>>
>> If a package suggests another package in its description, you can
>> check it at runtime with requires. ?How do you do check if a package
>
> Well, not really as requires() can give an error, at least until 2.12.0 is
> out. ?So you need to wrap it in a try/tryCatch construct.
>
>> is available without loading it, if you only want to access one
>> function in the package namespace.
>
> You could use try/tryCatch on pkg::fun (which is what you need to do with
> require). ?It is difficult (and would be fragile since the details of
> metadata are definitely subject to change without notice) to ascertain what
> a namespace will contain/export without loading it.

Ok, thanks.

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/



[Rd] require is to suggests as what is to imports?
Hadley Wickham