| manager {CoprManager} | R Documentation |
Talk to the system package manager to install/remove... packages from system repositories (see details for further options).
install_copr(pkgs) remove_copr(pkgs) discover()
pkgs |
character vector of names of packages. |
If R runs with root privileges (e.g., in a docker container), these
functions talk directly to the system package manager. Regular users are also
able to install/remove packages without any administrative permission via the
accompanying D-Bus service if CoprManager is installed as a system package.
If not, these methods fall back on using sudo to elevate permissions
(or pkexec in GUIs such as RStudio) in interactive sessions. Note
that, if you want to fall back to sudo in a non-interactive session,
you need to set options(CoprManager.sudo=TRUE).
If options(CoprManager.sudo.autodetect=TRUE), CoprManager tries to detect
whether it is running in an environment where password-less sudo can
be used (e.g., in a containerized environment such as a Fedora Toolbox) for
every call, and then uses sudo accordingly.
By default, if a package is not available in the system repositories, it is
installed from R's configured repositories along with all its dependencies.
This behavior can be changed via options(CoprManager.always.install.deps=TRUE),
which tries to install from system repositories recursive dependencies of
those packages that are not available. For example, if A depends on
B, and B is available in the system repositories but A is
not, then only A will be installed from CRAN with this option enabled,
and both will be installed from CRAN with this option disabled (default).
The discover method is only needed when e.g. a new repository
is added that contains packages with different prefixes (for example, your
system repositories may provide packages called r-cran-* and
r-bioc-* and then you add a new repository that provides packages
called r-github-*). Otherwise, it will not have any effect besides
regenerating the internal configuration files.
Functions install_copr and remove_copr return, invisibly,
a character vector of the names of packages not available in the system.
## Not run:
# install 'units' and all its dependencies from the system repos
CoprManager::install_copr("units")
# now remove it
CoprManager::remove_copr("units")
## End(Not run)