安装最新版本的R
安装最新版本的R
步骤1:将最新版本路径导入sources.list中
步骤2:更新软件库
步骤3:安装驱动库
步骤4:安装R
步骤一
本文所用最新版本路径:

linux下将路径导入:
sudo vim /etc/apt/sources.list
# 在末端加上
deb http://mirrors.ustc.edu.cn//CRAN/bin/linux/ubuntu/ xenial/
步骤一注意事项
最新版本的镜像路径会变会失效,此时去官网看看最新的镜像路径,并选择适合自己的文件夹路径。


步骤二 更新软件库
sudo apt-get update
注意事项
报错

W: GPG error: http://mirrors.ustc.edu.cn//CRAN/bin/linux/ubuntu xenial/ InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 51716619E084DAB9
W: The repository 'http://mirrors.ustc.edu.cn//CRAN/bin/linux/ubuntu xenial/ InRelease' is not signed.
错误为缺少公钥xxxx,把公钥加上
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 51716619E084DAB9
安装驱动库
sudo apt-get install r-base-dev
安装R
sudo apt-get install r-base-core
其他
- apt-get install r-base-core: 运行报错
The following packages have unmet dependencies:
r-base-core : Depends: libgfortran3 (>= 4.3) but it is not going to be installed
Depends: liblapack3gf or
liblapack.so.3gf or
libatlas3gf-base but it is not going to be installed
Depends: libtiff4 but it is not installable
Recommends: r-recommended but it is not going to be installed
Recommends: r-base-dev but it is not going to be installed
Recommends: r-doc-html but it is not going to be installed
形成的原因都在于,缺少依赖关系 libtiff4,可以去libtiff4,需要注意的是libtiff4版本是amd64还是i386
下载地址:http://packages.ubuntu.com/zh-cn/precise/libtiff4
- install.packages()
Error in download.file(url, destfile = f, quiet = TRUE) :
unsupported URL scheme
Warning: unable to access index for repository https://mirrors.tuna.tsinghua.edu.cn/CRAN/src/contrib:
unsupported URL scheme
首先可以先检查一下自己的镜像是否可用,如果不可用时会返还:
available.packages()
unsupported URL scheme
Warning: unable to access index for repository https://mirrors.tuna.tsinghua.edu.cn/CRAN/src/contrib:
unsupported URL scheme
Package Version Priority Depends Imports LinkingTo Suggests Enhances
License License_is_FOSS License_restricts_use OS_type Archs MD5sum
NeedsCompilation File Repository
可以通过chooseCRANmirror()进行重新选择镜像。推荐镜像是:


同时,也可以通过自定义,进行下载安装:
install.packages('package_name', dependencies=TRUE, repos='http://cran.rstudio.com/')
其他方法可以看该贴的回复,看看是否找到其他的方法
http://stackoverflow.com/questions/25599943/unable-to-install-packages-in-latest-version-of-rstudio-and-r-version-3-1-1
http://stackoverflow.com/questions/33536943/r-warning-unable-to-access-index-for-repository
-
安装package出错
查看出错原因,刚装时需要检查是否安装,g++,没安装则apt-get install g++安装g++。如果原因是/usr/bin/ld: cannot find -llapack等。可以通过安装apt-get install r-base-dev解决,或者可以安装对应可以去安装对应的dev。例如cannot find -llapack,对应着的是aptliblapack-dev。 -
安装package出错2
报错原因
installation of package ‘**’ had non-zero exit status
这个是一个比较笼统的错误,一般由缺少驱动造成。可以通过安装以下驱动,尝试解决
sudo apt-get install libgeos-dev
sudo apt-get install tcl-dev
sudo apt-get install tk-dev