Consoles: R and Python
The console spot holds R or Python. R runs on Ark, Positron's R kernel, or on plain R if you prefer. Python runs in IPython inside your project's uv environment.
R on Ark
When Ark is installed, the R console is Ark. Corral starts it and talks to it directly over the Jupyter protocol, with its own console written in Rust (3 MB). This is how it behaves:
- The prompt is
In [1]:, and...:on the lines that follow. Code from Ctrl+R arrives as one pasted block and shows complete at the prompt. - Enter runs the code when the expression is complete. If a parenthesis or a brace is still open, it moves to the next line, indented. Alt+Enter runs it anyway.
- ↑ ↓ go through the history; if you already typed something, only the entries that start the same. The history is saved in
~/.local/state/corral/historial-r.jsonl. - Tab completes with R's own completion: functions, arguments, columns after
$, packages. - Ctrl+C interrupts what is running, or clears what you typed. Ctrl+D on an empty line closes the console, like
q(). Ctrl+A, Ctrl+E, Ctrl+K, Ctrl+U, Ctrl+W and Ctrl+L work too. readline()andmenu()ask their questions in the console, as in R.?meanorhelp(mean)open the help in a browser window.- Variables, plots in Mirador,
View(),corral evaland the rest of Corral work the same as with plain R. Ark points some R options (the graphics device, the browser, the editor) at Positron's panes, which don't exist here; Corral's R file protects them withark.protected_optionsso they stay Corral's.
Why Ark
The gain is in the editor and in resources. Completion comes from the console's own R, so you don't need a second R for the language server. Measured with the same packages loaded (dplyr and ggplot2) and one plot, Ark takes about 330 MB with its language server included, plus about 6 MB for the console and the bridge. Plain R takes about 250 MB, plus about 450 MB for languageserver. At rest, Ark uses 0.1 % CPU and languageserver 3 %.
Install or update Ark
$ corral ark
$ corral ark --install
corral ark shows what is installed and whether the R console uses Ark. --install downloads Ark into ~/.local/share/corral/ark; without a version it installs 0.1.252, the one Corral was tested with. You can name another version (corral ark --install 0.1.252), and Corral uses the newest one installed.
Ark is still a 0.1 version, and Corral talks to its language server over an internal Positron channel (positron.lsp) that can change between versions. That is why corral ark --install installs the tested version. If a new version fails, corral config r_console r goes back to plain R.
Plain R
$ corral config r_console r
$ corral config r_console ark
The first goes back to plain R, the second to Ark. The change applies to the consoles you open afterwards. Without Ark installed, the console is plain R anyway. r_console also takes a command of your own.
Ark with jupyter-console
To use Ark through jupyter-console instead of Corral's console:
$ corral config ark_frontend jupyter
$ corral config ark_frontend corral
The second goes back to Corral's console. Corral writes its own kernel definition for Ark, so your Jupyter setup stays as it is. corral doctor tells you if jupyter-console is missing (uv tool install jupyter-console installs it).
Python in IPython
R is the default console. In a project with R and Python you don't choose up front: the console follows what you run.
- Ctrl+R or F5 in a
.pyfile show the Python console in place of the R one. The first time, they start it: IPython withuv run --with ipythonin the project folder, so it uses the project's environment (its.venvand its packages) without adding IPython to it. If the folder isn't a uv project, uv uses the.venvit finds, or a Python of its own. - Ctrl+R or F5 in a
.Rfile go back to R. ctrl+b y switches by hand. - The console you don't see keeps running in the "corral (oculto)" tab, with its variables. If you go to that tab, you can use it there as well.
- The variables pane, Mirador and
View()follow the console in view. The pane's header says which one, for example "R 4.6.1" or "Python 3.14.3".
The first start can take a few seconds while uv prepares the environment. Python needs uv. matplotlib figures go to Mirador (see Python figures), and View(df) opens pandas, polars or pyarrow tables.
Another Python command
To start the Python console with another command, for example with more packages:
$ corral config python_console 'CORRAL=1 uv run --with ipython --with polars ipython --no-banner -i ~/.local/share/corral-term/py/startup.py'
Keep -i …/py/startup.py at the end: that file switches Corral on inside IPython.
Use any pane as the console
In a pane where R or IPython runs, ctrl+b m marks it as the console and, if R or IPython is already open there, switches Corral on in it. It picks R or Python by what runs in the pane.
$ corral console
$ corral console --lang python
corral console does the same; --lang r|python sets the language and --pane names another pane. In R, you can also switch Corral on with corral_activate().
The Python console needs IPython: ctrl+b m on a python without IPython marks the pane, but doesn't switch Corral on.
Restart a console
If you quit the console with q() or exit(), its pane is left with a shell. The next Ctrl+R, F5, ctrl+b y or corral eval starts the console again in the same pane. The variables pane follows the new session.
After a restart of the Ark console, the editor's completion reconnects when Fresh starts the language server again: close and open the file, or restart Fresh.
Help in the browser
With Ark, ?mean or help(mean) open the help page in a browser window. Corral opens it with corral open, so it uses the same browser as Mirador (see CORRAL_BROWSER).