Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

Error: package ‘ggplot2’ could not be loaded

Hi plotly community,

I have problems installing/using the plotly library in R, see below. I always get an error that the ggplot2 package is required. I am running the latest R-Studio version (mac). I also installed the ggplot2 package separately with the same error…

Any advice?

install.packages(“plotly”)
trying URL 'https://cran.rstudio.com/bin/macosx/mavericks/contrib/3.3/plotly_4.5.2.tgz
Content type ‘application/x-gzip’ length 806762 bytes (787 KB)
==================================================
downloaded 787 KB

The downloaded binary packages are in
/var/folders/y5/1s7bftz92vjdyrz4jnkznnnh0000gn/T//RtmpzCk2cR/downloaded_packages

library(plotly)
Loading required package: ggplot2
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
there is no package called ‘colorspace’
Error: package ‘ggplot2’ could not be loaded

In this particular instance you’ll have to install colorspace as well. Try running install.packages("colorspace") first.