A Modern R Workstation

You have probably seen this workflow, or lived it. RStudio on one half of the screen, ChatGPT on the other. Write some code, run it, get an error, copy the error, paste it into the chat, wait, copy the suggestion back, find the right line in the script, paste, run again. Fail. Repeat.

I have been in that loop, and I keep seeing it everywhere: biologists, statisticians, social scientists, across career stages. It is exhausting not because any single step is hard, but because every cycle drains a little more focus. After three or four rounds, you are not really thinking about your analysis anymore. You are thinking about the mechanics of moving text between windows.

And the loop is usually only part of it. The terminal is the default one, with no colors and no history search beyond pressing the up arrow over and over. There is no record of which R version is installed, or which package versions are in use. Getting R set up in the first place took the better part of an hour. These are all small things on their own, but together they add up to real inefficiencies. Sometimes it is worth pausing the analysis for an afternoon to improve the workflow that supports it.

This post walks through four things you can change (terminal, editor, environment, and AI workflow) that together remove a surprising amount of daily friction. Each one stands on its own, so take what fits. A companion repository has setup scripts for Linux (x64) and macOS (Apple Silicon) if you want to skip the manual configuration.

Companion resources:


Why these frictions matter more than they seem

There is a well-known finding in cognitive science: after a meaningful interruption, it takes roughly 23 minutes to fully recover deep focus (Mark et al., 2008). In the copy-paste workflow above, every cycle is at least two interruptions: once to leave the editor, once to come back. Do that a dozen times in a day and you have spent more time recovering focus than doing actual analysis.

A 2025 study by METR put numbers to what many people already suspected: experienced developers using disconnected AI tools for complex tasks were actually 19% slower than those working without AI entirely (METR, 2025). The suggestions were often fine. The problem was the overhead of manually shuttling context back and forth. The tool could not see the project. The developer had to bridge that gap every single time.

And there is a quality cost, too. An analysis of over 200 million lines of code found that direct code cloning (pasting AI-generated snippets without integrating them) rose 48% between 2021 and 2024 (GitClear, 2024). The copy-paste habit does not just slow you down; it tends to produce code that is harder to maintain later.

None of this is about blaming anyone for using the tools they have. The defaults most people start with are simply not very good, and better ones exist.


Fix the terminal first

This might sound like a strange place to start, but hear me out. The terminal is the one tool you use constantly: running scripts, installing packages, navigating directories, managing files. And the default experience on most systems is genuinely unhelpful. If you have ever spent two minutes mashing the up arrow trying to find a command you ran yesterday, you know the feeling.

Zsh with Oh My Zsh changes this more than you might expect. Zsh has been the default shell on macOS since 2019; on Linux it takes one package-manager command to install. Oh My Zsh is a framework that makes configuring it easy, with access to hundreds of community plugins.

Two plugins do most of the heavy lifting:

  • zsh-autosuggestions watches what you type and shows your most likely command as faded ghost text, pulled from your history. Start typing Rscript run_an... and the rest appears. Press the right arrow to accept. No more digging through history.
  • zsh-syntax-highlighting colors commands as you type them. Valid commands turn green; typos and bad paths turn red, before you hit Enter.

It takes about five minutes to set up, and it affects every terminal session from that point forward. The companion repository includes the exact steps and configuration.


Rethink your editor

RStudio has been the home of R development for over a decade, and it earned that position. The integrated console, the plot viewer, the data inspector: for a long time, nothing else came close for R-specific work.

But its architecture shows its age. The IDE is tightly coupled to a single R process: if a heavy computation crashes R, the whole interface often goes down with it. Support for other languages is limited. The extension ecosystem is small. And the options for integrating version control, remote development, or AI tools are narrower than what modern editors offer.

The approach I landed on is Visual Studio Code with Jupyter notebooks and an R kernel. If you have used Python notebooks before, the experience is almost identical: you open a .ipynb file, select the R kernel from the dropdown, and write R in notebook cells. Plots render inline in the cell output. No extra R-specific extensions are needed, no language server, no radian, no httpgd configuration. The R kernel itself comes from the conda environment described in the next section, so the editor setup and the environment setup reinforce each other.

One minor annoyance: VS Code will occasionally prompt you to install the R language server extension. You can safely ignore or dismiss this. The Jupyter kernel approach does not depend on it.

This gives you a few things RStudio does not:

  • One editor for everything. R, Python, SQL, shell scripts, Markdown, all in the same interface. No need to switch tools when your project spans multiple languages.
  • Git built in. Staging, diffing, branch management, and blame are all native. Extensions like GitLens add even more.
  • A real extension ecosystem. Remote development over SSH, container support, AI assistants, and hundreds of other tools that plug in directly.
  • Crash isolation. The notebook kernel runs as a separate process. If R crashes, VS Code stays up. Restart the kernel and keep going.

If you prefer a more RStudio-like experience but still want the benefits of a modern editor, Positron is worth a look. It is built by Posit (the company behind RStudio) on the same Code OSS foundation as VS Code, with native R and Python support out of the box.


Pin your environment

This one is invisible until it bites you. The typical R setup looks like this: install R once, install packages as you need them with install.packages(), and never think about versions. It is fast to get started, and it works fine until a collaborator tries to run your script, or you come back to a project after six months, or an update breaks something quietly.

The issue is structural. install.packages() writes everything to one global library. Update a package for Project A and you may silently break Project B. And without any record of the R version itself, "it works on my machine" is not a boast; it is the only guarantee you have.

Conda (and its faster drop-in replacement, Mamba) solves most of this in one place. A single environment.yml file can declare the exact R version, all R packages, Python if you need it, and even system-level libraries that would normally require a separate installation step (GDAL for geospatial work, Java for certain data imports, and many others). When someone else (or future-you) needs the same environment, one command rebuilds it from that file.

This is also what makes the notebook setup from the previous section work. The conda environment provides the R kernel (r-irkernel), so VS Code's Jupyter extension picks it up automatically. You do not install R system-wide or manage it separately. Each project can have its own isolated environment with its own R version, its own packages, and no risk of one project breaking another.

In practice, the workflow looks like this:

  1. Define your environment in an environment.yml file (R version, packages, kernel).
  2. Create the environment with mamba env create -f environment.yml.
  3. Open VS Code, select the kernel from that environment, and start working.
  4. Share the environment.yml with collaborators or commit it to version control. They run the same command and get the same setup.

The companion repository includes a ready-to-use environment.yml with a sensible default set of R packages, the Jupyter kernel, and instructions for both Linux and macOS.

Other tools exist for more specific needs or if you are already familiar with them: renv for R package isolation, rig for R version management, and Nix + rix for fully declarative, cryptographically pinned environments. Each has strengths depending on the scenario.


Stop copy-pasting code to the browser

This is where we come back to the loop from the opening. The problem is not using AI for help with code. That makes sense and is increasingly common. The problem is the workflow: copying errors to a browser tab, reading a suggestion in one window, pasting it into another, testing it, and repeating the whole thing when the fix does not quite work.

Agentic coding tools skip the middleman. These are AI assistants that run inside your editor or terminal. They can see your files, read error output, and suggest changes in context, sometimes even applying and testing them directly, with you reviewing each step. The human stays in control, but the copy-paste overhead vanishes.

The landscape here is moving fast, and I am deliberately not picking a winner. Some options worth knowing about:

  • GitHub Copilot — integrates into VS Code as an extension; inline suggestions plus chat.
  • ChatGPT Codex — OpenAI's agentic coding tool that can work directly with your codebase.
  • Claude Code — a terminal-based CLI that reads and edits your project directly.
  • Gemini Code Assist — similar approach, available as a VS Code extension.

What matters is not which tool you pick. What matters is whether the AI can see your project or not. A tool with workspace context will almost always be more useful than one that only sees whatever you paste into a text box.

This section is intentionally last. The terminal, editor, and environment improvements described above make a real difference on their own, regardless of whether you use AI tools, are allowed to, or want to. Many development tools and even search engines already use AI under the hood, so the line is blurrier than it seems. But adopting an explicit AI coding assistant is a deliberate choice, and it should come with a clear understanding of what that means.


A few things to keep in mind

Check your organization's guidelines. Many institutions have specific policies about which tools can be installed and which AI services can be used. None of the suggestions here override those, so make sure to review what applies in your context first.

Be careful with free-tier AI tools. Consumer-grade services often reserve the right to use your inputs (code, errors, prompts) as training data. If you work with sensitive data or in a regulated environment, that can be a real problem. Enterprise tiers with data processing agreements and no-retention guarantees are generally safer. Under the GDPR and similar frameworks, there may be additional compliance obligations depending on what data touches the AI.

Always review AI output. This is not a soft suggestion. AI coding tools, all of them regardless of provider or price, can produce outdated syntax, invented function names, subtle logic errors, or security issues. Treat every suggestion as a draft that needs careful human review before you act on it.


Getting started

The companion repository at reproducible-by-design/r-workstation includes setup scripts for Linux (x64) and macOS (Apple Silicon). Each piece can be installed independently:

  • Terminal — Zsh, Oh My Zsh, autosuggestions, syntax highlighting
  • Editor — VS Code with Jupyter extension and R kernel configuration
  • Environment — conda/mamba environment.yml with R, packages, and kernel ready to go
  • AI — configuration notes and extension recommendations (no tool pre-selected)

Start wherever the friction is worst. If you are not sure, start with the terminal. It takes five minutes and you will notice the difference immediately.


Checklist

  • ☐ Zsh is installed and set as your default shell
  • ☐ Oh My Zsh is installed with autosuggestions and syntax-highlighting plugins
  • ☐ Conda or Mamba is installed
  • ☐ A project environment.yml exists with R, packages, and the Jupyter kernel pinned
  • ☐ VS Code is set up with the Jupyter extension and your R kernel is selectable
  • ☐ The environment.yml is committed to version control
  • ☐ If using AI tools: an integrated assistant is configured in your editor or terminal
  • ☐ Organizational guidelines reviewed before adopting new tools
  • ☐ AI-generated output reviewed before use in any deliverable

Disclaimer. This post and the companion repository are provided for educational purposes only, "as-is," without warranty of any kind. The author assumes no responsibility for errors, omissions, or consequences arising from their use. Users are responsible for evaluating suitability in their own contexts, including compliance with applicable policies, regulations, and organizational guidelines.


References & Further reading

  • Mark, G., Gudith, D., & Klocke, U. (2008). The cost of interrupted work: More speed and stress. Proceedings of the SIGCHI Conference on Human Factors in Computing Systems, 107–110. DOI: 10.1145/1357054.1357072
  • METR. (2025). Measuring the Impact of Early-2025 AI on Experienced Open-Source Developer Productivity. arXiv:2507.09089
  • GitClear. (2024). Coding on Copilot: 2023 Data Suggests Downward Pressure on Code Quality (incl 2024 projections). Report
  • Conda — package, dependency, and environment management. Documentation
  • Mamba — a fast, drop-in replacement for Conda. Documentation
  • IRkernel — R kernel for Jupyter. Documentation
  • Ushey, K. (2023). renv: Project Environments for R. Documentation
  • r-lib. (2025). rig: The R Installation Manager. GitHub
  • Rodrigues, B. et al. (2023). rix: Reproducible Data Science Environments with Nix. rOpenSci
  • Oh My Zsh — a framework for managing Zsh configuration. Official site
  • zsh-autosuggestions. GitHub
  • zsh-syntax-highlighting. GitHub
  • Positron IDE by Posit. Official site
  • Jupyter Notebooks in VS Code. VS Code docs
  • Rodrigues, B. (2023). An overview of what's out there for reproducibility with R. Blog
  • R Consortium. (2025). In the Nix of Time: Creating a reproducible analytical environment with Nix and rix. Blog

Subscribe to Reproducible by Design

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
jamie@example.com
Subscribe