Installation Environment:
CentOS, R3.0.1
1, under the terminal download: #cd/usr/local/
#wget http://mirror.bjtu.edu.cn/cran/src/base/R-3/R-3.0.1.tar.gz (input under terminal)
2. Unzip the file:
#tar-ZXVF r-3.0.1.tar.gz
#cd R-3.0.1
3.
installation Files
#yum Install Gcc-gfortran
#yum Install Glibc-headers
#yum Install gcc-c++
#yum Install Readline-devel
#yum Install Libxt-devel
#./configure--enable-r-shlib--prefix=/usr/local/r-3.0.1
#make
#make Install
4. Configure Environment variables
CD to Etc/profile,
Edit a file Vim profile
Join
Export r_home=/usr/local/r-3.0.1
Export path=.: $R _home/bin: $PATH
Save and exit,
And then
#source profile
Restarting the operating system
5. Test: Create script (T.R) can enter #r in current environment
OK, the installation is complete, orCreate an R file under a folder XX.R
Input content
#!/path/to/rscript #第一行
X<-c (#R语言代码)
Y<-c (102,299,301)
MODEL<-LM (y~x)
Summary (model)
6. Test: Execute Script
At the terminal Rscript xx. R #结果直接输出到终端
7. Install R Language Pack
wget http://cran.at.r-project.org/src/contrib/Archive/xlsx/xlsx_0.5.5.tar.gz
The above is an example, if you do not know the package version number, I have a way:
wget http://cran.at.r-project.org/src/contrib/Archive/package name such as the package name is xlsx
Then the folder will download a page is the package Name page, which has the package version number, and then copy the version number you want to re-download
wget http://cran.at.r-project.org/src/contrib/Archive/xlsx/xlsx_0.5.5.tar.gz
Then execute the R CMD INSTALL xlsx_0.5.5.tar.gz in the directory of the downloaded package
Of course, there will be dependencies between the package, indicating that the installation error is generally dependent on the package has not been installed, you can first install the dependent package
Installing the R language software under Linux