Developing a Lean IDE for R

Frank Harrell

Department of Biostatistics
Vanderbilt University School of Medicine
Nashville Tennessee USA

2026-12-03

Motivation

Several things made me want to take up the challenge of building a simple integrated development environment (IDE) for R:

  • RStudio at 1.9 GB and Positron at 2.3 GB on my MacBook seem to be quite bloated
  • They seem to always need updates
  • Software bundled with RStudio (e.g., pandoc and Quarto) are often not the latest versions
  • I don't use a lot of RStudio or Positron features

Motivation, continued

  • Positron is based on Visual Studio Code Editor which a lot of developers are finding is sluggish, and many have moved to the Zed editor (Zed is my second favorite)
  • I discovered a new favorite editor: the Cot Editor for MacOS
  • I wanted to see how far R itself can provide IDE functionality

Update

Since developing this talk I have found that Positron has most of the capabilities I'm seeking and have begun to use it more despite its large footprint. It has a graphics window similar to what is described below and is cleaner than RStudio in certain ways, e.g., not needing "projects" and being more command-line friendly when invoking Positron.

Approach

  • Collaboration with Claude Sonnet 5 to develop leanRide
  • github.com/harrelfe/rscripts
    • files: leanRide.r, leanRide.md, rchunks
    • Cot editor helper script installation file leanRide-cot.sh

Approach, continued

  • R packages/functions do most of the work
  • later: run an R loop in the background that listens for new code submissions from the editor
  • httpgd: graphics window in your browser with easy-to-navigate plot history and plot exporting.
  • Dynamic html help files are provided by base R if you know how to activate them
  • leanRide R functions are intended to be copied into ~/.Rprofile

User-Visible Functions

  • leanRide: start the interactive IDE
    • opens a browser window or tab for graphics
    • opens a browser window or tab for showing help files in html
    • starts listening for code that is sent from the editor to be run in a terminal window

User-Visible Functions, continued

  • vObjects: add a browser tab summarizing all the objects created in the global environment
    • or shows objects in other environments in the search path
    • by default does not list objects existing before leanRide() was run
  • vData: interactive viewing and searching data tables, frames, matrices
  • vPackages: check for package updates, and optionally update packages

Features Activated in Cot and MacOS Keyboard Shortcuts

  • Highlight any number of lines and hit Cmd-return to submit those lines to the R session you opened in the terminal
  • highlight any number of lines and hit Shift-Cmd-return to extract only R code & submit them to the R command line in the terminal
    • useful for .qmd, .Rmd, and .Rty documents

rchunks

  • Facilitated by shell script rchunks which can be run by Cot and Zed editors
    • comments out R code in chunks with eval=FALSE
    • numbers chunks and shows names for named ones
    • includes R inline code

HTML Viewing

  • Any method that produces html output will automatically open a new browser tab for viewing
  • Examples:
leanRide()
require(Hmisc)
options(prType='html')
contents(mydata)
describe(mydata)

HTML Viewing, continued

require(rms)
options(prType='html')
f <- orm(y ~ rcs(age, 4) * sex)
f
latex(f)   # automatic math rendering

Editor Availability

  • Cot (written in Swift) is not available for Windows or Linux
  • Available for all systems: Zed (written in Rust)
  • See leanRide.md for setup help

Quarto Preview

  • For scripts needing only light debugging: use an editor + quarto preview filename.qmd
  • Put this in the .qmd yaml header
execute:
  warning: false
  message: false
  cache: true

Summary

Whether or not others find leanRide useful, I found it a good learning exercise. On my system leanRide requires about 0.04GB of disk storage.

More Information

  • github/harrelfe/Rscripts
  • The acath.qmd script there is a good example to use with leanRide

Usage: marp --html leanRide.md

See https://www.hashbangcode.com/article/seven-tips-getting-most-out-marp https://yootheme.com/support/question/7348

**Statistical Computing Series<br>Department of Biostatistics** <p class="sm">2026-10-15</p>