ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew tap homebrew/science
brew install r
==> Installing r from homebrew/science
==> Installing dependencies for homebrew/science/r: gmp, mpfr, libmpc, is
==> Installing homebrew/science/r dependency: gmp
==> Downloading https://homebrew.bintray.com/bottles/gmp-6.1.0.el_capitan.bottle
######################################################################## 100.0%
==> Pouring gmp-6.1.0.el_capitan.bottle.tar.gz
/usr/local/Cellar/gmp/6.1.0: 17 files, 3.2M
==> Installing homebrew/science/r dependency: mpfr
==> Downloading https://homebrew.bintray.com/bottles/mpfr-3.1.4.el_capitan.bottl
######################################################################## 100.0%
==> Pouring mpfr-3.1.4.el_capitan.bottle.tar.gz
/usr/local/Cellar/mpfr/3.1.4: 25 files, 3.6M
==> Installing homebrew/science/r dependency: libmpc
==> Downloading https://homebrew.bintray.com/bottles/libmpc-1.0.3.el_capitan.bot
######################################################################## 100.0%
==> Pouring libmpc-1.0.3.el_capitan.bottle.tar.gz
/usr/local/Cellar/libmpc/1.0.3: 11 files, 350.1K
==> Installing homebrew/science/r dependency: isl
==> Downloading https://homebrew.bintray.com/bottles/isl-0.15.el_capitan.bottle.
######################################################################## 100.0%
==> Pouring isl-0.15.el_capitan.bottle.tar.gz
/usr/local/Cellar/isl/0.15: 70 files, 3.6M
==> Installing homebrew/science/r dependency: gcc
==> Downloading https://homebrew.bintray.com/bottles/gcc-6.1.0.el_capitan.bottle
## 2.9%
安装多个软件包
install.packages(c("plyr","RColorBrewer"),repos= "http://cran.us.r-project.org")
spatstat 依赖于多个包, 所以先安装依赖的包
install.packages(c("deldir","tensor","polyclip","goftest"))
install.packages("/home/qi/下载/spatstat_1.42-1.tar.gz", repos=NULL, type="source")
R语言终端打开图形界面
R -g Tk
或者 R -g X11
转载于:https://blog.51cto.com/matrix6ro/1789609