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 bspm 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(bspm.sudo=TRUE)
.
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.