Reputation: 21
I am an r newbie and would appreciate some help installing ggplot2. I am using RStudio Version 0.98.1102. Please see error below.
install.packages("ggplot2")
runs fine
library("ggplot2")
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : there is no package called ‘colorspace’ Error: package or namespace load failed for ‘ggplot2’
install.packages("colorspace")
Installing package into ‘C:/Users/Jessica/Documents/R/win-library/3.1’ (as ‘lib’ is unspecified) There is a binary version available (and will be installed) but the source version is later: binary source colorspace 1.2-4 1.2-5 trying URL '...//cran.rstudio.com/bin/windows/contrib/3.1/colorspace_1.2-4.zip' Warning in install.packages : cannot open: HTTP status was '404 Not Found' Error in download.file(url, destfile, method, mode = "wb", ...) : cannot open URL '...://cran.rstudio.com/bin/windows/contrib/3.1/colorspace_1.2-4.zip' Warning in install.packages : download of package ‘colorspace’ failed
Upvotes: 2
Views: 18487
Reputation: 376
Similar to the original question, I recently encountered this issue with colormap 2.0.0, ggplot2 3.3.2, R 4.0.3, and RStudio 1.3.1093 on Windows. install.packages("ggplot2")
reports success even though it does not install colormap and library(ggplot2)
therefore fails. In my case, install.packages("colormap")
failed to locate the 2.0.0 binaries, retrieving the 1.4.1 sources instead. Downloading the 2.0.0 binary from https://CRAN.R-project.org/package=colorspace, as suggested in other answers, failed with
> install.packages("C:/Users/<username>/Downloads/colorspace_2.0-0.zip") # note use of forward slashes to avoid the backlash escaping problems @Paul M mentions in his comment on @L P's answer -- \\ instead of just \ also works
Warning in install.packages :
package ‘C:/Users/<username>/Downloads/colorspace_2.0-0.zip’ is not available for this version of R
What resolved this for me was including type = "win.binary"
in install.packages()
's arguments when installing from the download.
install.packages("C:/Users/<username>/Downloads/colorspace_2.0-0.zip", type = "win.binary")
Having done this, install.packages("colorspace")
also succeeds (both in session and after remove.packages("colorspace")
and restarting R).
Upvotes: 1
Reputation: 1
To me, it started giving this error when I updated all my packages using the available option "Packages" in R studio, it was working well before. After trying a few mentioned solutions in google and failed, I updated my R version and installed the packages, it worked.
Upvotes: 0
Reputation: 1096
Sometimes when the Curl version is not updated, problem with installing the packages happens. For resolving the problem in Linux, you could use the following command to update your Curl to tha last version:
sudo apt-get install libcurl4-openssl-dev libxml2-dev
Upvotes: 0
Reputation: 17
Try to install the color space separately and reload the package inside R studio again .
install.packages('ggplot2')
install.packages('colorspace')
library(ggplot2)
Hope this helps!
Upvotes: 0
Reputation: 321
When you type in install.packages("ggplot2")
into the console, RStudio is pre-programmed to also install the dependencies (i.e. the other packages ggplot needs to run properly). In this case, the issue appears to be with the colorspace
package not being able to installed. This is likely because you're running Yosemite and when RStudio looks to install colorspace, it searches for it on the CRAN, it can't find it for some reason:
cannot open URL 'http://cran.rstudio.com/bin/macosx/mavericks/contrib/3.1/colorspace_1.2-4.tgz'
You should be able to overcome this by installing the colorspace
package yourself via the CRAN: http://cran.r-project.org/web/packages/colorspace/index.html.
Upvotes: 1
Reputation: 3326
Looks like something is a bit messed up with the package meta-information or something in your Rstudio installation. A simple work-around to try is to just download the latest colorspace zip file from here: http://cran.r-project.org/web/packages/colorspace/index.html
Then install by running install.packages("c:/path/to/downloaded/zip/file/colorspace_1.2-5.zip")
Upvotes: 2