[R] require vs library ( Some basic time series questions)

Jeff Newmiller jdnewmil at dcn.davis.ca.us
Thu Nov 17 22:49:18 CET 2016

> require(tfplot)
> tfplot(x.ts)

Would just like to point out that require() should not be treated as interchangeable with library(). The former returns a logical status indicating success or failure, while the latter throws an error if it falls.  You should reserve use of require() for cases when you are implementing an alternative path of execution for failure, and in nearly all usual cases use the library() function instead so hapless users of your script don't have to sift through all the subsequent errors to figure out the problem.
Sent from my phone. Please excuse my brevity.

More information about the R-help mailing list