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. [RM 状态机详解1] RMApp状态机详解

    概述 Apache Hadoop 2.0在Hadoop 1.0基础上做了许多的重构工作,代码上的重构最大的变化在于引入状态机处理各个角色的状态与变迁,使用状态机是得代码结构更加清晰,方便异步处理各种操 ...

  2. [新概念英语II 笔记] Lesson 3: Please Send Me a Card

    发现身边很多程序员都能看懂英文技术文章的60%-80%内容,但大家都有一个毛病,就是不会说,不会写作,在逛英文技术社区的时候,想发表点什么评论,总担心自己写的话有错误.究其原因, 我觉得主要原因是因为 ...

  3. .NET PageAdmin CMS

    .NET PageAdmin CMS 完全破解步骤(非简单去版权) 其实当初我的目的是很纯洁的,只是想找一个简单的网站生成模板,由于对.net更熟悉一点,就去搜索了.net框架的CMS,看它的介绍挺强 ...

  4. IIS日志字段详解

    IIS日志字段详解 抓住8月的尾巴,弥补下这个月的空白,事情太多,忘了写博客这回事了. IIS日志字段设置                                          网站运营时 ...

  5. web.xml加载过程

    web.xml加载过程:1 启动WEB项目的时候,容器(如:Tomcat)会读他的配置文件web.xml读两个节点  <listener></listener>和<con ...

  6. ActionInvoker

    ActionInvoker 还是这张图: 当ControllerFactory生成Controller实例后,这时就需要使用ActionInvoker来选择调用一个合适的Action执行.ASP.NE ...

  7. hadoop集群安装

    首现非常感谢 虾皮(http://www.cnblogs.com/xia520pi/archive/2012/05/16/2503949.html) 安装过程是参照他的<Hadoop集群(第5期 ...

  8. Excel 自定义函数

    浅谈Excel开发:四 Excel 自定义函数   我们知道,Excel中有很多内置的函数,比如求和,求平均,字符串操作函数,金融函数等等.在有些时候,结合业务要求,这些函数可能不能满足我们的需求,比 ...

  9. PyQt设计流程

    Qt designer 设计流程:  创建一个 PyQt4 的步骤,通常的方法是用 QtDesigner 工具创建 GUI 界面.可以在窗口  上添加部件,并可以对部件进行一些属性配置.一般的过程如下 ...

  10. 打破惯性思维:聊聊一次debug

    最近公司的新需求中要增加活动营销,整个组的人都被安排去研究某成熟产品的实现.我也认真地在看webService部分的实现,发现了一个诡异的10614端口的请求. 代码如下图: 这是一段服务端发请求验证 ...