Libraries, library(), require(), and packages
- A package is a collection of R code
- A library is a directory of installed packages
- In many languages, “library” means what “package” means in R
- See book about setting up user library with new R installation (
dir.create(Sys.getenv("R_LIBS_USER"), recursive = TRUE)
)
library("pkg", lib.loc = "mylib")
loadspkg
frommylib
into memory- NEVER use inside a package
require("pkg", lib.loc = "mylib")
does same but only warns ifpkg
is missing