Alternative R 前端 — 一个使用 Rust 编写的现代 R 控制台
arf is a cross-platform R console written in Rust.
[!WARNING] arf is under active development. The configuration file format and history file format are not yet stable and may change without notice in future versions.
Ctrl+R; import from radian or .RhistoryAlt+- → ):help or :h — search across all installed packages:shell to enter, :r to return){version}, {cwd}, {status})Pre-built binaries are available from GitHub Releases.
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/eitsupi/arf/releases/latest/download/arf-console-installer.sh | shwinget install --id eitsupi.arfscoop bucket add r-bucket https://github.com/cderv/r-bucket.git
scoop install r-bucket/arfcargo binstall --git https://github.com/eitsupi/arf arf-consoleDownload the archive for your platform from GitHub Releases and extract the binary to a directory in your PATH.
brew install arfyay -S arf-bin
# or use paru
paru -S arf-bincargo install --git https://github.com/eitsupi/arf.git[!NOTE] For Windows: A fix for VT input handling (bracketed paste, etc.) is pending in an upstream dependency (crossterm#1030).
So installing from crates.io (
cargo install arf-console) is not recommended.
# Launch arf
arf
# Use a specific R version (requires rig)
arf --with-r-version 4.4
# Enable reprex mode for reproducible examples
arf --reprex=onPress :h or :help to open the fuzzy help browser:
─ Help Search [12345 topics] ─────────────────────────
Filter: mutate_
> dplyr::mutate Create, modify, and delete columns
dplyr::mutate_all Mutate multiple columns
dplyr::mutate_at Mutate multiple columns
dplyr::mutate_if Mutate multiple columns
─────────────────────────────────────────────────────
↑↓ navigate Tab/Enter select Esc exitarf extends R with : prefixed meta commands:
| Command | Description |
|---|---|
:help, :h |
Open interactive help browser |
:info, :session |
Show session information (version, config path, etc.) |
:shell |
Enter shell mode |
:r |
Return to R mode |
:system |
Execute a single shell command inline |
:reprex |
Set reprex mode (format requires the configured formatter) |
:switch |
Restart with different R version (requires rig) |
:restart |
Restart R session |
:cd [path] |
Change working directory (no args → home) |
:pushd |
Push current directory to stack and change to path |
:popd |
Pop directory from stack and change to it |
:history browse |
Browse and manage command history |
:history clear |
Clear command history (supports r, shell, all targets) |
:history schema |
Display history database schema and R examples |
:commands, :cmds |
Show available commands |
:quit, :exit |
Exit arf |
[!NOTE]
:switchkeeps the R-related environment variables you set before starting arf, apart fromR_HOMEandLD_LIBRARY_PATH, which are always removed.:restartleaves the environment untouched. See Switching and Restarting for details.
[!NOTE] Experimental: Enable the
experimental.shell_semicolon_shortcutoption to switch to shell mode by pressing;at an empty prompt — no:shellor Enter required (similar to Julia REPL behavior).
arf uses a TOML configuration file located at:
~/.config/arf/arf.toml~/Library/Application Support/arf/arf.toml%APPDATA%\arf\arf.tomlGenerate a default configuration with:
arf config init…See the full Configuration Guide for all options.
[!NOTE] This feature is experimental and may change in future versions.
Run R without a terminal and interact via IPC — useful for AI agents, CI, and editor extensions. Unlike MCP-based solutions that require R package installation and an MCP client, arf provides a single binary with a simple CLI for programmatic R access:
# Terminal 1: start headless R with `+` allowlisted for silent eval
arf headless --ipc-eval-allow-function '+'
# Terminal 2: silently evaluate R code (not shown, so `+` was allowlisted at startup)
arf ipc eval '1 + 1'
# Or show the code where a person can see it; visible eval needs no allowlist
arf ipc eval --visible '1 + 1'
# Get session info as JSON
arf ipc session | jq '.r.version'
# Shut down when done
arf ipc shutdownSee the full IPC & Headless Mode Guide for details.
Features in this section are under development and may change or be removed in future versions. Configure them under the [experimental] table and its subtables (e.g. [experimental.prompt_spinner]).
Select an R version per directory or project with experimental.r_source_overrides. Disabled by default. It can read a .r-version file or rv's rproject.toml; only the current directory is searched, and only R versions rig has already installed can be selected.
[experimental]
r_source_overrides = [
{ type = "version-file", file = ".r-version" },
{ type = "toml-key", file = "rproject.toml", key = "project.r_version" },
]See R Source Overrides configuration for provider options and resolution details.
An external tool can ask arf which R it would use, without starting R, with the experimental arf r resolve command.
Displays an animated spinner at the start of the line while R is evaluating code. Disabled by default.
To enable, set the frames option:
[experimental.prompt_spinner]
frames = "⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏" # Braille dots
color = "Cyan" # Spinner color (default: Cyan)See Spinner configuration for all options and frame style examples.
Show the completion menu automatically after typing a minimum number of characters, without requiring Tab.
[experimental]
completion_min_chars = 3 # Show completions after 3 charactersWhen not set, completion requires pressing Tab (the default behavior). This is similar to radian's complete_while_typing feature.
Use fuzzy matching for R code completions. When enabled, typing sf::geo can match sf::st_geometry and library(dpl can match dplyr. Disabled by default.
[experimental.r_completion]
fuzzy = trueBoth :: (exported names) and ::: (internal names) are supported. Package exports are cached per-package with a 5-minute TTL for performance.
See Fuzzy R Completion configuration for the package_functions option and other details.
Automatically remove commands that produced errors from history. Similar to fish's sponge plugin.
[experimental.history_forget]
enabled = true
delay = 2 # Keep last N failed commands for quick retry
on_exit_only = false # Purge on each prompt (false) or only on exit (true)See History forget configuration for all options.
[!CAUTION] These features are experimental and have not been thoroughly tested. The format and behavior may change in future versions.
Export both R and shell history to a unified SQLite file for backup or transfer:
# Export to a unified file
arf history export --file ~/arf_backup.db
# Export with custom table names
arf history export --file ~/arf_backup.db --r-table my_r --shell-table my_shellOptions:
| Option | Description |
|---|---|
--file |
Path to output SQLite file (required) |
--r-table |
Table name for R history (default: r) |
--shell-table |
Table name for shell history (default: shell) |
Import command history from radian, R's native .Rhistory, or another arf database:
…Options:
| Option | Description |
|---|---|
--from |
Source format: radian, r, or arf (required) |
--file |
Path to source file (required for arf, defaults to standard locations for others) |
--hostname |
Custom hostname to mark imported entries |
--dry-run |
Preview without importing |
--import-duplicates |
Import duplicate entries instead of skipping them |
--unified |
Force unified file mode (import both R and shell from table names) |
--r-table |
Table name for R history in unified file (default: r) |
--shell-table |
Table name for shell history in unified file (default: shell) |
Supported sources:
| Source | Description | Timestamps | Multiline | Mode routing |
|---|---|---|---|---|
radian |
~/.radian_history |
Preserved | Preserved | By # mode: |
r |
.Rhistory or R_HISTFILE |
- | - | → r.db |
arf |
SQLite database (--file required) |
Preserved | Preserved | By filename or --unified |
Mode routing for arf format:
r.db or shell.db: Single-database import (by filename)--unified flag: Unified import (by table names, imports both R and shell)Notes:
--import-duplicates to import all entries regardless.options(error = ...)arf uses R's options(error = ...) to detect errors from packages like dplyr/rlang that output error messages to stdout instead of stderr. This is necessary for accurate error tracking in command history and the status indicator.
Limitations:
options(error = ...), arf will chain to your handler, but arf's handler takes precedence. Your hand暂无开放 Issues,或尚未同步最近议题。