The main guide on how to install R for any flavour of linux, binary or from source, is at http://cran.stat.ucla.edu/
Three different pathways to a working install, from simple to hard:
- use the distributions package manager (easiest but not the most recent version)
- install binary (recommended)
- compile and install from source
I am assuming you are on Ubuntu 16.04 LTS.