#| label: asciicast-setup #| include: false #| cache: false dir.create(.lib <- tempfile()) .libPaths(c(.lib, .libPaths()))
pak does not reinstall a package, if the same version is already installed.
Sometimes you still want a reinstall, e.g. to fix a broken installation.
In this case you can delete the package and then install it, or use the
?reinstall
parameter:
#| label: faq-reinstall pak::pkg_install("tibble")
#| label: faq-reinstall-2 pak::pkg_install("tibble?reinstall")
Sometimes it is sufficient to install the binary package of an older version of a dependency, instead of the newer source package that potentially needs compilers, system tools or libraries.
pkg_install()
and lockfile_create()
default to upgrade = FALSE
, which
always chooses binaries over source packages, so if you use pkg_install()
you don't need to do anything extra.
The local_install_*
functions default to upgrade = TRUE
, as does pak()
with pkg = NULL
, so for these you need to explicitly use upgrade = FALSE
.
To force the installation of a source package (instead of a binary
package), use the ?source
parameter:
#| label: faq-source pak::pkg_install("tibble?source")
If you want to always install a dependency from source, because you want
the latest version or some other reason, you can use the source
parameter with the <package>=
form: <package>=?source
.
For example to install tibble, with its cli dependency installed from
source you could write:
#| label: faq-source-dep pak::pkg_install(c("tibble", "cli=?source"))
#| label: faq-ignore pak::pkg_install( c("tibble", "DiagrammeR=?ignore", "formattable=?ignore"), dependencies = TRUE )
The syntax is
<packagename>=?ignore
Note that you can only ignore optional dependencies, i.e. packages in
Suggests
and Enhances
.
Since version 1.0.0 renv has official support for using pak. This needs to be
enabled with the renv.config.pak.enabled
option or the RENV_CONFIG_PAK_ENABLED
environment variable set to TRUE
. For more information see the renv
documentation.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.