rpx documentation

Run commands

Run R and other commands with the rpx project library activated.

Start R

Terminal
rpx run R

This starts R with the project library available, including the project package if installed. rpx sets R_LIBS_USER for the command so it uses the project library without changing your global R library.

Run scripts and tools

Pass a command and its arguments after rpx run:

Terminal
rpx run Rscript scripts/check.R
rpx run R CMD check .

rpx can run any executable with the project environment. It passes through the command's arguments, keeps your current working directory, and returns its exit status, making it suitable for scripts and CI.

Shell commands

rpx executes commands directly rather than starting a shell. Your calling shell can still interpret pipes and redirects, but rpx does not interpret shell syntax itself. To run a whole shell expression with the project environment, invoke a shell explicitly:

Terminal
rpx run sh -c 'Rscript scripts/check.R | tee check.log'

On Windows, use PowerShell or cmd /C for equivalent shell behavior.

Environment checks

Before starting a command, rpx checks that the lockfile matches the project configuration and current R version, and that its dependencies are installed at the expected versions. It does not install or update packages automatically.

If dependency declarations have changed, resolve them and synchronize the library:

Terminal
rpx lock
rpx sync

If the lockfile is current but installed dependencies are missing or at the wrong versions, run rpx sync before retrying the command.