Centos7安装R和RStudio

一、去官网下载安装包
https://mirrors.tuna.tsinghua.edu.cn/CRAN/
点击R-3.5.1.tar.gz 进行下载

二、解压
我习惯解压到/usr/local目录下
tar -zxvf R-3.5.1.tar.gz -C /usr/local

三、下载各种依赖
yum install -y gcc
yum install -y gcc-gfortran
yum install -y gcc-c++
yum install -y glibc-headers
yum install -y libreadline6-dev gfortran 
yum install -y readline-devel
yum install -y wget libXt-devel
yum install -y fonts-chinese tcl tcl-devel tclx tk tk-devel
yum install -y mesa-libGLU mesa-libGLU-devel
yum install -y install bzip2-devel 
yum install -y install xz-devel.x86_64 
yum install -y install pcre-devel
yum install -y install libcurl
yum install -y install libcurl-devel
yum install -y  texinfo.x86_64
yum install -y texlive-pdftex-doc.noarch
yum install -y texlive

三、安装 R的安装是通过configure进行安装 配置时间大概15分钟左右
cd /usr/local/R-3.3.2
./configure --enable-R-shlib=yes --with-tcltk --prefix=/usr/local/R
make
make install

make出现错误:error: cannot compile a simple Fortran program 是因为没有下载gfortran
yum install -y gcc-gfortran即可

四、设置环境变量
vim /etc/profile
R_HOME=/usr/local/R-3.5.1
PATH=$PATH:$R_HOME/bin
source /etc/profile

五、检验
在终端输入R
R version 3.5.1 (2018-07-02) -- "Feather Spray"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
>
表示R已经安装好了

===============================================================
安装Rstudio(Server)
https://www.rstudio.com/products/rstudio/download-server/
我的操作系统是Centos7 按照官网提示的安装命令进行安装
$ wget https://download2.rstudio.org/rstudio-server-rhel-1.1.456-x86_64.rpm
$ sudo yum install rstudio-server-rhel-1.1.456-x86_64.rpm
中间报:无法建立 SSL 连接。
wget在使用HTTPS协议时,默认会去验证网站的证书,而这个证书验证经常会失败。
在原命令加上"--no-check-certificate"选项,就能排除掉这个错误
[root@MiWiFi-R3P-srv R]# wget --no-check-certificate https://download2.rstudio.org/rstudio-server-rhel-1.1.456-x86_64.rpm

使用浏览器访问ip+8787进入rstudio

=================================================================

安装R语言的包
在控制台输入R
>install.packages("devtools", dependencies = T)
会跳出一个连线cane ...
选择Chinese shanghai即可
安装devtools出现的错误
提示xml2安装时退出狀態的值不是0
解决方法 yum install libxml*

=======================
安装REmap
library("devtools")
install_github('lchiffon/REmap')
安装Remap时出现的错误:
dependency ‘XML’ is not available for package ‘REmap’
解决方法:install.packages("XML")

=====================================
可视化教程注意的几点:
1、使用百度api需要使用自己申请的ak
options(remap.ak = "")
2、代码中需要添加一行
options(remap.js.web = T)  
不然打开浏览器时会提示找不到保存的html文件
3、R的注释需要删掉,可能和浏览器不兼容
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值