Skip to content

Add a new repository to the list of repositories that pak uses to look for packages.

Usage

repo_add(..., .list = NULL)

repo_resolve(spec)

Arguments

...

Repository specifications, possibly named character vectors. See details below.

.list

List or character vector of repository specifications. This argument is easier to use programmatically than .... See details below.

spec

Repository specification, a possibly named character scalar.

Value

repo_resolve() returns a named character scalar, the URL of the repository.

Details

repo_add() adds new repositories. It resolves the specified repositories using repo_resolve() and then modifies the repos global option.

repo_add() only has an effect in the current R session. If you want to keep your configuration between R sessions, then set the repos option to the desired value in your user or project .Rprofile file.

Repository specifications

The format of a repository specification is a named or unnamed character scalar. If the name is missing, pak adds a name automatically. The repository named CRAN is the main CRAN repository, but otherwise names are informational.

Currently supported repository specifications:

  • URL pointing to the root of the CRAN-like repository. Example:

    https://cloud.r-project.org

  • RSPM@<date>, RSPM (RStudio Package Manager) snapshot, at the specified date.

  • RSPM@<package>-<version> RSPM snapshot, for the day after the release of <version> of <package>.

  • RSPM@R-<version> RSPM snapshot, for the day after R <version> was released.

  • MRAN@<date>, MRAN (Microsoft R Application Network) snapshot, at the specified date.

  • MRAN@<package>-<version> MRAN snapshot, for the day after the release of <version> of <package>.

  • MRAN@R-<version> MRAN snapshot, for the day after R <version> was released.

Notes:

  • See more about RSPM at https://packagemanager.rstudio.com/client/#/.

  • See more about MRAN snapshots at https://mran.microsoft.com/timemachine.

  • All dates (or times) can be specified in the ISO 8601 format.

  • If RSPM does not have a snapshot available for a date, the next available date is used.

  • Dates that are before the first, or after the last RSPM snapshot will trigger an error.

  • Dates before the first, or after the last MRAN snapshot will trigger an error.

  • Unknown R or package versions will trigger an error.

Exaples

repo_add(RSPMdplyr100 = "RSPM@dplyr-1.0.0")
repo_get()

#> # A data frame: 6 × 5                                                   
#>   name          url                                type  r_ver…¹ bioc_…²
#> * <chr>         <chr>                              <chr> <chr>   <chr>  
#> 1 CRAN          https://cloud.r-project.org        cran  *       NA     
#> 2 RSPMdplyr100  https://packagemanager.posit.co/c… cran… *       NA     
#> 3 BioCsoft      https://bioconductor.org/packages… bioc  4.2.2   3.16   
#> 4 BioCann       https://bioconductor.org/packages… bioc  4.2.2   3.16   
#> 5 BioCexp       https://bioconductor.org/packages… bioc  4.2.2   3.16   
#> 6 BioCworkflows https://bioconductor.org/packages… bioc  4.2.2   3.16   
#> # … with abbreviated variable names ¹​r_version, ²​bioc_version         

repo_resolve("MRAN@2020-01-21")

#>                                             CRAN                        
#> "https://cran.microsoft.com/snapshot/2020-01-21"                        

repo_resolve("RSPM@2020-01-21")

#>                                       CRAN                              
#> "https://packagemanager.posit.co/cran/245"                              

repo_resolve("MRAN@dplyr-1.0.0")

#>                                             CRAN                        
#> "https://cran.microsoft.com/snapshot/2020-05-30"                        

repo_resolve("RSPM@dplyr-1.0.0")

#>                                       CRAN                              
#> "https://packagemanager.posit.co/cran/289"                              

repo_resolve("MRAN@R-4.0.0")

#>                                             CRAN                        
#> "https://cran.microsoft.com/snapshot/2020-04-25"                        

repo_resolve("RSPM@R-4.0.0")

#>                                       CRAN                              
#> "https://packagemanager.posit.co/cran/276"                              

See also

Other repository functions: repo_get(), repo_status()