(1.) Install R for your operating system from CRAN.

(2.) Install RStudio from RStudio.

(3.) Install CRAN Packages from R console like this:

install.packages(c("pkg1", "pkg2")) 
install.packages("pkg.zip", repos=NULL)

(4.) Install Bioconductor packages as follows:

source("http://www.bioconductor.org/biocLite.R")
library(BiocInstaller)
BiocVersion()
biocLite()
biocLite(c("pkg1", "pkg2"))

(5.) For more details consult the Bioc Install page and BiocInstaller package.