How can I install R packages in my home directory?

You may want to install R libraries that are not provided in MSI's R modules. You can install them to your home directory using the following procedure.  Note that some packages need external libraries such as gccgslfftw etc. You can find the requirements in the package documentation. These packages have to be loaded by using 'module load' command before using R.
 
1) Load the desired R module
module load R/3.2
R

2) Set up the local installation path for packages

Use the .libPaths to point R functions that typically use lib="" or lib.loc="" syntax to configure the destination path.
> .libPaths(new='~/R/x86_64-pc-linux-gnu-library/3.2')
> dir.create('~/R/x86_64-pc-linux-gnu-library/3.2', showWarnings = FALSE, recursive = TRUE)

Confirm you have created and set the correct path:

> .libPaths()

3) Configure the CRAN mirror

Make sure to choose the 0-cloud mirror without https
> getCRANmirrors()
                               Name           Country              City
1                   0-Cloud [https]           0-Cloud           0-Cloud
2                           0-Cloud           0-Cloud           0-Cloud
3                   Algeria [https]           Algeria           Algiers
4                           Algeria           Algeria           Algiers
5              Argentina (La Plata)         Argentina          La Plata
6      Australia (Canberra) [https]         Australia          Canberra
7              Australia (Canberra)         Australia          Canberra
8   Australia (Melbourne 1) [https]         Australia         Melbourne
9   Australia (Melbourne 2) [https]         Australia         Melbourne
10        Australia (Perth) [https]         Australia             Perth
...

> chooseCRANmirror(ind=2)

4) Install packages normally

> install.packages('qtl')
Installing package into '/panfs/roc/groups/2/support/boll0107/R/x86_64-pc-linux-gnu-library/3.2'
(as 'lib' is unspecified)
The downloaded source packages are in
'/tmp/RtmpAGv4uB/downloaded_packages'

> install.packages('tree')
Installing package into '/panfs/roc/groups/2/support/boll0107/R/x86_64-pc-linux-gnu-library/3.2'
(as 'lib' is unspecified)
The downloaded source packages are in
'/tmp/RtmpAGv4uB/downloaded_packages'

> source("http://bioconductor.org/biocLite.R")
> biocLite("BiocInstaller")
Bioconductor version 3.1 (BiocInstaller 1.18.4), ?biocLite for help
Bioconductor version 3.1 (BiocInstaller 1.18.4), ?biocLite for help
Warning message:
: 'BiocInstaller' update failed, using version 1.18.4BioC_mirror: http://bioconductor.org
Using Bioconductor version 3.1 (BiocInstaller 1.18.4), R version 3.2.1.
Old packages: 'BiocInstaller', 'DBI', 'GenomeInfoDb', 'IRanges', 'MASS',
  'Matrix', 'RSQLite', 'S4Vectors', 'boot', 'class', 'cluster', 'codetools',
  'e1071', 'foreign', 'lattice', 'limma', 'mgcv', 'nlme', 'nnet', 'plotrix',
  'spatial', 'statmod', 'survival'

> biocLite(c("GenomicFeatures", "AnnotationDbi"))
Bioconductor version 3.1 (BiocInstaller 1.18.4), ?biocLite for help
Warning message:
: 'BiocInstaller' update failed, using version 1.18.4BioC_mirror: http://bioconductor.org
Using Bioconductor version 3.1 (BiocInstaller 1.18.4), R version 3.2.1.
Installing package(s) 'GenomicFeatures', 'AnnotationDbi'
also installing the dependencies 'futile.options', 'futile.logger', 'snow', 'BiocParallel', 'S4Vectors', 'bitops', 'zlibbioc', 'XML', 'Rsamtools', 'GenomicAlignments', 'GenomeInfoDb', 'GenomicRanges', 'RCurl', 'XVector', 'Biostrings', 'rtracklayer', 'biomaRt'

The downloaded source packages are in
'/tmp/RtmpAGv4uB/downloaded_packages'
Old packages: 'BiocInstaller', 'DBI', 'GenomeInfoDb', 'IRanges', 'MASS',
  'Matrix', 'RSQLite', 'S4Vectors', 'boot', 'class', 'cluster', 'codetools',
  'e1071', 'foreign', 'lattice', 'limma', 'mgcv', 'nlme', 'nnet', 'plotrix',
  'spatial', 'statmod', 'survival'

5) Confirm installations by loading the libraries

> library(qtl)
> library('GenomicRanges')

Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following object is masked from 'package:stats':

    xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, as.vector, cbind, colnames, do.call, duplicated,
    eval, evalq, get, intersect, is.unsorted, lapply, mapply, match,
    mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank, rbind,
    rep.int, rownames, sapply, setdiff, sort, table, tapply, union,
    unique, unlist, unsplit

Loading required package: S4Vectors
Loading required package: stats4
Creating a generic function for 'nchar' from package 'base' in package 'S4Vectors'
Loading required package: IRanges
Loading required package: GenomeInfoDb
Category: 
software