R can be downloaded for free on the official repository website. I also advise you to install RStudio which is a simple graphical user interface for R which is very handy in many situations. Finally, packages can be installed either the menu "Tools/Install packages" in RStudio or directly the command line:
in an R console.