I've tried to install ggplot2
first with install.packages("ggplot2")
but after I try to open with library ("ggplot2")
it gives me this error message:
library ('ggplot2')
Error in library("ggplot2") : there is no package called ‘ggplot2’
Is this because I'm trying to run this on a mac or RStudio instead of R? How can I get it installed?
These are the details of the version I'm using:
RStudio Version 0.99.902 – © 2009-2016 RStudio, Inc. Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/604.4.7 (KHTML, like Gecko
Any help would be greatly appreciated!
Here's what I get when I try to install ggplot as a package if it helps...
> install.packages("ggplot2")
Installing package into ‘/Users/crystlewee/Library/R/3.2/library’
(as ‘lib’ is unspecified) also installing the dependency ‘scales’
There are binary versions available but the source versions are later:
binary source needs_compilation
scales 0.4.0 0.5.0 TRUE
ggplot2 2.1.0 2.2.1 FALSE
Do you want to install from sources the package which needs compilation?
y/n: y
installing the source packages ‘scales’, ‘ggplot2’
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 0 59867 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0100 59867 100 59867 0 0 39753 0 0:00:01 0:00:01 --:--:-- 39752
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 16
* installing *source* package ‘scales’ ...
** package ‘scales’ successfully unpacked and MD5 sums checked
** libs
llvm-g++-4.2 -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I"/Users/crystlewee/Library/R/3.2/library/Rcpp/include" -fPIC -mtune=core2 -g -O2 -c RcppExports.cpp -o RcppExports.o
/bin/sh: llvm-g++-4.2: command not found
make: *** [RcppExports.o] Error 127
ERROR: compilation failed for package ‘scales’
* removing ‘/Users/crystlewee/Library/R/3.2/library/scales’
* restoring previous ‘/Users/crystlewee/Library/R/3.2/library/scales’
Warning in install.packages :
installation of package ‘scales’ had non-zero exit status
* installing *source* package ‘ggplot2’ ...
** package ‘ggplot2’ successfully unpacked and MD5 sums checked
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
namespace ‘scales’ 0.4.0 is being loaded, but >= 0.4.1 is required
ERROR: lazy loading failed for package ‘ggplot2’
* removing ‘/Users/crystlewee/Library/R/3.2/library/ggplot2’
Warning in install.packages :
installation of package ‘ggplot2’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/my/vqvl_d89237fcc75nv24lqxw0000gn/T/Rtmpv0MgCR/downloaded_packages’
namespace ‘scales’ 0.4.0 is being loaded, but >= 0.4.1 is required
-> github.com/tidyverse/ggplot2/issues/1898 – CMichael