Installing ggplot “package ‘ggplot’ is not available” and “subscript out of bounds” errors
40,877
Solution 1
You have the name of the package wrong - it is now ggplot2
following a major rewrite by Hadley some years ago. I presume the old ggplot
package has been removed from CRAN.
install.packages("ggplot2", dependencies = TRUE)
This is what I get:
R> install.packages("ggplot2", dependencies = TRUE)
Installing package(s) into ‘/home/gavin/R/libs’
(as ‘lib’ is unspecified)
trying URL 'http://cran.uk.r-project.org/src/contrib/ggplot2_0.8.9.tar.gz'
Content type 'application/x-gzip' length 2074749 bytes (2.0 Mb)
opened URL
==================================================
downloaded 2.0 Mb
* installing *source* package ‘ggplot2’ ...
** R
** data
** moving datasets to lazyload DB
** inst
** help
*** installing help indices
** building package indices ...
** testing if installed package can be loaded
* DONE (ggplot2)
The downloaded packages are in
‘/tmp/RtmpPcn8bl/downloaded_packages’
Solution 2
As an update if anyone runs into issues running ggplot or GGally, I had this error:
"Error: package or namespace load failed for ‘ggplot2’ in
loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
there is no package called ‘colorspace’Error: package ‘ggplot2’ could not be loaded"
Once I installed colorspace, ggplot2 worked fine. I'm guessing that colorspace is in the call, but not in the dependencies listed.
Related videos on Youtube
Author by
GaBorgulya
Updated on October 16, 2020Comments
-
GaBorgulya over 3 years
$ R R version 2.12.2 (2011-02-25) Platform: i486-pc-linux-gnu (32-bit) > install.packages("ggplot") Warning message: In getDependencies(pkgs, dependencies, available, lib) : package ‘ggplot’ is not available > install.packages("ggplot", dep="T") Error in apply(available[p1, dependencies, drop = FALSE], 1L, function(x) paste(x[!is.na(x)], : subscript out of bounds In addition: Warning message: In getDependencies(pkgs, dependencies, available, lib) : package ‘ggplot’ is not available > install.packages("ggplot", dep="T", type="source") Error in apply(available[p1, dependencies, drop = FALSE], 1L, function(x) paste(x[!is.na(x)], : subscript out of bounds In addition: Warning message: In getDependencies(pkgs, dependencies, available, lib) : package ‘ggplot’ is not available
How can I install
ggplot
? -
Gavin Simpson about 13 yearsIf you don't have the dependencies installed then you'll see a lot more than I showed above.
-
GaBorgulya about 13 yearsThank you! Please see my follow up question: stackoverflow.com/questions/5522924/… .
-
Gavin Simpson about 13 years@GaBorgulya you really should edit the existing Q to post such a similar follow-up Q, not start a new one. If you run exactly the code I showed it will work. If you want to alter working code then don't be surprised when it breaks.
-
GaBorgulya about 13 yearsPlease calm down and be a bit more patient.
-
GaBorgulya about 13 yearsThanks for your answer it did cure both errors! Your text next to the code explained one of the errors (the name of the package), the second error was silently solved in the code.
-
Gavin Simpson about 13 years@GaBorguly - I'm perfectly calm. Slightly mystified as to why you altered my code and posted another Q asking about it? But not angry, annoyed or stressed about it. I'm too hungover for that! ;-)
-
Gavin Simpson about 13 years@GaBorguly It does pay to slow down a bit and be a bit patient yourself. The code I showed worked, but failed when you tried it. At that point step back and see what is different between what you used and what the working code did.
-
GaBorgulya about 13 yearsMy answer is in my last comment (edited while you sent your new message). The answer that the package was renamed was sufficient for me to go on. I did not analyse your code to see that you changed a parameter as well.
-
GaBorgulya about 13 yearsI believe that a “thank you” and an explanation why I did not see immediately why your answer was a full solution should be enough. Please stop blaming me and give me a minute to correct my mistakes. Thanks again for the solution.
-
schu34 over 5 yearsHey, Thanks for your post. This seems like a separate issue from the one in the question, so it should have it's own question. Note it's perfectly acceptable to post a new question and answer it yourself!