(1.) Install R for your operating system from CRAN.
(2.) Install RStudio from RStudio.
(3.) Install CRAN Packages from R console like this:
(4.) Install Bioconductor packages as follows:
(5.) For more details consult the Bioc Install page and BiocInstaller package.