1.10 Loading packages
Recall that after you’ve installed a package, you need to “load it.” In other words, you need to “open it.” We do this by using the library() command.
For example, to load the ggplot2 package, type the following code in the first line of your R script and run the code.
What do we mean by “run the following code”? Type the Run button at the top of the R script window.
After running the earlier code, if a blinking cursor returns next to the > “prompt” sign, it means you were successful. The ggplot2 package is now loaded and ready to use. If, however, you get a red error message that reads:
`...` \index{R packages!loading error}
Error in library(ggplot2) : there is no package called ‘ggplot2’`...`
it means that you didn’t successfully install it. Try installing the package again before proceeding.
Watch a video to show you how to load RStudio packages.
