R 在linux redhat 6.5的編譯安裝過程

  1. 下載源碼包
    • 在http://cran.r-project.org/mirrors.html,選擇一個國內鏡像下載須要的版本,好比:http://mirror.lzu.edu.cn/CRAN/src/base/R-3/,這兒我下載了R-3.1.3版的源碼,大約20多M,很快就下載完成。
  2. 解壓源碼
    • 壓縮包我放在/user/local目錄下,進入此目錄後運行命令:
    • tar xzf R-3.1.3.tar.gz
    • 解壓到當前目錄
  3. 檢查編譯環境及編譯
    • 進入目錄
    • cd R-3.1.3
    •  ./configure

    • configure: error: No F77 compiler found
      ...會有一大堆不知足的條件checking for g++... no checking for c++... no
    • 安裝對應的依賴便可
      yum install gcc-c++ (若是沒有安裝c和c++的編譯器)
      yum install readline-devel
      yum install libXt-devel
      yum install gcc-gfortran (解決configure: error: No F77 compiler found 錯誤)
    • ./configure  --enable-R-shlib --prefix=/usr/R-3.1.3
      make
      make install
    • 將/usr/local/R-3.1.3/bin加入用戶或系統環境變量的path裏邊:
         好比:vim /etc/profile
         增長這一行:export PATH=/usr/R-3.1.3/bin:$PATH
         source /etc/profile
  4. 測試
>R
便可看到以下信息:
簡單測試
ok!

 

R version 3.1.3 (2015-03-09) -- "Smooth Sidewalk"
Copyright (C) 2015 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. > x<-c(1,2,3) > y<-c(102,299,301) > model<-lm(y~x) > summary(model) Call: lm(formula = y ~ x) Residuals: 1 2 3 -32.5 65.0 -32.5 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 35.00 121.60 0.288 0.822 x 99.50 56.29 1.768 0.328 Residual standard error: 79.61 on 1 degrees of freedom Multiple R-squared: 0.7575, Adjusted R-squared: 0.5151 F-statistic: 3.124 on 1 and 1 DF, p-value: 0.3278 > proc.time() user system elapsed 0.300 0.024 97.456 >
相關文章
相關標籤/搜索