Error installing packages - see below. Suggestions?
> install.packages("ggplot2")
also installing the dependency ‘rlang’
There are binary versions available but the source versions are later:
binary source needs_compilation
rlang 0.1.6 0.3.0.1 TRUE
ggplot2 2.2.1 3.1.0 FALSE
Do you want to install from sources the package which needs compilation?
y/n: y
installing the source packages ‘rlang’, ‘ggplot2’
trying URL 'https://cran.rstudio.com/src/contrib/rlang_0.3.0.1.tar.gz'
Content type 'application/x-gzip' length 817008 bytes (797 KB)
==================================================
downloaded 797 KB
trying URL 'https://cran.rstudio.com/src/contrib/ggplot2_3.1.0.tar.gz'
Content type 'application/x-gzip' length 2863109 bytes (2.7 MB)
==================================================
downloaded 2.7 MB
Warning in strptime(xx, f <- "%Y-%m-%d %H:%M:%OS", tz = tz) :
unknown timezone 'zone/tz/2018g.1.0/zoneinfo/America/Denver'
* installing *source* package ‘rlang’ ...
** package ‘rlang’ successfully unpacked and MD5 sums checked
** libs
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
ERROR: compilation failed for package ‘rlang’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rlang’
Warning in install.packages :
installation of package ‘rlang’ had non-zero exit status
Warning in strptime(xx, f <- "%Y-%m-%d %H:%M:%OS", tz = tz) :
unknown timezone 'zone/tz/2018g.1.0/zoneinfo/America/Denver'
ERROR: dependency ‘rlang’ is not available for package ‘ggplot2’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/ggplot2’
Warning in install.packages :
installation of package ‘ggplot2’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/q0/dwvrf7z107s92gjrxvqj0q9r0000gn/T/RtmpkfB7Zn/downloaded_packages’
The most immediate problem here is that the packages you are trying to install need to be compiled from source, and your computer does not have the necessary compilation tools installed.
However, the only reason these packages need to be compiled is that you are running a version of R that is almost 3 years out of date (new versions of R come out every year, usually in April; the current long-in-the-tooth version is 3.5, but you seem to be running 3.3). Pre-compiled binaries of packages are made available for the current version of R, but not for older versions. If you were running current R, you would not need to compile these packages during installation. So the first thing I’d recommend is updating your R, then trying again
If you’d also like to install the developer tools that let you compile packages like these from source, can you confirm what version of your operating system you’re running? (Pasting in the output of sessionInfo() would be very helpful!)