Linux安装R语言

首先服务器系统版本为centos5.6,R版本为 2. 13.2。 下面是安装步骤:
首先上传文件:rz -e
1、解压文件:tar –zvxf R-2.13.2.tar.gz
2、 进入R源文件目录:cd R-2. 13.2
3、执行./configure --prefix /home/work/R( --prefix是关键,R是自建文件夹
下面这些保留下来,暂时不用
提示错误信息为“
configure: error: No F77 compiler found”, 执行命令 yum install gcc-gfortran解决。再次执行 ./configure,报错:configure: error: --with-readline=yes (default) and headers/libs are not available”,执行命令 ./configure --with-readline=no,继续报错:“ configure: error: –with-x=yes (default) and X11 headers/libs are not available”。尝试执行命令 ./configure --with-readline=no --with-x=no通过,只是会提示警告信息:
configure: WARNING: you cannot build DVI versions of the R manuals
configure: WARNING: you cannot build DVI versions of all the help pages
configure: WARNING: you cannot build info or HTML versions of the R manuals
configure: WARNING: you cannot build PDF versions of the R manuals
configure: WARNING: you cannot build PDF versions of all the help pages
4、make
5、make install
6、配置环境变量(在自己的工作目录下,比如:/home/work),命令如下: vi .bash_profile 打开文件后,在PATH=后再加 :${HOME}/R/bin(这里的bin别丢了哦)
7、从新登入,然后就可以用了。(或者执行: source .bash_profile就不用重新登入了)
8、如果PDF没有装成功的话,图形只能从linux上下载到本地看了。所以再装PDF吧。
安装成功。进入R命令行界面,可以操作。但是tab自动补全以及上下左右等方向键都无法使用。想着应该是 ./configure --with-readline=no --with-x=no惹的祸。因此重新安装了一下,这次在执行./configure命令前先执行了命令
yum install readline-devel 解决错误 --with-readline=yes (default) and headers/libs are not available
yum install libXt-devel解决错误“–with-x=yes (default) and X11 headers/libs are not available”
最终安装成功,并且tab自动补全等都有效。

如何在浏览器即时看到所做的图:
1、secure里打开两个窗口
2、一个窗口里:cd 到有R图形pdf文件的文件下
执行python -m SimpleHTTPServer
别关掉,它会一直挂在那里
3、在另一个窗口,你就可以作图了,做完保存
4、随便打开一个浏览器输入url:你的机器名:8000
就可以看你你做的图了。


写sh执行的R脚本时,脚本开头增加如下内容:
#!/home/work/R/bin/Rscript
/home/work/R/bin 为R的安装路径

你可能感兴趣的:(hadoop)