我正在尝试在R中安装ggplot包但我收到以下错误
install.packages('ggplot2',dependencies = TRUE)
* installing *source* package ‘gdtools’ ...
** package ‘gdtools’ successfully unpacked and MD5 sums checked
Using PKG_CFLAGS=-I/usr/local/opt/cairo/include/cairo
Using PKG_LIBS=-L/usr/local/opt/cairo/lib -lcairo
** libs
clang++ -I/usr/local/Cellar/r/3.3.1_2/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/cairo/include/cairo -I../inst/include/ -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -I"/usr/local/lib/R/3.3/site-library/Rcpp/include" -fPIC -g -O2 -c CairoContext.cpp -o CairoContext.o
clang++ -I/usr/local/Cellar/r/3.3.1_2/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/cairo/include/cairo -I../inst/include/ -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -I"/usr/local/lib/R/3.3/site-library/Rcpp/include" -fPIC -g -O2 -c RcppExports.cpp -o RcppExports.o
clang++ -I/usr/local/Cellar/r/3.3.1_2/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/cairo/include/cairo -I../inst/include/ -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -I"/usr/local/lib/R/3.3/site-library/Rcpp/include" -fPIC -g -O2 -c font_metrics.cpp -o font_metrics.o
In file included from font_metrics.cpp:3:
/usr/local/opt/cairo/include/cairo/cairo-ft.h:46:10: fatal error: 'ft2build.h'
file not found
#include <ft2build.h>
^
1 error generated.
make: *** [font_metrics.o] Error 1
ERROR: compilation failed for package ‘gdtools’
* removing ‘/usr/local/lib/R/3.3/site-library/gdtools’
* 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
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (ggplot2)
ERROR: dependency ‘gdtools’ is not available for package ‘svglite’
* removing ‘/usr/local/lib/R/3.3/site-library/svglite’
The downloaded source packages are in
‘/private/var/folders/mm/8gjs_s_s01x3_qr4xrdky88c0000gn/T/RtmpwQObj5/downloaded_packages’
Warning messages:
1: In install.packages("ggplot2", dependencies = TRUE) :
installation of package ‘gdtools’ had non-zero exit status
2: In install.packages("ggplot2", dependencies = TRUE) :
installation of package ‘svglite’ had non-zero exit status
我按照此页面中的说明安装了R:Installing R with Homebrew
brew tap homebrew/science
brew install Caskroom/cask/xquartz
brew install r
有谁能让我对此有所了解?非常感谢!