```{asciicast asciicast-setup, include = FALSE, cache = FALSE} dir.create(.lib <- tempfile()) .libPaths(c(.lib, .libPaths()))
## How do I reinstall a package? 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: ```{asciicast faq-reinstall} pak::pkg_install("tibble")
```{asciicast faq-reinstall-2} pak::pkg_install("tibble?reinstall")
## How do I install a dependency from a binary package 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`. ## How do I install a package from source? To force the installation of a source package (instead of a binary package), use the `?source` parameter: ```{asciicast 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:
```{asciicast faq-source-dep} pak::pkg_install(c("tibble", "cli=?source"))
## How do I ignore an optional dependency? ```{asciicast 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
.
You cannot currently, but keep on eye on this issue: https://github.com/r-lib/pak/issues/343
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.