1. Update:
To obtain the latest R packages, add an entry like
deb http://
or
deb http://
or
deb http://
or
deb http://
in your /etc/apt/sources.list file, replacing
sudo apt-get update
2. install base package:
sudo apt-get install r-base
Users who need to compile R packages from source [e.g. package maintainers, or anyone installing packages with install.packages()] should also install the r-base-dev package:
sudo apt-get install r-base-dev
then type R in your terminal and if you get errors like this:
Error : .onLoad failed in loadNamespace() for ‘utils’, details:
call: options(op.utils[toset]) error: invalid value for ‘editor’ In addition: Warning message: package “methods” in options(“defaultPackages”) was not found Error : .onLoad failed in loadNamespace() for ‘utils’, details: call: options(op.utils[toset]) error: invalid value for ‘editor’ In addition: Warning message: package utils in options(“defaultPackages”) was not found Error : .onLoad failed in loadNamespace() for ‘utils’, details: call: options(op.utils[toset]) error: invalid value for ‘editor’ In addition: Warning message: package stats in options(“defaultPackages”) was not found During startup – Warning message: package methods in options(“defaultPackages”) was not found
Try e.g.
EDITOR=vim R
If that works, put the line
export EDITOR=vim
at the end of your ~/.profile
EDIT: the root of the problem was that /etc/R/Renviron was not read by R. As Dirk commented on his reply,
sudo chmod 644 /etc/R/Renviron
solves the problem
3. install other packages if needed:
type R in terminal and you can get into R
then type: install.packages(vegan)
and you can install “vagan” package
4. And an IDE, Rstudio, is recommended:
http://www.rstudio.com/ide/download/
Reference:
http://cran.r-project.org./
http://stackoverflow.com/questions/15090817/r-install-2-15-2-renvirons-not-found-ubuntu-12-10-x64
code
more code
~~~~