2024年3月31日发(作者:)
Linux(centos 6)安装R语言及R脚本运行
1. 安装
转载:
/qibaoyuan/article/details/6827352
R语言是主要用于统计分析、绘图的语言和操作环境。
官方网站:
/
Windows下面有直接的安装包,直接下载安装很方便,但是对于
刚出的CentOS6.0上不能直接通过yum 安装R,需要自己编译。
下载页面:
/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 /mirrors/CRAN/src/base/R-2/
#tar zxvf
#cd R-2.13.1
#./configure
#make
#make install
即可完成编译安装。
自定义安装目录: ./configure --prefix=/data1/R
2.使用:
[jiawei4@secondnamenode183
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
'()' for an HTML browser interface to help.
Type 'q()' to quit R.
>
task5]$ /data1/R-
3. 脚本运行:
#cp /data1/R-3.0.0/bin/Rscript /bin/
#vi test.r
#!/bin/Rscript
x<-10
x
# Rscript test.r
[1] 10


发布评论