The following information is available from CRAN but for my convenience, I've collated the crux here for installing R on Ubuntu.
First find your closest mirror here. Currently I am in Japan, so mine is http://cran.ism.ac.jp/.
To find out which Ubuntu version you're using:
cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=11.10 DISTRIB_CODENAME=oneiric DISTRIB_DESCRIPTION="Ubuntu 11.10"
Now edit the file /etc/apt/sources.list and add this line:
deb http://cran.ism.ac.jp//bin/linux/ubuntu oneiric/
sudo vi /etc/apt/sources.list sudo apt-get update sudo apt-get install r-base
If you are getting this error "The following signatures couldn't be verified because the public key is not available: NO_PUBKEY ###", run these commands in the terminal (taken from http://ubuntuforums.org/showthread.php?t=1694202)
gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9 gpg -a --export E084DAB9 | sudo apt-key add -
To install R packages, run R with sudo.
sudo R
And installing Bioconductor and some useful packages:
source("http://bioconductor.org/biocLite.R")
biocLite()
biocLite("edgeR")
biocLite("DESeq")
biocLite("baySeq")
biocLite("GO.db")
biocLite("GOstats")
biocLite("biomaRt")
biocLite("Ringo")
install.packages("snow")
biocLite("ShortRead")
biocLite("org.Hs.eg.db")
biocLite("goseq")

This work is licensed under a Creative Commons
Attribution 4.0 International License.
Just want to say MANY thanks to you for putting this simple guidelines that are very helpful for anyone starting with R 🙂
Finding things to use on Ubuntu is always a bit tricky, so thank you for helping me avoid have to use wine on this one.
You’re welcome and welcome to the world of R 😉