brew tap homebrew/science
brew install Caskroom/cask/xquartz
brew install r
The gcc package (will be installed automatically as a required dependency) in the homebrew/science tap contains the latest fortran compiler (gfortran), and most importantly the whole package is precompiled thus, saving lot of your compilation time.
If you you do nt have XCode cmd line tools, in that case you can run from terminal as follows:
xcode-select --install