[R] silently testing for data from another package for .Rd examples

2011-08-24 Thread Michael Friendly
In an .Rd example for a package, I want to use data from another package, but avoid loading the entire package and avoid errors/warnings if that other package is not available. If I don't care about loading the other package, I can just do: if (require(ElemStatLearn, quietly=TRUE)) {

Re: [R] silently testing for data from another package for .Rd examples

2011-08-24 Thread Yihui Xie
.packages(all = TRUE) will give you a list of all available packages without really loading them like require(). Regards, Yihui -- Yihui Xie xieyi...@gmail.com Phone: 515-294-2465 Web: http://yihui.name Department of Statistics, Iowa State University 2215 Snedecor Hall, Ames, IA On Wed, Aug

Re: [R] silently testing for data from another package for .Rd examples

2011-08-24 Thread Uwe Ligges
Actually it is recommended to test for the availability of a valid package with find.package(), particularly in this case where the name of the package is already know. Best, Uwe On 24.08.2011 18:29, Yihui Xie wrote: .packages(all = TRUE) will give you a list of all available packages

Re: [R] silently testing for data from another package for .Rd examples

2011-08-24 Thread Michael Friendly
On 8/24/2011 12:40 PM, Uwe Ligges wrote: Actually it is recommended to test for the availability of a valid package with find.package(), particularly in this case where the name of the package is already know. Best, Uwe Thanks. So I guess the idiom I'm looking for is