I have R version 3.4.2, trying to install ggplot2, ran install.packages("ggplot2", dependencies = TRUE) in RStudio. It eventually tells me it exited with non-zero exit status and the errors are hard to read because the message is so long, but I see that in the process Matrix was a dependency which also failed to install, so I try to directly install that, and here's what I see in the error message for that:
/usr/bin/ld: cannot find -llapack
/usr/bin/ld: cannot find -lblas
/usr/bin/ld: cannot find -lgfortran
collect2: error: ld returned 1 exit status
/usr/share/R/share/make/shlib.mk:6: recipe for target 'Matrix.so' failed
make: *** [Matrix.so] Error 1
ERROR: compilation failed for package ‘Matrix’
* removing ‘/usr/local/lib/R/site-library/Matrix’
I'm not clear on what ld is at all and if I need to research that to solve this problem. It looks like it might alternately have something to do with Matrix.so.