> For the complete documentation index, see [llms.txt](https://docs.bcbi.brown.edu/codiac-for-health/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bcbi.brown.edu/codiac-for-health/computing/r/repl.md).

# REPL

> R comes with a full-featured interactive command-line REPL (read-eval-print loop) built into the`R` executable. In addition to allowing quick and easy evaluation of R statements, it has a searchable history, tab-completion, many helpful keybindings, and dedicated help `?` and shell modes `;`.

This page provides examples of using REPL on the command line.

## R REPL Example

* Type "module load r" in terminal to load the R module, then on a new line type "R" to launch R
* In terminal, q() quits the R module

<figure><img src="/files/wvXas2Ygi3A8XTS4BgZF" alt="Terminal screen with R launched. > &#x22;Hello, World!&#x22; Output = &#x22;Hello, World!&#x22;; > word = &#x22;test&#x22; > typeof(word) Output = &#x22;character&#x22;; >nchar(word) Output = 4; >print(word) Output = &#x22;test&#x22;; > q()"><figcaption></figcaption></figure>

## R REPL Help Pages

* Type "?" or help(function) to enter help pages within R's REPL
* For example, to ask for help with linear functions in R, use help(lm) (output shown below)

<figure><img src="/files/ycKSgxUJxVWYr1KyzN3u" alt="Terminal screen with R launched. Output of command help(lm)"><figcaption></figcaption></figure>

## Resources

* [REPL Environment Help](https://www.r-project.org/help.html)


---

# 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.bcbi.brown.edu/codiac-for-health/computing/r/repl.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.
