linux:

在编译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”错误

wget http://mirror.bjtu.edu.cn/cran/src/base/R-3/R-3.0.1.tar.gz
 
2、解压:
tar -zxvf R-3.0.1.tar.gz
cd R-3.0.1
 
3、安装
yum install readline-devel
yum install libXt-devel
./configure
 
如果使用rJava需要加上 --enable-R-shlib
./configure  --enable-R-shlib --prefix=/usr/R-3.0.1
make
make install
 
4、配置环境变量
vi .bash_profile
 
PATH=/usr/R-3.0.1/bin
source .bash_profile
5、测试:创建脚本(t.R)
cd /opt/script/R
vim t.R
 
#!/path/to/Rscript    #第一行
x<-c(1,2,3)    #R语言代码
y<-c(102,299,301)
model<-lm(y~x)
summary(model)
 
6、测试:执行脚本
R CMD BATCH --args /opt/script/R/t.R
more /opt/script/R/t.Rout    #查看执行的结果
或者第二种方式
Rscript /opt/script/R/test.R    #结果直接输出到终端
 
 

测试:

[root@192 R-3.1.1]# R

R version 3.1.1 (2014-07-10) -- "Sock it to Me"

Copyright (C) 2014 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.

> head(iris)

Sepal.Length Sepal.Width Petal.Length Petal.Width Species

1          5.1         3.5          1.4         0.2  setosa

2          4.9         3.0          1.4         0.2  setosa

3          4.7         3.2          1.3         0.2  setosa

4          4.6         3.1          1.5         0.2  setosa

5          5.0         3.6          1.4         0.2  setosa

6          5.4         3.9          1.7         0.4  setosa

尝试安装shiny包

> install.packages("shiny")

Selection: 20

also installing the dependencies ‘Rcpp’, ‘bitops’, ‘httpuv’, ‘caTools’, ‘RJSONIO’, ‘xtable’, ‘digest’, ‘htmltools’

trying URL 'http://mirror.bjtu.edu.cn/cran/src/contrib/Rcpp_0.11.2.tar.gz'

Content type 'application/octet-stream' length 2004313 bytes (1.9 Mb)

opened URL

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

downloaded 8734 bytes

trying URL 'http://mirror.bjtu.edu.cn/cran/src/contrib/httpuv_1.3.0.tar.gz'

Content type 'application/octet-stream' length 423739 bytes (413 Kb)

opened URL

> library(shiny)

> runExample("01_hello")

Listening on http://127.0.0.1:7964

测试完毕!

R安装的更多相关文章

  1. R安装package报ERROR: a 'NAMESPACE' file is required

    R安装package报错: [root@Hadoop-NN-01 mysofts]# R CMD INSTALL trimcluster_0.1-1.tar.gz * installing to li ...

  2. Ubuntu-16.04 R 安装及Jupyter notebook 配置

    1. R 安装 通常在Terminal下直接apt-get 即可,在16.10下可以get到R-3.3.1,目前最新好像是 R-3.4.2,可以去官方网站下载源码编译 (https://www.r-p ...

  3. R 安装与环境配置

    R语言是一种很方便的应用于科学计算的语言,推荐给大家学习. 由于R的版本对程序包的兼容有些问题,推荐使用2.15.3. 下面给出下载链接,安装一路默认即可,可以自己更存放目录,其他的都没有影响.下面是 ...

  4. R安装时出现辑程包不存在,解决方法

    R > -------------------------------------------------[解决方案]1.使用命令单独安装caret,安装的时间很长.install.packag ...

  5. R 安装 简单实用

    下载和安装Windows环境的R 1.进入主页,点击 蓝色加粗的 download R 2.随便点击一个镜像,这里点击的是http://mirror.fcaglp.unlp.edu.ar/CRAN/ ...

  6. R 安装car包失败

    在RStudio里安装car包的时候报错 /usr/bin/ld: cannot find -llapack /usr/bin/ld: cannot find -lblas make: *** [qu ...

  7. centos7 安装R和Rstudio客户端

    #官网下载R和Rstudio 我下载的是 R-3.2.1.tar.gz和rstudio-0.99.467-x86_64.rpm两个版本 rstudio没有看见有centos版的,下的这个RStudio ...

  8. R语言入门(一)简介安装

    数据挖掘常用的语言有R语言,python,SQL等,其中R语言最受欢迎.(注:SQL Server包含微软研究院开发的两种数据挖掘算法:Microsoft决策树和Microsoft聚集,此外还支持第三 ...

  9. R: 修改镜像、bioconductor安装及go基因富集分析

    1.安装bioconductor及go分析涉及的相关包 source("http://bioconductor.org/biocLite.R") options(BioC_mirr ...

随机推荐

  1. cocos2d学习之路四(添加遥控杆)

    添加遥控杆 1. 首先需要再HelloWorldLayer.h中包含ZJoystick.h文件 并且让其实现ZJoystickDelegate协议 2.打开HelloWorldLayer.mm文件实现 ...

  2. vs2015开发Windows服务

    工作已经很久,时隔这么长时间写这篇文章是给自己以后做参考.也不至于以后长时间不写Windows服务而忘记整个开发过程.windows服务开发,基础的就不说了,直接上过程. 1.新建windows服务项 ...

  3. hightchart导出图片

    通常在使用highchart导出图片pdf等文件时,我们一般直接引入exporting.js即可 执行导出操作则会直接请求highchart服务器,执行生成图片等操作,然后下载到客户端: 但这一切的操 ...

  4. jQuery Validation让验证变得如此容易(三)

    以下代码进行对jQuery Validation的简单演示包括必填项.字符长度,格式验证 一.引入文件 <script src="js/jquery-1.8.0.min.js" ...

  5. Struts启动报空指针

    严重: Exception starting filter struts2 java.lang.NullPointerException at com.opensymphony.xwork2.util ...

  6. Dispose模式

    Dispose模式 Dispose模式是.NET中很基础也很重要的一个模式,今天重新复习一下相关的东西并记录下来. 什么是Dispose模式? 什么时候我们该为一个类型实现Dispose模式 使用Di ...

  7. poj1872A Dicey Problem

    Home Problems Status Contest     284:28:39 307:00:00   Overview Problem Status Rank A B C D E F G H ...

  8. mysql之多列索引

    mysql的多列索引是经常会遇到的问题,怎样才能有效命中索引,是本文要探讨的重点. 多列索引使用的Btree,也就是平衡二叉树.简单来说就是排好序的快速索引方式.它的原则就是要遵循左前缀索引. 多个索 ...

  9. [ios2] iOS常用控件尺寸大集合 【转】

    元素控件 尺寸(PTS) Window(含状态栏) 320 x 480 Status Bar的高度 20 Navigation Bar的高度 44 含Prompt的Navigation Bar的高度 ...

  10. jQuery核心结构简单分析

    以下分析均采取沙箱模式 (function (window) { //为了提高性能把需要的变量统一提前声明 var arr = [], push = arr.push; //为区别jQuery,此文章 ...