library()
   get_help() docs


Description

The library() function comes with R and is part of the Base R {base} package.

We use this function to load libraries into the R session. This function will not install libraries for you, which is (usually) done with the {base} R function install.packages().

Sometimes libraries show messages when they load to tell you about some aspect of its behavior. These are generally not errors!

Examples

# Load the ggplot2 library
library(ggplot2)

# You can also use quotes - it makes no difference
library("ggplot2")


# If you try to load a library that isn't installed OR you have a typo, 
# you will see this error message:
library(definitely.a.fake.library)
## Error in library(definitely.a.fake.library): there is no package called 'definitely.a.fake.library'