Install R-project
From Source Code
Download R-source from the R-project website, the [CRAN] -> [Software] -> [R Sources]
Create a folder prepared for R installation
$ mkdir /home/<user>/rproject
- move the download source file to the folder and extract it
$ mv /home/<user>/下載/R-3.1.1.tar.gz /home/<user>/rproject
$ tar zvx -f /home/<user>/rproject/R-3.1.1.tar.gz
- Set the configure file
$ cd /home/<user>/rproject/R-3.1.1.tar.gz
$ ./configure --prefix=/home/<user>/rproject/ --enable-R-shlib
- make the source file
$ make
- install the file compiled already
$ make install
- add the path to the environment setting
$ sudo vim ~/.bashrc
$ export PATH=/home/<user>/rproject/bin/:$PATH (add under # .bashrc)
- Make every user from the PC could access the R program [optional]
$ chmod -R 777 /home/<user>/rproject
- Start with R programming
$ R
- R script for test (test.r)
listAll <- vector(mode="list",length=4)
for(i in 1:10) {
listAll[[i]] <- sample(9,4,replace=T)
}
listAll
- Run R script
$ Rscript ./test.r