On Friday, February 22, 2013, Simon Urbanek wrote:

>
> On Feb 22, 2013, at 9:13 PM, Hadley Wickham wrote:
>
> > Hi Davor,
> >
> > To the best of my knowledge, there's only one way to use functions
> > from a suggested package: with require:
> >
> > if (require("suggested_package")) {
> >  function_from_suggested_package()
> > } else {
> >  stop("suggested package not installed")
> > }
> >
> > Unfortunately I don't think there's any way to use a suggested package
> > without polluting the search path.
> >
>
> Why -- wouldn't
>
> if (is.function(try(foo::bar, silent=TRUE))) {
>   foo::bar(...)
> }
>
> do the job?
>
>
 I may be misremembering, but I think r cmd check complains about that.

Hadley


-- 
Chief Scientist, RStudio
http://had.co.nz/

	[[alternative HTML version deleted]]

