On Fri, 31 Oct 2003, Ross Boylan wrote: > On Fri, 2003-10-31 at 06:41, A.J. Rossini wrote: > > Ross Boylan <[EMAIL PROTECTED]> writes: > > > > > > I also added library("survival") to my .First.lib. Is library, rather > > > than require, the right choice here? I want it to fail if survival > > > doesn't load. > > > > test the results from require, something like: > > > > if (!require("survival")) stop("can't load survival") > Doesn't using library do about the same thing? What's the advantage of > this, clearer diagnostics? >
If you are going to fail when "survival" isn't found you should probably just use library, though Tony's suggestion is effectively equivalent, and I have also seen the Perly require(tcltk) || stop("error message") The main point of require() is when failure isn't completely fatal: eg hypothetically if (!require(boot)) { warning("No `boot' package -- you're not getting confidence intervals") conf.int<-FALSE } -thomas ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help