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

Hadley Wickham hadley at rice.edu
Wed Aug 25 14:33:30 CEST 2010


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/



More information about the R-devel mailing list