Skip to contents

Emits or installs the R code lines that point options(repos) at a Posit Package Manager binary repository. With dry_run = TRUE (the default), the lines are returned without touching any file, so the user can review them before applying.

Usage

use_ppm(
  scope = c("user", "project"),
  platform = NULL,
  repo = "cran",
  dry_run = TRUE,
  path = NULL
)

Arguments

scope

"user" edits the user .Rprofile, "project" edits the current project .Rprofile.

platform

Platform specification accepted by resolve_platform().

repo

Repository name.

dry_run

If TRUE, return the lines that would be written without editing files.

path

Optional explicit .Rprofile path.

Value

The configuration lines, invisibly when written.

Examples

use_ppm("user", platform = "ubuntu-22.04", dry_run = TRUE)
#> [1] "options("                                                                  
#> [2] "  repos = c("                                                              
#> [3] "    CRAN = \"https://packagemanager.posit.co/cran/__linux__/jammy/latest\""
#> [4] "  )"                                                                       
#> [5] ")"                                                                         

if (FALSE) { # \dontrun{
# Actually writes to the user .Rprofile:
use_ppm("user", platform = "ubuntu-22.04", dry_run = FALSE)
} # }