Body
Error loading packages in Jupyter
Example Error:
Error in library(ggplot2): there is no package called ‘ggplot2’
Common Issue: The package isn’t installed in the correct location.
Solution:
-
Check Library Location:
- Run
Library()
in R to see the location of the library and the installed packages.
-
Common Library Locations:
/Users/username/Library/R/3.2/library
/Library/Frameworks/R.framework/Versions/3.2/Resources/library
-
Verify Package Installation:
- If your package isn’t listed, it means it’s not installed in the R library that Jupyter is using.
-
Install Package:
- Open R or RStudio.
- Run the following command, replacing
PACKAGENAME
with the package you’re trying to install and /Path/to/Library
with your library location (found using Library()
)
install.packages("PACKAGENAME", lib="/Path/to/Library")
Example:
install.packages("ggplot2", lib="/Users/username/Library/R/3.2/library/")