> ## Documentation Index
> Fetch the complete documentation index at: https://e2b.manicule.dev/llms.txt
> Use this file to discover all available pages before exploring further.
> For every page in one file, fetch https://e2b.manicule.dev/llms-full.txt (large).
> To search and read these docs as tools, connect the MCP server at https://e2b.manicule.dev/api/mcp.
> Every agent surface: https://e2b.manicule.dev/.well-known/llms-manifest.json

# Run R code (/docs/code-interpreting/supported-languages/r)

<!-- agent-signals: reading_time_min: 1 · est_tokens: 144 · updated: 2026-07-30 -->
Related: [Run bash code](/docs/code-interpreting/supported-languages/bash.md), [Run Java code](/docs/code-interpreting/supported-languages/java.md), [Run JavaScript and TypeScript code](/docs/code-interpreting/supported-languages/javascript.md), [Run Python code](/docs/code-interpreting/supported-languages/python.md), [Auto-resume on request](/docs/sandbox/auto-resume.md)

Use the `runCode`/`run_code` method to run R code inside the sandbox.
You'll need to pass the `language` parameter with value `r`.

<CodeGroup>
```js title="JavaScript & TypeScript"
import { Sandbox } from '@e2b/code-interpreter'

const sbx = await Sandbox.create()
const execution = await sbx.runCode('print("Hello, world!")', { language: 'r' })
console.log(execution)
```

```python title="Python"
from e2b_code_interpreter import Sandbox

sbx = Sandbox.create()
execution = sbx.run_code('print("Hello, world!")', language="r")
print(execution)
```
</CodeGroup>
