Why portable R?
Sometimes you need R somewhere you can’t run an installer. A CI runner that starts fresh on every build. A locked-down workstation without admin access. A USB drive you hand to a colleague. An application that ships R as a component the user never has to think about.
Python’s ecosystem has had tooling for this for years: PyInstaller, briefcase, Nuitka, and python-build-standalone from the Astral team all treat the runtime as something that can be bundled and relocated. R for Windows is well-positioned for the same approach. The R for Windows FAQ has acknowledged since at least the R 2.x era that “a basic R installation is relocatable,” and projects like R Portable on SourceForge and selkamand’s r-portable-windows have demonstrated the demand. What’s been missing is the automation: a build script you point at a version number and get a portable artifact from (Figure 1).
portable-r-windows provides exactly that, covering R 4.3.0 through 4.5.3 for both x64 and ARM64.
Getting started
Download a zip from GitHub Releases, extract it, and run Rscript.exe. Everything resolves to wherever you put it (Figure 2):
R.home() and the package library both resolve to the extraction directory.
Grab the zip for your architecture (replace 4.5.3 with any version from 4.3.0 onward), extract it, and you’re ready to go. Releases for all versions are at github.com/portable-r/portable-r-windows/releases.
PowerShell
Invoke-WebRequest -Uri "https://github.com/portable-r/portable-r-windows/releases/download/v4.5.3/portable-r-4.5.3-win-x64.zip" -OutFile portable-r.zip
Expand-Archive portable-r.zip -DestinationPath .curl (Windows 10+)
curl -fSLO https://github.com/portable-r/portable-r-windows/releases/download/v4.5.3/portable-r-4.5.3-win-x64.zip
tar -xf portable-r-4.5.3-win-x64.zipOnce extracted, R.home() points to wherever the folder landed and packages install into it:
.\portable-r-4.5.3-win-x64\bin\Rscript.exe -e "cat(R.home())"
:: C:/Users/you/Desktop/portable-r-4.5.3-win-x64
.\portable-r-4.5.3-win-x64\bin\Rscript.exe -e "install.packages('jsonlite'); library(jsonlite); cat(toJSON(list(works=TRUE)))"
:: {"works":true}Move the folder, rename it, delete it when you’re done.
The build
R for Windows is already relocatable at the runtime level. The build script (build.ps1) uses CRAN’s Inno Setup installer’s own silent-mode flags to extract R cleanly, then removes the installer artifacts (registry entries, uninstaller, shortcuts) and configures local library paths. No third-party tools needed. Full details are in the repository.
ARM64 builds
Experimental ARM64 builds are available for R 4.4.0 through 4.5.2, sourced from R’s experimental aarch64 builds and tested natively on GitHub Actions’ windows-11-arm runners. R core’s blog post on 64-bit ARM Windows provides background on where this effort stands.
Since CRAN does not yet distribute binary R packages for Windows ARM64, only pure-R packages (those without compiled code) will install out of the box. We also do not bundle Rtools, so source compilation of packages with C/C++/Fortran code requires a separate Rtools installation. Packaging a portable Rtools alongside portable R is an interesting possibility for the future, given that Rtools is already available for both x64 and aarch64.
Looking ahead
A relocatable R runtime opens the door to a category of tools that doesn’t quite exist yet in the R ecosystem. With portable R available as a downloadable artifact from a predictable URL for any version, the next step is tooling that automates the bundling: an application that downloads R on first launch, or a build system that packages R alongside a Shiny app into a single distributable. Projects like r-shiny-electron and COVAIL’s electron-quick-start have shown the appetite for this kind of thing.
One consideration that shapes this space: R is licensed under GPL-2 | GPL-3, which carries requirements around source availability and derivative works. Python, by comparison, uses the more permissive PSF License (and starting with 3.8.6, code examples are dual-licensed under PSF and Zero-Clause BSD). This is one reason RStudio Desktop and Positron ask users to download R separately rather than shipping it inside the IDE. A portable R that users or deployment scripts provision independently fits naturally into this model.
Fin
portable-r-windows is open source and available now at github.com/portable-r/portable-r-windows, with releases for R 4.3.0 through 4.5.3 across x64 and ARM64. The macOS counterpart is at github.com/portable-r/portable-r-macos and covered in the companion post.
References
- portable-r-windows: Source code and releases for this project.
- portable-r-macos: The macOS counterpart.
- R for Windows FAQ: Can I run R from a USB drive?: Official confirmation that Windows R is relocatable.
- R Portable (SourceForge): Portable R for Windows using the PortableApps.com framework.
- r-portable-windows (selkamand): Full R installation committed to Git. Currently at R 4.5.1.
- R on 64-bit ARM Windows (R core blog): Background on R’s ARM64 Windows support.
- Rtools: Compilation toolchain for building R packages from source on Windows.
- r-shiny-electron: Electron template for standalone Shiny applications.
- COVAIL electron-quick-start: Electron + bundled R for desktop Shiny apps.
- PyInstaller: Bundles Python applications into standalone executables.
- briefcase: BeeWare project. Packages Python apps for macOS, Windows, Linux, iOS, and Android.
- Nuitka: Python compiler that produces standalone executables.
- python-build-standalone: Pre-built, relocatable Python distributions by the Astral team.