R是什么

簡(jiǎn)介

R是用于統(tǒng)計(jì)分析、繪圖的語(yǔ)言和操作環(huán)境。R是屬于GNU系統(tǒng)的一個(gè)自由、免費(fèi)、源代碼開(kāi)放的軟件,它是一個(gè)用于統(tǒng)計(jì)計(jì)算和統(tǒng)計(jì)制圖的優(yōu)秀工具。

配置編譯流程

1.配置編譯環(huán)境

1)安裝wget工具。

apt-get install wget -y

2)安裝依賴庫(kù)和工具。

apt-get install Fortran* libreadline6-dev libxt-dev libbz2-dev liblzma-dev libghc-curl-dev libghc-zlib-dev libpcre++-dev -y

對(duì)于 ubuntu 下的 鏡像 源問(wèn)題,請(qǐng)參考https://bbs.huaweicloud.com/forum/thread-22424-1-1.html完成修復(fù)

2.獲取源碼

獲取“R-3.6.1”源碼包。

cd /usr/local/src
wget https://mirrors.tuna.tsinghua.edu.cn/CRAN/src/base/R-3/R-3.6.1.tar.gz

3.編譯和安裝

1)解壓軟件包。

cd /usr/local/src
tar -zxvf R-3.6.1.tar.gz

2)進(jìn)入R的安裝目錄。

cd /usr/local/src/R-3.6.1/

3)安裝R。

./configure --prefix=/usr/ --enable-R-shlib
make -j8 && make install

4)配置R環(huán)境變量。

vi /etc/profile

添加如下內(nèi)容:

export PATH=$PATH://usr/local/src/R-3.6.1/bin

保存退出,執(zhí)行如下語(yǔ)句使得環(huán)境變量生效。

source /etc/profile

4.運(yùn)行和驗(yàn)證

1)R一般配合桌面使用,建議參考《Xfce安裝指南》,安裝好桌面后,然后通過(guò)桌面進(jìn)入,打開(kāi)終端執(zhí)行。

R

回顯內(nèi)容如下:

root@ecs-ubuntu-xfce# R
 
R version 3.6.1 (2019-07-05) -- "Action of the Toes"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: aarch64-unknown-linux-gnu (64-bit)
 
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redis tribute 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.

2)檢查安裝。

執(zhí)行以下命令:

vol=trees[["Girth"]]^2*trees[["Height"]]/(4*pi)
hist(vol,col=1)

?彈出界面,表示安裝成功。