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

Jeff Newmiller jdnewmil at dcn.davis.ca.us
Fri Nov 18 00:51:11 CET 2016

Perhaps more people write end-user-ready applications in R than I am aware of and my bias is too strong.  For working at the console I prefer not to have my scripts installing packages on their own (one possible alternative execution path), and it is too much trouble to implement multiple routes to the end of an analysis in most cases, so library() is usually best for me. 
Sent from my phone. Please excuse my brevity.

On November 17, 2016 1:49:18 PM PST, Jeff Newmiller <jdnewmil at dcn.davis.ca.us> wrote:
>> 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.

More information about the R-help mailing list