#| label: asciicast-setup #| include: false #| cache: false dir.create(.lib <- tempfile()) .libPaths(c(.lib, .libPaths()))
#| label: tldr-cran
#| asciicast_at: all
#| asciicast_knitr_output: svg
#| asciicast_cursor: FALSE
pak::pkg_install("tibble")
pak automatically sets a CRAN repository and the Bioconductor repositories that corresponds to the current R version.
#| label: tldr-gh
pak::pkg_install("tidyverse/tibble")
Use the user/repo form.
You can specify a branch or tag: user/repo@branch or user/repo@tag.
#| label: tldr-url pak::pkg_install( "url::https://cran.r-project.org/src/contrib/Archive/tibble/tibble_3.1.7.tar.gz" )
The URL may point to an R package file, made with R CMD build, or a
.tar.gz or .zip archive of a package tree.
#| label: tldr-update
pak::pkg_install("tibble")
pak::pkg_install() automatically updates the package.
#| label: tldr-update-all
pak::pkg_install("tibble", upgrade = TRUE)
upgrade = TRUE updates the package itself and all of its dependencies, if
necessary.
Add ?reinstall to the package name or package reference in general:
#| label: tldr-reinstall
pak::pkg_install("tibble?reinstall")
#| label: tldr-deps
pak::pkg_deps("tibble")
The results are returned in a data frame.
#| label: tldr-deps-tree
pak::pkg_deps_tree("tibble")
The results are also silently returned in a data frame.
#| label: tldr-deps-gh
pak::pkg_deps_tree("tidyverse/tibble")
Use the user/repo form.
As usual, you can also select a branch, tag, or sha, with the
user/repo@branch, user/repo@tag or user/repo@sha forms.
#| label: tldr-deps-local-pre #| include: false dl <- pak::pkg_download("tibble", platforms = "source", tempdir()) untar(dl$fulltarget[1])
#| label: tldr-deps-local
#| dependson: tldr-deps-local-pre
pak::local_deps_tree("tibble")
Assuming package is in directory tibble.
How does tibble depend on rlang?
#| label: tldr-deps-explain
pak::pkg_deps_explain("tibble", "rlang")
Use can also use the user/repo form for packages from GitHub,
url::... for packages at URLs, etc.
#| label: tldr-pkg-pre #| include: false #| cache: false dl <- pak::pkg_download("tibble", platforms = "source", tempdir()) untar(dl$fulltarget[1]) setwd("tibble") try(pak:::pkg_data$remote$kill(), silent = TRUE)
#| label: tldr-pkg-deps pak::local_install_deps()
#| label: tldr-pkg-install pak::local_install()
#| label: tldr-pkg-dev-deps pak::local_install_dev_deps()
Installs development and optional dependencies as well.
#| label: tldr-pkg-post
#| include: false
#| cache: false
setwd("..")
try(pak:::pkg_data$remote$kill(), silent = TRUE)
#| label: tldr-repo-list pak::repo_get()
If you haven't set a CRAN or Bioconductor repository, pak does that automatically.
#| label: tldr-repo-add pak::repo_add(rhub = 'https://r-hub.r-universe.dev') pak::repo_get()
#| label: tldr-repo-remove
#| dependson: "!expr '-1'"
options(repos = getOption("repos")["CRAN"])
pak::repo_get()
If you set the repos option to a CRAN repo only, or unset it completely,
then pak keeps only CRAN and (by default) Bioconductor.
#| label: tldr-repo-rspm pak::repo_add(CRAN = "RSPM@2022-06-30") pak::repo_get()
Sets a repository that is equivalent to CRAN's state closest to the
specified date.
Name this repository CRAN, otherwise pak will also add a default CRAN
repository.
#| label: tldr-repo-mran pak::repo_add(CRAN = "MRAN@2022-06-30") pak::repo_get()
Sets a repository that is equivalent to CRAN's state at the specified date.
Name this repository CRAN, otherwise pak will also add a default CRAN
repository.
By default pak caches both metadata and downloaded packages.
#| label: tldr-meta-list pak::meta_list()
By default pkg_install() and similar functions automatically update the
metadata for the currently set repositories if it is older than 24 hours.
You can also force an update manually:
#| label: tldr-meta-update pak::meta_update()
#| label: tldr-meta-clean pak::meta_clean(force = TRUE) pak::meta_summary()
Downloaded packages are also cached.
#| label: tldr-cache-list pak::cache_list()
#| label: tldr-cache-summary pak::cache_summary()
pak::cache_clean()
#| label: tldr-lib-list
pak::lib_status(Sys.getenv("R_LIBS_USER"))
Pass the directory of the library as the argument.
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.