### Example usage of pkg_cache functions Source: https://r-lib.github.io/pkgcache/reference/pkg_cache_api.html Example calls to the pkg_cache_* functions, wrapped in if (FALSE) to prevent execution. It shows how to summarize, list, find, get, and delete files in the cache. ```R if (FALSE) { pkg_cache_summary() pkg_cache_list() pkg_cache_find(package = "forecast") tmp <- tempfile() pkg_cache_get_file(target = tmp, package = "forecast", version = "8.10") pkg_cache_delete_files(package = "forecast") } ``` -------------------------------- ### Example output of ppm_platforms Source: https://r-lib.github.io/pkgcache/reference/ppm_platforms.html An example showing the data frame structure returned by calling ppm_platforms(). ```R ppm_platforms() #> # A data frame: 35 × 7 #> name os binary_url distribution release binaries platforms #> #> 1 centos7 linux centos7 centos 7 TRUE #> 2 centos8 linux centos8 centos 8 TRUE #> 3 rhel9 linux rhel9 rockylinux 9 TRUE #> 4 rhel10 linux rhel10 rockylinux 10 TRUE #> 5 opensuse15 linux opensuse15 opensuse 15 TRUE #> 6 opensuse152 linux opensuse1… opensuse 15.2 TRUE #> 7 opensuse153 linux opensuse1… opensuse 15.3 TRUE #> 8 opensuse154 linux opensuse1… opensuse 15.4 TRUE #> 9 opensuse155 linux opensuse1… opensuse 15.5 TRUE #> 10 opensuse156 linux opensuse1… opensuse 15.6 TRUE #> # ℹ 25 more rows ``` -------------------------------- ### Install development version of pkgcache from GitHub Source: https://r-lib.github.io/pkgcache/reference/pkgcache-package.html Installs the development version of pkgcache from GitHub using pak::pak(). ```r pak::pak("r-lib/pkgcache") ``` -------------------------------- ### Example of current_r_platform() and default_platforms() output Source: https://r-lib.github.io/pkgcache/reference/current_r_platform.html Example calls showing the detected platform and default platforms for a Linux session. The output includes the platform string and the 'source' default. ```r current_r_platform() #> [1] "x86_64-pc-linux-gnu-ubuntu-24.04" default_platforms() #> [1] "x86_64-pc-linux-gnu-ubuntu-24.04" #> [2] "source" ``` -------------------------------- ### Example: Check current platform and PPM binary availability Source: https://r-lib.github.io/pkgcache/reference/ppm_has_binaries.html Example that prints the current R platform and whether PPM has binaries for it. The output shows TRUE for the current platform. ```r current_r_platform() #> [1] "x86_64-pc-linux-gnu-ubuntu-24.04" ppm_has_binaries() #> [1] TRUE ``` -------------------------------- ### Example: repo_get(), repo_resolve(), with_repo(), and meta_cache_list() Source: https://r-lib.github.io/pkgcache/reference/repo_get.html R code examples from the documentation. The first call repo_get() returns a data frame of default repositories. repo_resolve() resolves a PPM specification to a URL. with_repo() temporarily overrides the CRAN repository for repo_get() and meta_cache_list(). The final example uses a deprecated MRAN specification with summary(repo_status()). ```r repo_get() #> # A data frame: 7 × 5 #> name url type r_version bioc_version #> * #> 1 RSPM https://packagemanager.po… cran… * NA #> 2 CRAN https://cran.rstudio.com cran * NA #> 3 BioCsoft https://bioconductor.org/… bioc 4.5.3 3.22 #> 4 BioCann https://bioconductor.org/… bioc 4.5.3 3.22 #> 5 BioCexp https://bioconductor.org/… bioc 4.5.3 3.22 #> 6 BioCworkflows https://bioconductor.org/… bioc 4.5.3 3.22 #> 7 BioCbooks https://bioconductor.org/… bioc 4.5.3 3.22 repo_resolve("PPM@2021-01-21") #> CRAN #> "https://packagemanager.posit.co/cran/__linux__/noble/2021-01-21" #' repo_resolve("PPM@dplyr-1.0.0") #' repo_resolve("PPM@R-4.0.0") with_repo(c(CRAN = "PPM@dplyr-1.0.0"), repo_get()) #> # A data frame: 7 × 5 #> name url type r_version bioc_version #> * #> 1 RSPM https://packagemanager.po… cran… * NA #> 2 CRAN https://packagemanager.po… cran * NA #> 3 BioCsoft https://bioconductor.org/… bioc 4.5.3 3.22 #> 4 BioCann https://bioconductor.org/… bioc 4.5.3 3.22 #> 5 BioCexp https://bioconductor.org/… bioc 4.5.3 3.22 #> 6 BioCworkflows https://bioconductor.org/… bioc 4.5.3 3.22 #> 7 BioCbooks https://bioconductor.org/… bioc 4.5.3 3.22 with_repo(c(CRAN = "PPM@dplyr-1.0.0"), meta_cache_list(package = "dplyr")) #> #> ✔ Updated metadata database: 4.77 MB in 5 files. #> #> ℹ Updating metadata database #> ✔ Updating metadata database ... done #> #> # A data frame: 2 × 32 #> package version depends imports suggests needscompilation license #> * #> 1 dplyr 1.2.1 R (>= 4.1.… "cli (… "broom,… NA MIT + … #> 2 dplyr 0.8.5 R (>= 3.2.… "ellip… "bit64,… yes MIT + … #> # ℹ 25 more variables: linkingto , enhances , #> # license_restricts_use , os_type , path , #> # priority , license_is_foss , archs , repodir , #> # rversion , platform , ref , type , #> # direct , status , target , mirror , #> # sources , filesize , sha256 , sysreqs , #> # built , published , deps , md5sum with_repo(c(CRAN = "MRAN@2018-06-30"), summary(repo_status())) #> Repository summary: source #> RSPM @ packagemanager.posit.co ✔ (181ms) #> CRAN @ packagemanager.posit.co ✔ (216ms) #> BioCsoft @ bioconductor.org ✔ (40ms ) #> BioCann @ bioconductor.org ✔ (181ms) #> BioCexp @ bioconductor.org ✔ (190ms) #> BioCworkflows @ bioconductor.org ✔ (192ms) #> BioCbooks @ bioconductor.org ✔ (192ms) ``` -------------------------------- ### Example: ppm_repo_url() output Source: https://r-lib.github.io/pkgcache/reference/ppm_repo_url.html Example usage of ppm_repo_url() showing the returned URL for the default public PPM instance with the 'cran' repository. ```r ppm_repo_url() #> [1] "https://packagemanager.posit.co/cran" ``` -------------------------------- ### Install pkgcache from CRAN Source: https://r-lib.github.io/pkgcache/reference/pkgcache-package.html Installs the released version of pkgcache from CRAN using install.packages(). ```r install.packages("pkgcache") ``` -------------------------------- ### Example: get_graphics_api_version() output Source: https://r-lib.github.io/pkgcache/reference/get_graphics_api_version.html Example usage showing the function call and its output, which is the integer version number (here 16). ```r get_graphics_api_version() #> [1] 16 ``` -------------------------------- ### Manage arbitrary files with package_cache Source: https://r-lib.github.io/pkgcache/reference/package_cache.html This example demonstrates initializing a new cache, adding files to it, listing the contents, finding a specific file by path, and copying a cached file to a new location. ```R pc <- package_cache$new(path = tempfile()) pc$list() #> [1] fullpath path package url etag sha256 #> <0 rows> (or 0-length row.names) cat("foo\n", file = f1 <- tempfile()) cat("bar\n", file = f2 <- tempfile()) pc$add(f1, "/f1") #> fullpath path package url etag #> 1 /tmp/RtmpvaT0ir/file1d3b38f9bb14//f1 /f1 NA NA NA #> sha256 #> 1 b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c pc$add(f2, "/f2") #> fullpath path package url etag #> 2 /tmp/RtmpvaT0ir/file1d3b38f9bb14//f2 /f2 NA NA NA #> sha256 #> 2 7d865e959b2466918c9863afca942d0fb89d7c9ac0c99bafc3749504ded97730 pc$list() #> fullpath path package url etag #> 1 /tmp/RtmpvaT0ir/file1d3b38f9bb14//f1 /f1 NA NA NA #> 2 /tmp/RtmpvaT0ir/file1d3b38f9bb14//f2 /f2 NA NA NA #> sha256 #> 1 b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c #> 2 7d865e959b2466918c9863afca942d0fb89d7c9ac0c99bafc3749504ded97730 pc$find(path = "/f1") #> fullpath path package url etag #> 1 /tmp/RtmpvaT0ir/file1d3b38f9bb14//f1 /f1 NA NA NA #> sha256 #> 1 b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c pc$copy_to(target = f3 <- tempfile(), path = "/f1") #> fullpath path package url etag #> 1 /tmp/RtmpvaT0ir/file1d3b38f9bb14//f1 /f1 NA NA NA #> sha256 #> 1 b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c readLines(f3) #> [1] "foo" ``` -------------------------------- ### Examples of Bioconductor version queries Source: https://r-lib.github.io/pkgcache/reference/bioc_version.html Example calls showing outputs for bioc_version(), bioc_version_map(), bioc_devel_version(), bioc_release_version(), and bioc_repos(). The output includes version numbers, a data frame with 44 rows, and repository URLs. ```r bioc_version() #> [1] ‘3.22’ bioc_version("4.0") #> [1] ‘3.12’ bioc_version("4.1") #> [1] ‘3.14’ bioc_version_map() #> # A data frame: 44 × 3 #> bioc_version r_version bioc_status #> #> 1 1.6 2.1 out-of-date #> 2 1.7 2.2 out-of-date #> 3 1.8 2.3 out-of-date #> 4 1.9 2.4 out-of-date #> 5 2.0 2.5 out-of-date #> 6 2.1 2.6 out-of-date #> 7 2.2 2.7 out-of-date #> 8 2.3 2.8 out-of-date #> 9 2.4 2.9 out-of-date #> 10 2.5 2.10 out-of-date #> # ℹ 34 more rows bioc_devel_version() #> [1] ‘3.23’ bioc_release_version() #> [1] ‘3.22’ bioc_repos() #> BioCsoft #> "https://bioconductor.org/packages/3.22/bioc" #> BioCann #> "https://bioconductor.org/packages/3.22/data/annotation" #> BioCexp #> "https://bioconductor.org/packages/3.22/data/experiment" #> BioCworkflows #> "https://bioconductor.org/packages/3.22/workflows" #> BioCbooks #> "https://bioconductor.org/packages/3.22/books" ``` -------------------------------- ### Equivalent PPM repository URLs Source: https://r-lib.github.io/pkgcache/reference/ppm_snapshots.html Examples of equivalent repository URLs using either an ID or a date. ```text https://packagemanager.posit.co/cran/5 https://packagemanager.posit.co/cran/2017-10-10 ``` -------------------------------- ### Example output of ppm_r_versions Source: https://r-lib.github.io/pkgcache/reference/ppm_r_versions.html Displays the structure of the data frame returned by ppm_r_versions, showing the r_version column. ```r ppm_r_versions() #> # A data frame: 6 × 1 #> r_version #> #> 1 4.5 #> 2 4.4 #> 3 4.3 #> 4 4.2 #> 5 4.1 #> 6 3.6 ``` -------------------------------- ### get_internals_id() example output Source: https://r-lib.github.io/pkgcache/reference/get_internals_id.html Example output of get_internals_id() showing a sample UUID. The actual value may differ. ```r get_internals_id() #> [1] "2fdf6c18-697a-4ba7-b8ef-11c0d92f1327" ``` -------------------------------- ### parse_installed() function signature Source: https://r-lib.github.io/pkgcache/reference/parse_installed.html Lists metadata of installed packages from DESCRIPTION files. Use when you need all fields, UTF-8 output, or faster performance than utils::installed.packages(). Arguments control library paths, package priority filtering, key case conversion, re-encoding, and package selection. ```r parse_installed( library = .libPaths(), priority = NULL, lowercase = FALSE, reencode = TRUE, packages = NULL ) ``` -------------------------------- ### Usage of current_r_platform(), current_r_platform_data(), and default_platforms() Source: https://r-lib.github.io/pkgcache/reference/current_r_platform.html Shows the function signatures for detecting the current R platform, getting raw platform data, and obtaining default platforms. ```r current_r_platform() current_r_platform_data() default_platforms() ``` -------------------------------- ### Example output of ppm_snapshots Source: https://r-lib.github.io/pkgcache/reference/ppm_snapshots.html The data frame returned by calling ppm_snapshots(). ```R ppm_snapshots() #> # A data frame: 3,103 × 2 #> date id #> #> 1 2017-10-10 2017-10-10 #> 2 2017-10-11 2017-10-11 #> 3 2017-10-12 2017-10-12 #> 4 2017-10-13 2017-10-13 #> 5 2017-10-14 2017-10-14 #> 6 2017-10-15 2017-10-15 #> 7 2017-10-16 2017-10-16 #> 8 2017-10-17 2017-10-17 #> 9 2017-10-18 2017-10-18 #> 10 2017-10-19 2017-10-19 #> # ℹ 3,093 more rows ``` -------------------------------- ### cran_archive_list() example with output for readr Source: https://r-lib.github.io/pkgcache/reference/cran_archive_list.html Example call to `cran_archive_list()` with `packages = "readr"`. The output is a data frame with columns `package`, `version`, `raw`, `mtime`, `url`, and `mirror`, ordered by package name and release date. The `version` column is a character vector because some older versions are not supported by `package_version()`. ```r cran_archive_list(packages = "readr") #> # A data frame: 23 × 6 #> package version raw mtime url mirror #> * #> 1 readr 0.1.0 readr/readr_0.1.0.… 2015-04-08 23:03:56 http… https… #> 2 readr 0.1.1 readr/readr_0.1.1.… 2015-05-29 14:27:00 http… https… #> 3 readr 0.2.0 readr/readr_0.2.0.… 2015-10-20 09:44:22 http… https… #> 4 readr 0.2.1 readr/readr_0.2.1.… 2015-10-21 08:02:08 http… https… #> 5 readr 0.2.2 readr/readr_0.2.2.… 2015-10-22 06:24:39 http… https… #> 6 readr 1.0.0 readr/readr_1.0.0.… 2016-08-03 15:55:27 http… https… #> 7 readr 1.1.0 readr/readr_1.1.0.… 2017-03-22 19:24:25 http… https… #> 8 readr 1.1.1 readr/readr_1.1.1.… 2017-05-16 19:04:00 http… https… #> 9 readr 1.2.0 readr/readr_1.2.0.… 2018-11-22 08:40:08 http… https… #> 10 readr 1.2.1 readr/readr_1.2.1.… 2018-11-22 14:30:05 http… https… #> # ℹ 13 more rows ``` -------------------------------- ### Get package cache summary Source: https://r-lib.github.io/pkgcache/reference/pkgcache-package.html Displays the current cache path, number of files, and total size of the user-level package cache. ```R pkg_cache_summary() #> $cachepath #> [1] "/Users/gaborcsardi/Library/Caches/org.R-project.R/R/pkgcache/pkg" #> #> $files #> [1] 475 #> #> $size #> [1] 669462030 ``` -------------------------------- ### Example output of default_cran_mirror Source: https://r-lib.github.io/pkgcache/reference/default_cran_mirror.html Shows the output of the default_cran_mirror function, returning a named character vector with the CRAN mirror URL. ```R default_cran_mirror() #> CRAN #> "https://cran.rstudio.com" ``` -------------------------------- ### pkg_cache_summary() - Get package cache summary Source: https://r-lib.github.io/pkgcache/index.html Returns a summary of the user-level package cache, including the cache path, number of files, and total size in bytes. The output shows a typical result with 610 files and a size of 640020676 bytes. ```r pkg_cache_summary() #> $cachepath #> [1] "/Users/gaborcsardi/Library/Caches/org.R-project.R/R/pkgcache/pkg" #> #> $files #> [1] 610 #> #> $size #> [1] 640020676 ``` -------------------------------- ### Get PPM repository URL with ppm_repo_url() Source: https://r-lib.github.io/pkgcache/reference/ppm_repo_url.html Returns the current Posit Package Manager (PPM) repository URL. If no PPM instance is configured, it returns the URL of the Posit Public Package Manager instance, including the repository name (e.g., https://packagemanager.posit.co/all). ```r ppm_repo_url() ``` -------------------------------- ### Get global metadata cache with get_cranlike_metadata_cache() Source: https://r-lib.github.io/pkgcache/reference/get_cranlike_metadata_cache.html Retrieves the global metadata cache R6 object. The first call initializes the cache; subsequent calls return the same object. The second example lists packages matching "cli" from the cache. ```r get_cranlike_metadata_cache() ``` ```r get_cranlike_metadata_cache()$list("cli") ``` -------------------------------- ### Parse installed package metadata Source: https://r-lib.github.io/pkgcache/reference/pkgcache-package.html Reads all metadata from packages currently installed in the library. ```R parse_installed() #> # A data frame: 606 x 125 #> Package Title Version `Authors@R` Description URL BugReports License #> #> 1 AzureAuth Authen~ 1.3.3 "c(\n p~ "Provides ~ "htt~ https://g~ MIT + ~ #> 2 AzureGraph Simple~ 1.3.4 "c(\n p~ "A simple ~ "htt~ https://g~ MIT + ~ #> 3 AzureRMR Interf~ 2.4.4 "c(\n p~ "A lightwe~ "htt~ https://g~ MIT + ~ #> 4 AzureStor Storag~ 3.7.0 "c(\n p~ "Manage st~ "htt~ https://g~ MIT + ~ #> 5 BH Boost ~ 1.84.0~ "Boost pro~ "htt~ https://g~ BSL-1.0 #> 6 Biobase Biobas~ 2.64.0 "c(\n p~ "Functions~ "htt~ https://g~ Artist~ #> 7 BiocGenerics S4 gen~ 0.52.0 "The packa~ "htt~ https://g~ Artist~ #> 8 BiocManager Access~ 1.30.23 "c(\n p~ "A conveni~ "htt~ https://g~ Artist~ #> 9 BiocVersion Set th~ 3.19.1 "c(\n p~ "This pack~ Artist~ #> 10 CompQuadForm Distri~ 1.4.3 "Computes ~ GPL (>~ #> # i 596 more rows #> # i 117 more variables: VignetteBuilder , Depends , Imports , #> # Suggests , RoxygenNote , NeedsCompilation , Packaged , #> # Author , Maintainer , Repository , `Date/Publication` , #> # Built , RemoteType , RemotePkgRef , RemoteRef , #> # RemoteRepos , RemotePkgPlatform , RemoteSha , Type , #> # Date , biocViews , LazyLoad , Collate , ... ``` -------------------------------- ### Initialize and list packages in cranlike_metadata_cache Source: https://r-lib.github.io/pkgcache/reference/cranlike_metadata_cache.html Create a new metadata cache in a temporary directory and list all available packages. ```R dir.create(cache_path <- tempfile()) cmc <- cranlike_metadata_cache$new(cache_path, bioc = FALSE) cmc$list() ``` -------------------------------- ### List all packages in the metadata cache with meta_cache_list() Source: https://r-lib.github.io/pkgcache/reference/pkgcache-package.html Loads pkgcache and pillar, then lists all packages in the metadata cache, showing a data frame with package details. The output is truncated for display. ```r library(pkgcache) library(pillar) meta_cache_list() ``` ```output #> # A data frame: 50,641 x 33 #> package version depends suggests license md5sum sha256sum needscompilation #> #> 1 A3 1.0.0 R (>= ~ randomF~ GPL (>~ 929a4~ "\n ~ no #> 2 AATtools 0.0.3 R (>= ~ GPL-3 de2ec~ "\n ~ no #> 3 ABACUS 1.0.0 R (>= ~ rmarkdo~ GPL-3 28795~ "\n ~ no #> 4 ABC.RAP 0.9.0 R (>= ~ knitr, ~ GPL-3 0158e~ "\n ~ no #> 5 ABCanalys~ 1.2.1 R (>= ~ GPL-3 4cbe1~ "\n ~ no #> 6 ABCoptim 0.15.0 testtha~ MIT + ~ a294d~ "\n ~ yes #> 7 ABCp2 1.2 MASS GPL-2 d049b~ no #> 8 ABHgenoty~ 1.0.1 knitr, ~ GPL-3 fce25~ "\n ~ no #> 9 ABM 0.4.3 GPL (> ~ 7aaae~ "\n ~ yes #> 10 ABPS 0.3 testthat GPL (>= d3f00~ "\n ~ no #> # i 50,631 more rows #> # i 25 more variables: imports , linkingto , archs , enhances #> # license_restricts_use , priority , os_type , #> # license_is_foss , repodir , rversion , platform , #> # ref , type , direct , status , target , #> # mirror , sources , filesize , sha256 , sysreqs , #> # built , published , deps , path ``` -------------------------------- ### Query graphics API version Source: https://r-lib.github.io/pkgcache/reference/get_graphics_api_version.html Returns the version of the graphics API of the current R installation as an integer scalar. A package compiled with a certain version will not work with R installations that use a different version. ```r get_graphics_api_version() ``` -------------------------------- ### List PPM platforms with ppm_platforms() Source: https://r-lib.github.io/pkgcache/articles/ppm.html Lists the platforms supported by the configured PPM instance. The output shows a data frame with platform details, including the binary URL code name. ```r pkgcache::ppm_platforms() ``` ```r ## # A data frame: 35 × 7 ## name os binary_url distribution binaries platforms ## ## 1 centos7 linux centos7 centos 7 TRUE ## 2 centos8 linux centos8 centos 8 TRUE ## 3 rhel9 linux rhel9 rockylinux 9 TRUE ## 4 rhel10 linux rhel10 rockylinux 10 TRUE ## 5 opensuse15 linux opensuse15 opensuse 15 TRUE ## 6 opensuse152 linux opensuse1… opensuse 15.2 TRUE ## 7 opensuse153 linux opensuse1… opensuse 15.3 TRUE ## 8 opensuse154 linux opensuse1… opensuse 15.4 TRUE ## 9 opensuse155 linux opensuse1… opensuse 15.5 TRUE ## 10 opensuse156 linux opensuse1… opensuse 15.6 TRUE ## # ℹ 25 more rows ``` -------------------------------- ### Retrieve package dependencies with cmc$deps Source: https://r-lib.github.io/pkgcache/reference/cranlike_metadata_cache.html Get the dependency information for a specific package from the cache. ```R cmc$deps("pkgconfig") ``` -------------------------------- ### Initialize and use cran_archive_cache Source: https://r-lib.github.io/pkgcache/reference/cran_archive_cache.html Demonstrates the initialization of the cache object and the available synchronous and asynchronous methods for listing, updating, and cleaning the cache. ```R cac <- cran_archive_cache$new( primary_path = NULL, replica_path = tempfile(), cran_mirror = default_cran_mirror(), update_after = as.difftime(7, units = "days"), ) cac$list(packages = NULL, update_after = NULL) cac$async_list(packages = NULL, update_after = NULL) cac$update() cac$async_update() cac$check_update() cac$async_check_update() cac$summary() cac$cleanup(force = FALSE) ``` -------------------------------- ### package_cache class usage Source: https://r-lib.github.io/pkgcache/reference/package_cache.html Shows the constructor and methods of the `package_cache` R6 class. The constructor `package_cache$new(path = NULL)` creates a cache instance. Methods include `list()`, `find()`, `copy_to()`, `add()`, `add_url()`, `async_add_url()`, `copy_or_add()`, `async_copy_or_add()`, `update_or_add()`, `async_update_or_add()`, and `delete()`. The `path` argument is optional; if NULL, a default cache location is used. ```r pc <- package_cache$new(path = NULL) pc$list() pc$find(..., .list = NULL) pc$copy_to(..., .list = NULL) pc$add(file, path, sha256 = shasum256(file), ..., .list = NULL) pc$add_url(url, path, ..., .list = NULL, on_progress = NULL, http_headers = NULL) pc$async_add_url(url, path, ..., .list = NULL, on_progress = NULL, http_headers = NULL) pc$copy_or_add(target, urls, path, sha256 = NULL, ..., .list = NULL, on_progress = NULL, http_headers = NULL) pc$async_copy_or_add(target, urls, path, ..., sha256 = NULL, ..., .list = NULL, on_progress = NULL, http_headers = NULL) pc$update_or_add(target, urls, path, ..., .list = NULL, on_progress = NULL, http_headers = NULL) pc$async_update_or_add(target, urls, path, ..., .list = NULL, on_progress = NULL, http_headers = NULL) pc$delete(..., .list = NULL) ``` -------------------------------- ### List PPM snapshots with ppm_snapshots() Source: https://r-lib.github.io/pkgcache/articles/ppm.html Lists all PPM snapshot dates and ids for the configured repository. ```r pkgcache::ppm_snapshots() ``` -------------------------------- ### ppm_platforms() Source: https://r-lib.github.io/pkgcache/reference/ppm_platforms.html Lists all platforms supported by Posit Package Manager (PPM), returning a data frame with details about each platform. ```APIDOC ## ppm_platforms() ### Description List all platforms supported by Posit Package Manager (PPM). ### Usage ppm_platforms() ### Value Data frame with columns: - **name** (character) - Platform name, essentially an identifier. - **os** (character) - Operating system: linux, windows, or macOS. - **binary_url** (character) - The URL segment of the binary repository URL for this platform. - **distribution** (character) - For Linux platforms, the name of the distribution. - **release** (character) - For Linux platforms, the name of the release. - **binaries** (logical) - Whether PPM builds binaries for this platform. - **platforms** (list of character vectors) - All possible matching distribution and release strings, each can be a fixed string or a regular expression wrapped in forward slashes. ### Example ```r ppm_platforms() # A data frame: 35 × 7 # name os binary_url distribution release binaries platforms # # 1 centos7 linux centos7 centos 7 TRUE # 2 centos8 linux centos8 centos 8 TRUE # 3 rhel9 linux rhel9 rockylinux 9 TRUE # 4 rhel10 linux rhel10 rockylinux 10 TRUE # 5 opensuse15 linux opensuse15 opensuse 15 TRUE # 6 opensuse152 linux opensuse1… opensuse 15.2 TRUE # 7 opensuse153 linux opensuse1… opensuse 15.3 TRUE # 8 opensuse154 linux opensuse1… opensuse 15.4 TRUE # 9 opensuse155 linux opensuse1… opensuse 15.5 TRUE # 10 opensuse156 linux opensuse1… opensuse 15.6 TRUE # ℹ 25 more rows ``` ``` -------------------------------- ### Get recursive dependencies with meta_cache_deps Source: https://r-lib.github.io/pkgcache/reference/meta_cache_deps.html Calls meta_cache_deps with recursive = FALSE for "pkgdown". Output is a data frame of 42 packages that are dependencies. ```R meta_cache_deps("pkgdown", recursive = FALSE) #> # A data frame: 42 × 32 #> package version depends depends imports suggests needscompilation license #> * #> 1 bslib 0.10.0 R (>= … "base6… "brand.… NA MIT + … #> 2 callr 3.7.6 R (>= … "proce… "asciic… NA MIT + … #> 3 cli 3.6.5 R (>= … "utils" "callr… NA MIT + … #> 4 desc 1.4.3 R (>= … "cli, … "callr… NA MIT + … #> 5 downlit 0.4.5 R (>= … "brio… "covr, … NA MIT + … #> 6 fontaweso… 0.5.3 R (>= … "rlang… "covr, … NA MIT + … #> 7 fs 2.0.1 R (>= … "metho… "covr, … NA MIT + … #> 8 httr2 1.2.2 R (>= … "cli (… "askpas… NA MIT + … #> 9 jsonlite 2.0.0 R (>= … "methods" NA "httr, … NA MIT + … #> 10 lifecycle 1.0.5 R (>= … "cli (… "covr, … NA MIT + … #> # ℹ 32 more rows #> # ℹ 25 more variables: path , #> priority , license_is_foss , repodir , #> rversion , platform , ref , type , #> status , target , mirror , #> sources , filesize , sha256 , sysreqs , … ``` -------------------------------- ### Repository URL format on Linux Source: https://r-lib.github.io/pkgcache/reference/ppm_snapshots.html The structure of a repository URL for PPM on Linux systems supporting binary packages. ```text {base}/{repo}/__linux__/{binary_url}/{id} ``` -------------------------------- ### Repository URL format on Windows Source: https://r-lib.github.io/pkgcache/reference/ppm_snapshots.html The structure of a repository URL for PPM on Windows systems. ```text {base}/{repo}/{id} ``` -------------------------------- ### Get reverse dependencies with meta_cache_revdeps Source: https://r-lib.github.io/pkgcache/reference/meta_cache_deps.html Calls meta_cache_revdeps with recursive = FALSE for "pkgdown". Output is a data frame of 10 reverse dependency packages. ```R meta_cache_revdeps("pkgdown", recursive = FALSE) #> # A data frame: 10 × 32 #> package version depends imports suggests needscompilation suggests license #> * #> 1 CALANGO 1.0.20 R (>= … "asser… "Annot… NA GPL-2 #> 2 devtools 2.5.0 R (>= … "cli (… "BiocM… NA MIT + … #> 3 pkgdown 2.2.0 R (>= … "bslib… "covr… NA MIT + … #> 5 pkgdown.o… 0.1.2 NA "pkgdo… "knitr… NA MIT + … #> 6 washr 1.0.1 NA "desc … "knitr… NA GPL (>… #> 6 CALANGO 1.0.20 R (>= … "asser… "Annot… no GPL-2 #> 6 devtools 2.5.0 R (>= … "cli (… "BiocM… no MIT + … #> 7 package 2.2.0 R (>= … "bslib… "covr… no MIT + … #> 9 pkgdown.o… 0.1.2 NA "pkgdo… "knitr… no MIT + … #> 10 washr 1.0.1 NA "desc … "knitr… no GPL (>… #> # ℹ 25 more variables: linkingto , enhances , #> license_restricts_use , os_type , path , #> priority , license_is_foss , archs , repodir , #> rversion , platform , ref , type , #> direct , status , target , mirror , #> sources , filesize , sha256 , sysreqs , #> built , published , deps , md5sum ``` -------------------------------- ### Detect current R platform with current_r_platform() Source: https://r-lib.github.io/pkgcache/articles/ppm.html Returns the current R platform as detected by pkgcache. The output shows the platform string for an Ubuntu 24.04 system. ```r pkgcache::current_r_platform() ``` ```r ## [1] "x86_64-pc-linux-gnu-ubuntu-24.04" ``` -------------------------------- ### repo_auth() Source: https://r-lib.github.io/pkgcache/reference/repo_auth.html Lists authentication information for all configured repositories. It returns a data frame with details about authentication domains, sources, and errors. ```APIDOC ## repo_auth() ### Description Lists authentication information for all configured repositories. ### Usage ```r repo_auth( r_version = getRversion(), bioc = TRUE, cran_mirror = default_cran_mirror(), check_credentials = TRUE ) ``` ### Arguments - **r_version** - R version(s) to use for the Bioconductor repositories, if `bioc` is `TRUE`. - **bioc** - Whether to add Bioconductor repositories, even if they are not configured in the `repos` option. - **cran_mirror** - The CRAN mirror to use, see `default_cran_mirror()`. - **check_credentials** - Whether to check that credentials are available for the authenticated repositories. ### Value Data frame with columns: - all columns from the output of `repo_get()`, - `auth_domains`: authentication domains. pkgcache tries to find the credentials for these domains, until the search is successful or all domains fail. This column is a list column of character vectors. - `auth_domain`: if the credential lookup is successful, then this is the authentication domain that was used to get the credentials. - `auth_source`: where the credentials were found. E.g. `keyring:macos` means it was in the default macos keyring. - `auth_error`: for failed credential searches this is the description of why the search failed. E.g. maybe the keyring package is not installed, or pkgcache found no credentials for any of the authentication domains. ### Details pkgcache supports HTTP basic authentication when interacting with CRAN-like repositories. To use authentication, include a username in the repo URL: ``` https://@/ ``` pkgcache tries to obtain the passwords for the authenticated CRAN-like repos from two sources, in this order: 1. A "netrc" file. If the `NETRC` environment variable is set, it should point to a file in "netrc" format. Otherwise pkgcache uses the `~/.netrc` file in the current user's home directory, if it exists. On Windows it also tries the `~/_netrc` file. 2. The system's credential store, via the keyring package. See the documentation of libcurl for details about the format of the netrc file. When looking for the password in the system credential store, pkgcache looks at the following keys, in this order: ``` https://@repo-host/ https://repo-host/ https://@repo-host https://repo-host ``` To add an authenticated repository use `repo_add()` with the `username` argument. Alternatively, you can set the `repos` option directly using `base::options()` and including the username in the repository URL. ``` -------------------------------- ### Configure R repos for PPM on Windows Source: https://r-lib.github.io/pkgcache/articles/ppm.html Sets the R package repository to a PPM (Posit Package Manager) repository, using the public P3M instance. The `latest` snapshot can be replaced with a specific snapshot, and `repo_resolve()` can construct the URL for a preferred snapshot. ```r options(repos = c( RSPM = "https://packagemanager.posit.co/cran/latest", CRAN = getOption("repos")[["CRAN"]] )) ```