Difference between require() and library() in R

r

#1

Hello,

While loading and installing various packages and libraries in R, I’ve come across two methods of doing these similar kinds of functions, require() and library().
Is there any difference between these two or are they same?

thank you.


#2

see

according to the documentation for both functions (accessed by putting a ? before the function name and hitting enter), require is used inside functions, as it outputs a warning and continues if the package is not found, whereas library will throw an error.