TL;DR: require
breaks one of the fundamental rules of robust software systems, fail early.
In a nutshell, this is because, when using require
, your code might yield different, erroneous results without signalling an error. This is rare, but not hypothetical! Note that require
returns the boolean TRUE
if the package is successfully loaded, and FALSE
if it is not.
On the other hand, require
does install the package if it hasn’t been installed (whereas library
doesn’t).
Original answer: Stack Overflow - What is the difference between require() and library().
Source: https://stackoverflow.com/a/51263513