分享

Linux(centos 6)安装R语言及R脚本运行

 gearss 2018-04-23

1. 安装

转载:
http://blog.csdn.net/qibaoyuan/article/details/6827352

R语言是主要用于统计分析、绘图的语言和操作环境。

官方网站:

http://www./

Windows下面有直接的安装包,直接下载安装很方便,但是对于刚出的CentOS6.0上不能直接通过yum 安装R,需要自己编译。

下载页面:

http://ftp./mirrors/CRAN/

在编译R之前,需要通过yum安装以下几个程序:

#yum install gcc-gfortran              #否则报”configure: error: No F77 compiler found”错误

#yum install gcc gcc-c++              #否则报”configure: error: C++ preprocessor “/lib/cpp” fails sanity check”错误

#yum install readline-devel          #否则报”–with-readline=yes (default) and headers/libs are not available”错误

#yum install libXt-devel                 #否则报”configure: error: –with-x=yes (default) and X11 headers/libs are not available”错误

然后下载源代码,编译

#cd

#wget http://ftp./mirrors/CRAN/src/base/R-2/R-2.13.1.tar.gz

#tar zxvf R-2.13.1.tar.gz

#cd R-2.13.1

#./configure

#make

#make install

即可完成编译安装。


自定义安装目录: ./configure --prefix=/data1/R


2.使用:
[jiawei4@secondnamenode183 task5]$ /data1/R-3.0.0/bin/R

R version 3.0.0 (2013-04-03) -- "Masked Marvel"
Copyright (C) 2013 The R Foundation for Statistical Computing
Platform: x86_64-unknown-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

>

3. 脚本运行:
#cp /data1/R-3.0.0/bin/Rscript /bin/
#vi test.r
#!/bin/Rscript
x<-10
x
# Rscript test.r
[1] 10



    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多