Importing R packages
Although base R comes with a lot of useful functions, you will not be able to fully leverage the full power of R without being able to import R modules developed by others. Imagine we want to do some great plotting and we want to use ggplot2 for it. If we want to do so, we need to take 2 steps:
- Install the package ggplot2 using
install.packages("ggplot2")
- Load the package ggplot2 using
library(ggplot2)
orrequire(ggplot2)
In datacamp however, most packages are already installed and readily available. As such, you won't need to run install.packages()
This exercise is part of the course
Inferential Statistics
Exercise instructions
- Load the ggplot2 package using the
library
function - Load the ggplot2 package using the
require
function
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# load the ggplot2 package using the library function
# load the ggplot2 package using the require function