Run R Code
Use the runCode/run_code method to run R code inside the sandbox. Pass the language parameter with value r.
JavaScript/TypeScript Example:
javascript
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 Example:
python
from e2b_code_interpreter import Sandbox
sbx = Sandbox()
execution = sbx.run_code('print("Hello, world!")', language='r')
print(execution)