R语言/RStudio环境安装


CENTOS7安装R语言环境

yum install texinfo.x86_64

yum install texlive.x86_64

cd /opt wget https://mirrors.tuna.tsinghua.edu.cn/CRAN/src/base/R-3/R-3.3.1.tar.gz

tar -zxvf ./R-3.3.1.tar.gz

wget http://ftp.jaist.ac.jp/pub/CTAN/fonts/inconsolata.zip

unzip ./inconsolata.zip

cp -rf ./inconsolata /usr/share/texlive/texmf-dist/tex/latex/

mktexlsr

cd R-3.3.1

./configure –enable-R-shlib

make

 

 

 

 

R语言在mac上的配置

可以参考https://www.jianshu.com/p/1a0f25086e8b

R语言:https://mirrors.tuna.tsinghua.edu.cn/CRAN/ 里面下载,https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/macosx/R-3.6.2.pkg

RStudio官方网站下载打不开(https://download1.rstudio.org/desktop/macos/RStudio-1.2.5033.dmg),所以用网上的一个RStudio(http://www.pc6.com/mac/178976.html

过行:

1、输入大写的R:$ R

2、或者直接打开R GUI。

更多example:

http://personality-project.org/r/r.commands.html 

3、运行脚本:

source("/Users/xx/Desktop/R.R")

4、安装程序包:

install.packages("plyr") 

 

【R】在centOS7下编译安装R3.3.2和R

缘起

在spark和hive配置完毕后,没有实质性的分析业务的基础上,想结合一部分SparkR的技术来分析hive中的数据。

安装顺序

一,R语言的安装配置 
二,SparkR的安装配置

R语言的安装

首先,从官网上下载3.3.2版本

wget https://cran.r-project.org/src/base/R-3/R-3.3.2.tar.gz

下载完后记得解压,我的习惯是解压在/usr/local下面

tar -zxvf R-3.3.2.tar.gz 

然后,编译过mysql的小伙伴肯定也知道,各种环境的安装(gcc等等)。 
mysql的各种依赖环境。

yum install -y gcc 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 
我习惯建立在usr中

mkdir /usr/local/R

接下来,进入R中,准备进行安装了。该R的安装是通过configure进行安装

cd /usr/local/R-3.3.2 ./configure --enable-R-shlib=yes --with-tcltk --prefix=/usr/local/R

环境配置完毕后,可以进行make和安装了

make & make install

配置I5的话 大概是15到20分钟。

编译安装完毕后,进行环境配置。

vim /etc/profile
#add R env R_HOME=/usr/local/R PATH=$PATH:$R_HOME/bin source /etc/profile

然后直接输入R回车就能进入R的控制台了。

[root@master bin]# source /etc/profile [root@master bin]# R R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch" Copyright (C) 2016 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit)

可能的错误信息

1,如果提示以上安装包未安装的话,请重新安装。 
2,缺少什么就使用yum search 缺少的名称,再根据相应的包来进行安装。 
3,有可能是其中的Python版本指定有问题。可能需要更新python版本或者内核。 
4,没有特别报错,但最后出现

configure: WARNING: you cannot build info or HTML versions of the R manuals 
  • 1

你需要安装

yum install -y texinfo.x86_64 yum install -y texlive-pdftex-doc.noarch
  • 1
  • 2

5,make的时候一直不动,然后报错’pdflatex’ is needed to make vignettes but is missing on your system. 
下载安装yum install -y texlive

感言

确实每次的编译安装都不容易。各种依赖环境要配置到位。但是每次出错都能让自己学到对应的错误,并解决问题。如果可以的话,还是选择通过EPEL YUM源来安装R,而且过程更简单。通过源安装的话,相对容易,本po就不写文字了。

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM