pkgload::load_all( export_all = FALSE, helpers = FALSE, attach_testthat = FALSE ) pkgcache::meta_cache_list() knitr::opts_chunk$set(eval = pkgcache::ppm_has_binaries())
Posit Package Manager (PPM) is a Posit product to help organizations organize R and Python packages.
Posit Public Package Manager (P3M) is a free instance of PPM.
pkgcache deals with all PPM instances the same way currently, including the P3M instance.
In the following, by PPM we mean any PPM instance.
For a better user experience pkgcache handles PPM repositories specially on Linux.
Call pkgcache::ppm_has_binaries()
to decide if PPM builds binaries for
your platform:
pkgcache::ppm_has_binaries()
You can use pkgcache::current_r_platform()
to see if pkgcache detects your
platform correctly:
pkgcache::current_r_platform()
Set the repos
option to a PPM URL, as suggested by the PPM setup web page.
E.g. see https://packagemanager.posit.co/client/#/repos/2/overview for
P3M.
You can also set the PKGCACHE_PPM_URL
environment variable to the base URL
of a PPM instance (e.g. https://packagemanager.posit.co for P3M), and the
PKGCACHE_PPM_REPO
environment variable to the default PPM repository.
The pkgcache::repo_resolve()
and pkgcache::repo_add()
functions use these
environment variables (if they are set) to construct PPM URLs. See
?ppm_repo_url
for details.
A PPM repository URL for Linux binary packages has the following form:
{base}/{repo}/__linux__/{binary_url}/{id}
where {base}
is the base URL of the PPM instance, {repo}
is a PPM
repository, {binary_url}
is the code name of a release of a Linux
distribution (e.g. rhel9
), and {id}
is the identifier (or date) of a
PPM snapshot or latest
for the latest snapshot.
ppm_platforms()
lists platforms supported by a PPM instance:
pkgcache::ppm_platforms()
The binary_url
column contains the code name that you need to use in the
repository URL.
ppm_snapshots()
lists all PPM snapshot dates and ids:
pkgcache::ppm_snapshots()
You can use the snapshot ids or dates in the PPM repository URL to select a particular snapshot. E.g. these two repository URLs are equivalent:
https://packagemanager.posit.co/cran/__linux__/centos7/5 https://packagemanager.posit.co/cran/__linux__/centos7/2017-10-10
pkgcache generalizes R's "machine-vendor-OS" platform triplet on Linux to include the distribution and release as well. E.g. the platform of the machine building this document is:
pkgcache::current_r_platform()
R does not have built-in support for binary Linux repositories, so PPM offers binary Linux packages as source packages. This is possible because R recognizes binary packages at installation time, and handles them appropriately.
pkgcache detects binary PPM repositories, and constructs their platform string:
print( pkgcache::meta_cache_list(package = c("ggplot2", "pkgcache"))[, c("package", "mirror", "platform")], width = Inf )
Occasionally, the PPM metadata can be outdated, and pkgcache will wrongly think that PPM has a binary for a package, whereas it does not, or the opposite might also be true.
When pkgcache downloads a package as an update to the package cache, it detects from the PPM response headers whether the downloaded package is indeed of the expected type. If not, then pkgcache updates its knowledge about the package.
Different PPM instances may support different R versions. The public P3M
instance supports the last five R releases. pkgcache will automatically
check if your configured PPM instance supports your R version, and
ppm_has_binaries()
, repo_set()
will act accordingly. You can use the
pkgcache::ppm_r_versions()
function to list the R versions supported by
your instance:
pkgcache::ppm_r_versions()
Note that these version numbers do not include the patch version.
E.g. 4.2
means that all 4.2.x
R versions are supported.
A PPM instance can have support for Windows binaries, the public P3M instance does support them.
The R package system supports Windows binaries out of the box, so setting
up PPM on Windows simply means setting the repos
option to a PPM
repository. E.g. for the public P3M this would be something like:
options(repos = c( RSPM = "https://packagemanager.posit.co/cran/latest", CRAN = getOption("repos")[["CRAN"]] ))
Instead of latest
you can use a different snapshot, of course, and you
can also use repo_resolve()
to construct the URL for your preferred
snapshot.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.