> For the complete documentation index, see [llms.txt](https://docs.opencga.opencb.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.opencga.opencb.org/develop-2/manual/using-opencga/client-libraries/r.md).

# opencgaR - R library

## Overview <a href="#r-overview" id="r-overview"></a>

**opencgaR** is an R library that interacts with OpenCGA REST API to execute any operation supported by the web services through R code.

The client offers programmatic access to the implemented REST web services, facilitating the access and analysis of data stored in OpenCGA. From version 2.0.0 data is returned in a new *RestResponse* object which contains metadata and the results. The client also implements some handy methods to return information from this object.

{% hint style="info" %}
**opencgaR code** has been implemented by *Marta Bleda.* It's open-source and can be found at <https://github.com/opencb/opencga/tree/develop/opencga-client/src/main/R>. It can be installed easily by downloading the pre-build package. Please, find more details on how to use the R library at [Using the R client](http://docs.opencb.org/display/opencga/Using+the+R+client).
{% endhint %}

## Installation <a href="#r-installation" id="r-installation"></a>

### Requisites

* An operating machine with R installed and functional. **opencgaR** requires at least **R version 3.4 (**&#x61;lthough most of the code is fully compatible with earlier versions).&#x20;
* Have the pre-build R package stored in your local machine. Alternatively you can also provide the URL to the pre-build R package file.

  The pre-build R package of **opencgaR** can be downloaded from the OpenCGA v2.0.0 GitHub Release at <https://github.com/opencb/opencga/releases>.

Once requirements have been fulfilled, installing opencgaR becomes as easy as use the `install.packages` function in R. `install.packages` can also install a source package from a remote `.tar.gz` file by providing the URL to such file.

### Installation from the R terminal

```
## Install opencgaR by providing the URL to the package
> install.packages("opencgaR_2.0.0.tar.gz", repos=NULL, type="source")
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.opencga.opencb.org/develop-2/manual/using-opencga/client-libraries/r.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
