# Install R Libraries

The R available on ALPS is version 3.1.1 (latest version is 3.1.2 at the time of writing). Type `R` to initial the R environment.

`R`

```
R version 3.1.1 (2014-07-10) -- "Sock it to Me"
Copyright (C) 2014 The R Foundation for Statistical Computing
Platform: x86_64-unknown-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

>
```

Within the R console, we use the `install.packages()` command to installed all required R libraries.

```r
install.packages(c("data.table","ggplot2","gridExtra","reshape","scales"), repos="http://cran.us.r-project.org")
```

You may encounter these messages telling you certain directory you do not have WRITE permission. Please type **"y"** to both questions to create a personal library in your home directory.

```
Warning in install.packages(c("data.table", "ggplot2", "gridExtra", "plyr",  :
  'lib = "/pkg/biology/R/R-3.1.1/lib64/R/library"' is not writable
Would you like to use a personal library instead?  (y/n) y
```

```
Would you like to create a personal library
~/R/x86_64-unknown-linux-gnu-library/3.1
to install packages into?  (y/n) y
```

Use the `library()` command to lists all available packages in the libraries.

```r
library()
```

```
Packages in library ‘/home/s00yao00/R/x86_64-unknown-linux-gnu-library/3.1’:

chron                   Chronological objects which can handle dates
                        and times
colorspace              Color Space Manipulation
data.table              Extension of data.frame
dichromat               Color Schemes for Dichromats
digest                  Create Cryptographic Hash Digests of R Objects
ggplot2                 An implementation of the Grammar of Graphics
gridExtra               functions in Grid graphics
gtable                  Arrange grobs in tables.
labeling                Axis Labeling
munsell                 Munsell colour system
proto                   Prototype object-based programming
reshape                 Flexibly reshape data.
reshape2                Flexibly Reshape Data: A Reboot of the Reshape
                        Package.
scales                  Scale functions for graphics.
stringr                 Make it easier to work with strings.
```

Press `q` to exit the package list, and type `q()` command to exit the R console. Choose **"n"** to not save the workspace as an image.

```r
q()
Save workspace image? [y/n/c]: n
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ycl6.gitbook.io/methylation-sequencing-analysis/visualization_using_r/install_r_libraries.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
