### Manage Package Repositories Source: https://context7.com/r-lib/rig/llms.txt Commands for setting up and managing package repositories. Use 'setup' to configure repositories for R installations, optionally specifying R versions or specific/excluded repositories. ```bash rig repos setup ``` ```bash rig repos setup --r-version 4.3.2 ``` ```bash rig repos setup --with-repos=bioc-release ``` ```bash rig repos setup --without-repos=p3m ``` -------------------------------- ### Build signed macOS packages Source: https://github.com/r-lib/rig/blob/main/tools/RELEASE.md Environment setup and build commands for creating notarized macOS installers. ```bash export AC_PASSWORD=... export TEAM_ID=... sudo xcode-select -s /Applications/Xcode.app/Contents/Developer rm -rf target make clean make macos ``` -------------------------------- ### Install rig on Windows via WinGet Source: https://github.com/r-lib/rig/blob/main/README.md Use the WinGet package manager to install rig on Windows 10 and above. ```bash winget install posit.rig ``` -------------------------------- ### Install rig on OpenSUSE and SLES Source: https://github.com/r-lib/rig/blob/main/README.md Use zypper to install the RPM package, allowing unsigned packages. ```bash `which sudo` zypper install -y --allow-unsigned-rpm https://github.com/r-lib/rig/releases/download/latest/r-rig-latest-1.$(arch).rpm ``` -------------------------------- ### Install rig with Scoop on Windows Source: https://github.com/r-lib/rig/blob/main/README.md Install rig using Scoop on Windows by first adding the 'r-bucket' and then installing the 'rig' package. You may need to restart your terminal after installation. ```powershell scoop bucket add r-bucket https://github.com/cderv/r-bucket.git scoop install rig ``` -------------------------------- ### Install R versions with rig add Source: https://context7.com/r-lib/rig/llms.txt Use these commands to install specific R versions or symbolic versions like release and devel. Options allow for customizing package manager installation, repository setup, and platform-specific configurations. ```bash # Install the latest release version of R rig add release # Install a specific R version rig add 4.3.2 # Install R development version rig add devel # Install the next version (alpha/beta/rc during release process, or patched otherwise) rig add next # Install without pak package manager rig add release --without-pak # Install with specific pak version (stable, rc, or devel) rig add 4.3.1 --pak-version devel # Install without setting up repositories rig add release --without-repos # Install without P3M (Posit Package Manager) rig add release --without-p3m # macOS: Install specific architecture rig add release --arch arm64 rig add release --arch x86_64 # Windows: Install without message translations rig add release --without-translations # Windows: Install with desktop icon rig add release --with-desktop-icon ``` -------------------------------- ### Install rig on Ubuntu and Debian Source: https://github.com/r-lib/rig/blob/main/README.md Add the repository key and source list before installing the r-rig package via apt. ```bash `which sudo` curl -L https://rig.r-pkg.org/deb/rig.gpg -o /etc/apt/trusted.gpg.d/rig.gpg ``` ```bash `which sudo` sh -c 'echo "deb http://rig.r-pkg.org/deb rig main" > /etc/apt/sources.list.d/rig.list' ``` ```bash `which sudo` apt update `which sudo` apt install r-rig ``` -------------------------------- ### Install rig with Chocolatey on Windows Source: https://github.com/r-lib/rig/blob/main/README.md Install rig on Windows using Chocolatey. This is useful for environments like GitHub Actions. ```powershell choco install rig ``` -------------------------------- ### Install rig on RHEL, Fedora, Rocky, and AlmaLinux Source: https://github.com/r-lib/rig/blob/main/README.md Install the latest RPM package directly using yum. ```bash `which sudo` yum install -y https://github.com/r-lib/rig/releases/download/latest/r-rig-latest-1.$(arch).rpm ``` -------------------------------- ### Install rig on Linux via tarball Source: https://github.com/r-lib/rig/blob/main/README.md Download and extract the latest release directly to /usr/local. ```bash curl -Ls https://github.com/r-lib/rig/releases/download/latest/rig-linux-$(arch)-latest.tar.gz | `which sudo` tar xz -C /usr/local ``` -------------------------------- ### Shell Scripting Examples with JSON Output Source: https://context7.com/r-lib/rig/llms.txt Examples demonstrating how to capture rig command output in shell variables using JSON parsing with 'jq'. Useful for automating R version checks and management. ```bash DEFAULT_R=$(rig default --json | jq -r '.name') ``` ```bash VERSIONS=$(rig list --json | jq -r '.[].name') ``` ```bash if rig list --plain | grep -q "4.3.2"; then echo "R 4.3.2 is installed" fi ``` -------------------------------- ### System Administration Commands Source: https://context7.com/r-lib/rig/llms.txt Manage system-level R installations, links, and platform-specific configurations. ```bash # Create R-* quick links (e.g., R-4.3, R-4.2) rig system make-links # Set up automatic user package libraries rig system setup-user-lib rig system setup-user-lib 4.3.2 # For specific version # Install or update pak for R versions rig system add-pak # Default R version rig system add-pak 4.3.2 # Specific version rig system add-pak --all # All installed versions rig system add-pak --pak-version devel # Development pak # Detect current platform (Linux) rig system detect-platform # Output: # distro: ubuntu # version: 22.04 # arch: x86_64 # Detect platform as JSON rig system detect-platform --json # macOS-specific commands: rig system make-orthogonal # Make R versions orthogonal rig system fix-permissions # Restrict system library to admin rig system forget # Remove R from system package database rig system no-openmp # Configure for Apple compilers rig system allow-debugger # Enable lldb/gdb debugging rig system allow-debugger-rstudio # Enable RStudio debugging rig system allow-core-dumps # Enable core dumps on crash ``` -------------------------------- ### Launch Rig macOS Application Source: https://github.com/r-lib/rig/blob/main/README.md Start the Rig menu bar application from the terminal. ```bash open -a Rig ``` -------------------------------- ### Install rig with Homebrew on macOS Source: https://github.com/r-lib/rig/blob/main/README.md Use this command to install rig on macOS if you are using Homebrew. Ensure you only install rig with one Homebrew version (Intel or Arm). ```sh brew tap r-lib/rig brew install --cask rig ``` -------------------------------- ### List installed R versions with rig list Source: https://context7.com/r-lib/rig/llms.txt Display installed R versions in table, JSON, or plain text formats. The JSON output is particularly useful for programmatic access in scripts. ```bash # List installed R versions in table format rig list # Output: # * name version aliases # ------------------------------------------ # 4.2.3 oldrel # * 4.3.2 release # devel (R 4.4.0) # List with JSON output for scripting rig list --json # Output: # [ # { # "name": "4.3.2", # "default": true, # "version": "4.3.2", # "aliases": ["release"], # "path": "/Library/Frameworks/R.framework/Versions/4.3", # "binary": "/Library/Frameworks/R.framework/Versions/4.3/Resources/bin/R" # } # ] # List only version names (useful for scripts) rig list --plain # Output: # 4.2.3 # 4.3.2 # devel ``` -------------------------------- ### Platform-Specific Build Commands Source: https://github.com/r-lib/rig/blob/main/CLAUDE.md Makefile targets for generating platform-specific installers and cleaning build artifacts. ```makefile make macos # Build macOS packages (arm64 and x86_64) make win # Build Windows installer make linux # Build Linux packages (tar.gz, .deb, .rpm) make linux-in-docker # Build Linux packages in Docker make clean # Clean build artifacts ``` -------------------------------- ### List Packages in Repository Source: https://context7.com/r-lib/rig/llms.txt List packages available in a configured repository. Use 'package-info' to get details about a specific package and 'package-versions' to list all available versions. ```bash rig repos package-list ``` ```bash rig repos package-info dplyr ``` ```bash rig repos package-info dplyr --version 1.1.0 ``` ```bash rig repos package-info ggplot2 --json ``` ```bash rig repos package-versions tidyr ``` ```bash rig repos package-versions tidyr --json ``` -------------------------------- ### System Administration Commands Source: https://context7.com/r-lib/rig/llms.txt The `rig system` subcommands provide tools for system-level management of R installations, including creating links, setting up libraries, installing tools like 'pak', and configuring R for specific environments or debugging. ```APIDOC ## System Administration Commands The `rig system` subcommands manage R installations at the system level. ```bash # Create R-* quick links (e.g., R-4.3, R-4.2) rig system make-links # Set up automatic user package libraries rig system setup-user-lib rig system setup-user-lib 4.3.2 # For specific version # Install or update pak for R versions rig system add-pak # Default R version rig system add-pak 4.3.2 # Specific version rig system add-pak --all # All installed versions rig system add-pak --pak-version devel # Development pak # Detect current platform (Linux) rig system detect-platform # Output: # distro: ubuntu # version: 22.04 # arch: x86_64 # Detect platform as JSON rig system detect-platform --json # macOS-specific commands: rig system make-orthogonal # Make R versions orthogonal rig system fix-permissions # Restrict system library to admin rig system forget # Remove R from system package database rig system no-openmp # Configure for Apple compilers rig system allow-debugger # Enable lldb/gdb debugging rig system allow-debugger-rstudio # Enable RStudio debugging rig system allow-core-dumps # Enable core dumps on crash ``` ``` -------------------------------- ### Manage Rtools on Windows Source: https://context7.com/r-lib/rig/llms.txt Commands for managing Rtools installations and registry entries on Windows. Use these to update, list, install, or remove Rtools versions. ```bash rig system clean-registry ``` ```bash rig system update-rtools40 ``` ```bash rig system rtools list ``` ```bash rig system rtools add 44 ``` ```bash rig system rtools rm 42 ``` -------------------------------- ### Manage R versions with rig Source: https://github.com/r-lib/rig/blob/main/NEWS.md Commands for resolving and installing the next available version of R. ```bash rim resolve next rim add next ``` -------------------------------- ### List available R versions with rig available Source: https://context7.com/r-lib/rig/llms.txt Check which R versions are available for installation on the current platform. Includes options for listing distributions and Rtools versions. ```bash # List available R versions (recent releases only) rig available # Output: # name version release date type # ------------------------------------------ # devel 4.4.0 devel # next 4.3.2 2023-10-31 next # release 4.3.2 2023-10-31 release # 4.2.3 4.2.3 2023-03-15 release # 4.1.3 4.1.3 2022-03-10 release # 4.0.5 4.0.5 2021-03-31 release # 3.6.3 3.6.3 2020-02-29 release # List all available versions including patch releases rig available --all # Get available versions as JSON rig available --json # List available versions for a specific platform rig available --platform linux-ubuntu-22.04 # List supported Linux distributions rig available --list-distros # Output: # name version id PPM retired eol # ------------------------------------------------------------------------------- # Debian 12 debian-12 true false 2028-06-30 # Ubuntu 22.04 ubuntu-22.04 true false 2027-04-01 # Fedora 38 fedora-38 false false 2024-05-14 # List available Rtools versions (Windows) rig available --list-rtools-versions # Output: # version from R to R URL # -------------------------------------------------------------- # 44 4.4.0 4.4.x https://github.com/r-hub/rtools44/... ``` -------------------------------- ### Upgrade rig with Chocolatey on Windows Source: https://github.com/r-lib/rig/blob/main/README.md Upgrade an existing rig installation to the latest version using Chocolatey on Windows. ```powershell choco upgrade rig ``` -------------------------------- ### Start RStudio with Specific R Version Source: https://context7.com/r-lib/rig/llms.txt Launch RStudio configured to use a specific R version, optionally opening projects or lock files. ```bash # Start RStudio with default R version rig rstudio # Start RStudio with a specific R version rig rstudio 4.2.3 # Open a project with specific R version rig rstudio 4.3.2 /path/to/project.Rproj # Open a directory (rig finds the .Rproj file) rig rstudio 4.3.2 /path/to/project/ # Open an renv project (R version auto-detected from renv.lock) rig rstudio /path/to/renv-project/ # Open renv.lock directly rig rstudio /path/to/renv.lock ``` -------------------------------- ### Test local Chocolatey package Source: https://github.com/r-lib/rig/blob/main/tools/RELEASE.md Commands to uninstall, install, and verify the local Chocolatey package. ```bash gsudo choco uninstall rig gsudo choco install rig --source . rig --version rig ls rig available ``` -------------------------------- ### Update rig with Homebrew on macOS Source: https://github.com/r-lib/rig/blob/main/README.md Run this command to update rig to the latest version when installed via Homebrew on macOS. ```sh brew upgrade --cask rig ``` -------------------------------- ### Starting RStudio with Specific R Version Source: https://context7.com/r-lib/rig/llms.txt The `rig rstudio` command opens RStudio, allowing you to specify which R version to use. It can also open RStudio with a specific project file or directory. ```APIDOC ## Starting RStudio with Specific R Version The `rig rstudio` command opens RStudio with a specific R version, optionally opening a project. ```bash # Start RStudio with default R version rig rstudio # Start RStudio with a specific R version rig rstudio 4.2.3 # Open a project with specific R version rig rstudio 4.3.2 /path/to/project.Rproj # Open a directory (rig finds the .Rproj file) rig rstudio 4.3.2 /path/to/project/ # Open an renv project (R version auto-detected from renv.lock) rig rstudio /path/to/renv-project/ # Open renv.lock directly rig rstudio /path/to/renv.lock ``` ``` -------------------------------- ### Basic Bats Test File Example Source: https://github.com/r-lib/rig/blob/main/tests/bats/README.md A Bats test file is a Bash script with special syntax for defining test cases. Each test case is a function with a description, and passes if all commands within it exit with a 0 status code. ```bash #!/usr/bin/env bats @test "addition using bc" { result="$(echo 2+2 | bc)" [ "$result" -eq 4 ] } @test "addition using dc" { result="$(echo 2 2+p | dc)" [ "$result" -eq 4 ] } ``` -------------------------------- ### Manage macOS System Requirements Source: https://context7.com/r-lib/rig/llms.txt Commands for managing R-related system libraries on macOS. Use 'list' to see available tools, 'info' for details, and 'add' to install them. ```bash rig sysreqs list ``` ```bash rig sysreqs list --json ``` ```bash rig sysreqs info openssl ``` ```bash rig sysreqs info gfortran --json ``` ```bash rig sysreqs add openssl ``` ```bash rig sysreqs add gfortran ``` ```bash rig sysreqs add openssl --arch arm64 ``` ```bash rig sysreqs add openssl --arch x86_64 ``` -------------------------------- ### Remove R versions with rig rm Source: https://context7.com/r-lib/rig/llms.txt Remove one or more installed R versions. User package libraries remain intact after removal. ```bash # Remove a specific R version rig rm 4.2.3 # Remove multiple versions at once rig rm 4.1.0 4.1.1 4.1.2 # Remove using symbolic names rig rm oldrel # Remove the development version rig rm devel ``` -------------------------------- ### List Configured Repositories Source: https://context7.com/r-lib/rig/llms.txt List configured CRAN and other package repositories. Use the --all flag to include non-default repositories and --r-version to filter by R version. ```bash rig repos list ``` ```bash rig repos list --all ``` ```bash rig repos list --r-version 4.3.2 ``` ```bash rig repos list --json ``` -------------------------------- ### Manage R versions with rig Source: https://github.com/r-lib/rig/blob/main/README.md Basic commands for adding, listing, and setting the default R version. ```bash rig add release ``` ```bash rig list rig default ``` ```bash rig rig --help rig --help ``` -------------------------------- ### Render README documentation Source: https://github.com/r-lib/rig/blob/main/tools/RELEASE.md Command to generate the README file from its R Markdown source. ```bash Rscript -e 'rmarkdown::render("README.Rmd")' ``` -------------------------------- ### Testing Procedures Source: https://github.com/r-lib/rig/blob/main/CLAUDE.md Commands for running Rust integration tests, BATS shell tests, and Docker-based Linux tests. ```bash # Rust integration tests cargo test # Platform-specific shell tests (BATS) bats tests/test-macos.sh bats tests/test-linux.sh bats tests/test-windows.sh # Docker-based Linux tests make linux-test-all make linux-test-ubuntu-22.04 # or other distro names ``` -------------------------------- ### Manage Package Libraries Source: https://context7.com/r-lib/rig/llms.txt Manage multiple user package libraries for different R versions. ```bash # List all libraries for the current R version rig library list # Output: # main (default) # testing # production # List libraries as JSON rig library list --json # Output: # [ # { # "rversion": "4.3.2", # "name": "main", # "path": "/Users/user/Library/R/arm64/4.3/library", # "default": true # }, # { # "rversion": "4.3.2", # "name": "testing", # "path": "/Users/user/Library/R/arm64/4.3/library/__testing", # "default": false # } # ] # Add a new library rig library add testing rig library add production # Set the default library rig library default testing # Print current default library rig library default # Output: testing # Remove a library (cannot remove main or current default) rig library rm testing ``` -------------------------------- ### List R Versions in Docker Source: https://github.com/r-lib/rig/blob/main/README.md Execute the rig list command within the official rig Docker container. ```bash > docker run ghcr.io/r-lib/rig/r rig ls ``` -------------------------------- ### Build and Lint Commands Source: https://github.com/r-lib/rig/blob/main/CLAUDE.md Standard Cargo commands for development, release builds, testing, and code quality checks. ```bash # Development build cargo build # Release build cargo build --release # Run tests cargo test # Format code cargo fmt # Lint code cargo clippy ``` -------------------------------- ### Update rig with Scoop on Windows Source: https://github.com/r-lib/rig/blob/main/README.md Update rig to the latest version using Scoop on Windows with this command. ```powershell scoop update rig ``` -------------------------------- ### Managing Package Libraries Source: https://context7.com/r-lib/rig/llms.txt The `rig library` command is an experimental feature for managing multiple user package libraries for different R versions. It allows listing, adding, setting default, and removing libraries. ```APIDOC ## Managing Package Libraries The `rig library` command manages multiple user package libraries (experimental feature). ```bash # List all libraries for the current R version rig library list # Output: # main (default) # testing # production # List libraries as JSON rig library list --json # Output: # [ # { # "rversion": "4.3.2", # "name": "main", # "path": "/Users/user/Library/R/arm64/4.3/library", # "default": true # }, # { # "rversion": "4.3.2", # "name": "testing", # "path": "/Users/user/Library/R/arm64/4.3/library/__testing", # "default": false # } # ] # Add a new library rig library add testing rig library add production # Set the default library rig library default testing # Print current default library rig library default # Output: testing # Remove a library (cannot remove main or current default) rig library rm testing ``` ``` -------------------------------- ### Running Bats Tests Source: https://github.com/r-lib/rig/blob/main/tests/bats/README.md This command executes Bats tests in TAP (Test Anything Protocol) format. Ensure your test files are located in the 'test' directory. ```sh bin/bats --tap test ``` -------------------------------- ### Push Chocolatey package Source: https://github.com/r-lib/rig/blob/main/tools/RELEASE.md Command to submit the generated nupkg file to the Chocolatey repository. ```bash choco push rig.*.nupkg --source https://push.chocolatey.org/ ``` -------------------------------- ### Resolve Symbolic R Versions Source: https://context7.com/r-lib/rig/llms.txt Translate symbolic names like 'release' or 'devel' into specific version numbers and download URLs. ```bash # Resolve the 'release' symbolic name rig resolve release # Output: 4.3.2 https://cloud.r-project.org/bin/macosx/big-sur-arm64/base/R-4.3.2-arm64.pkg # Resolve development version rig resolve devel # Resolve for a specific platform rig resolve release --platform linux-ubuntu-22.04 # Resolve with JSON output rig resolve release --json # Output: # [ # { # "version": "4.3.2", # "url": "https://cloud.r-project.org/bin/macosx/big-sur-arm64/base/R-4.3.2-arm64.pkg", # "arch": "arm64", # "ppm": true, # "ppmurl": "https://packagemanager.posit.co/cran/..." # } # ] # macOS: Resolve for specific architecture rig resolve release --arch x86_64 ``` -------------------------------- ### JSON Output for Scripting Source: https://context7.com/r-lib/rig/llms.txt Utilize the --json flag with any rig command for scriptable output. This is useful for integrating rig into automation tools and shell scripts. ```bash rig --json list ``` ```bash rig --json default ``` ```bash rig --json available ``` ```bash rig list --json ``` ```bash rig resolve release --json ``` ```bash rig library list --json ``` -------------------------------- ### Run R with Specific Versions Source: https://context7.com/r-lib/rig/llms.txt Execute R sessions, scripts, or applications using a targeted R version. ```bash # Start R interactively with the default version rig run # Start R with a specific version rig run --r-version 4.2.3 # Evaluate an R expression rig run -e "print(R.version.string)" # Output: [1] "R version 4.3.2 (2023-10-31)" # Run an R script rig run -f script.R # Run a script with arguments rig run -f analysis.R -- --input data.csv --output results.csv # Run a script from a package's exec directory rig run pak::pkgdepends_test # Run a Shiny app (auto-detected from app.R or server.R) rig run ./my-shiny-app/ # Run a Plumber API (auto-detected from plumber.R) rig run ./my-api/ # Run a Quarto document rig run ./my-report/ # Run with explicit app type rig run ./project/ --app-type shiny rig run ./project/ --app-type api rig run ./project/ --app-type quarto-shiny rig run ./project/ --app-type rmd-static # Dry run - show command without executing rig run -e "1+1" --dry-run # Output: "/Library/Frameworks/R.framework/.../R" ["-q", "--slave", "-e", "1+1", "--args"] # Show R startup message rig run --startup # Suppress echo (quiet mode) rig run --no-echo ``` -------------------------------- ### Running R with Specific Versions Source: https://context7.com/r-lib/rig/llms.txt The `rig run` command allows you to execute R code, scripts, or applications using a specified R version. It supports interactive sessions, expression evaluation, script execution, and running R-based applications like Shiny or Plumber. ```APIDOC ## Running R with Specific Versions The `rig run` command runs R, R scripts, or R applications using a specified R version. ```bash # Start R interactively with the default version rig run # Start R with a specific version rig run --r-version 4.2.3 # Evaluate an R expression rig run -e "print(R.version.string)" # Output: [1] "R version 4.3.2 (2023-10-31)" # Run an R script rig run -f script.R # Run a script with arguments rig run -f analysis.R -- --input data.csv --output results.csv # Run a script from a package's exec directory rig run pak::pkgdepends_test # Run a Shiny app (auto-detected from app.R or server.R) rig run ./my-shiny-app/ # Run a Plumber API (auto-detected from plumber.R) rig run ./my-api/ # Run a Quarto document rig run ./my-report/ # Run with explicit app type rig run ./project/ --app-type shiny rig run ./project/ --app-type api rig run ./project/ --app-type quarto-shiny rig run ./project/ --app-type rmd-static # Dry run - show command without executing rig run -e "1+1" --dry-run # Output: "/Library/Frameworks/R.framework/.../R" ["-q", "--slave", "-e", "1+1", "--args"] # Show R startup message rig run --startup # Suppress echo (quiet mode) rig run --no-echo ``` ``` -------------------------------- ### Update winget package Source: https://github.com/r-lib/rig/blob/main/tools/RELEASE.md Command to update the winget package using the komac tool. ```bash VERSION=x.y.z komac update --identifier 'Posit.rig' --version "$VERSION" \ --urls "https://github.com/r-lib/rig/releases/download/v${VERSION}/rig-windows-${VERSION}.exe" \ --submit ``` -------------------------------- ### Set default R version with rig default Source: https://context7.com/r-lib/rig/llms.txt Manage the default R version used by the system and RStudio. Supports setting by version number or symbolic alias. ```bash # Print the current default R version rig default # Output: 4.3.2 # Set a specific version as default rig default 4.3.2 # Set using symbolic names rig default release rig default oldrel # Get default version as JSON rig default --json # Output: # { # "name": "4.3.2" # } ``` -------------------------------- ### Resolving Symbolic R Versions Source: https://context7.com/r-lib/rig/llms.txt The `rig resolve` command translates symbolic version names (like 'release' or 'devel') into actual version numbers and download URLs. It supports specifying platforms and output formats. ```APIDOC ## Resolving Symbolic R Versions The `rig resolve` command translates symbolic version names to actual version numbers and download URLs. ```bash # Resolve the 'release' symbolic name rig resolve release # Output: 4.3.2 https://cloud.r-project.org/bin/macosx/big-sur-arm64/base/R-4.3.2-arm64.pkg # Resolve development version rig resolve devel # Resolve for a specific platform rig resolve release --platform linux-ubuntu-22.04 # Resolve with JSON output rig resolve release --json # Output: # [ # { # "version": "4.3.2", # "url": "https://cloud.r-project.org/bin/macosx/big-sur-arm64/base/R-4.3.2-arm64.pkg", # "arch": "arm64", # "ppm": true, # "ppmurl": "https://packagemanager.posit.co/cran/..." # } # ] # macOS: Resolve for specific architecture rig resolve release --arch x86_64 ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.