pkg_download {pak}R Documentation

Download a package and its dependencies

Description

TODO: explain result

Usage

pkg_download(
  pkg,
  dest_dir = ".",
  dependencies = FALSE,
  platforms = NULL,
  r_versions = NULL
)

Arguments

pkg

Package names or package references. E.g.

  • ggplot2: package from CRAN, Bioconductor or a CRAN-like repository in general,

  • tidyverse/ggplot2: package from GitHub,

  • tidyverse/ggplot2@v3.4.0: package from GitHub tag or branch,

  • ⁠https://examples.com/.../ggplot2_3.3.6.tar.gz⁠: package from URL,

  • .: package in the current working directory.

See "Package sources" for more details.

dest_dir

Destination directory for the packages. If it does not exist, then it will be created.

dependencies

What kinds of dependencies to install. Most commonly one of the following values:

  • NA: only required (hard) dependencies,

  • TRUE: required dependencies plus optional and development dependencies,

  • FALSE: do not install any dependencies. (You might end up with a non-working package, and/or the installation might fail.) See Package dependency types for other possible values and more information about package dependencies.

platforms

Types of binary or source packages to download. The default is the value of pkgdepends::default_platforms().

r_versions

R version(s) to download packages for. (This does not matter for source packages, but it does for binaries.) It defaults to the current R version.

Value

Data frame with information about the downloaded packages, invisibly. Columns:

fulltarget, if it exists, contains a packaged (via ⁠R CMD build⁠) source R package. If fulltarget_tree exists, it is a package tree directory, that still needs an ⁠R CMD build⁠ call. Additional columns might be present. They are either used internally or they are experimental. They might be removed or changed at any time. All columns are of type character, except for direct (logical), needscompilation (logical), filesize (integer), deps (list column, see "Package dependency tables" below), sources (list of character vectors), remote (list), error (list), metadata (list), dep_types (list).

Package dependency tables

A package dependency tables in the deps list column have five columns currently:

Examples

dl <- pkg_download("forcats")
#>  No downloads are needed, 2 pkgs (641.53 kB) are cached                
dl
#> # A data frame: 2 × 35                                                  
#>   ref     type     direct direc…¹ status package version license needs…²
#>   <chr>   <chr>    <lgl>  <lgl>   <chr>  <chr>   <chr>   <chr>   <lgl>  
#> 1 forcats standard TRUE   TRUE    OK     forcats 0.5.2   MIT + … FALSE  
#> 2 forcats standard TRUE   TRUE    OK     forcats 0.5.2   MIT + … FALSE  
#> # … with 26 more variables: priority <chr>, md5sum <chr>, sha256 <chr>, 
#> #   filesize <int>, built <chr>, platform <chr>, rversion <chr>,        
#> #   repotype <chr>, repodir <chr>, target <chr>, deps <list>,           
#> #   mirror <chr>, sources <list>, remote <list>, error <list>,          
#> #   metadata <list>, extra <list>, dep_types <list>, params <list>,     
#> #   sysreqs <chr>, cache_status <chr>, fulltarget <chr>,                
#> #   fulltarget_tree <chr>, download_status <chr>, …                     
dl$fulltarget
#> [1] "./bin/macosx/big-sur-arm64/contrib/4.2/forcats_0.5.2.tgz"          
#> [2] "./src/contrib/forcats_0.5.2.tar.gz"                                
pkg_download("r-lib/pak", platforms = "source")
#>  No downloads are needed, 1 pkg is cached                              

See Also

Other package functions: lib_status(), pak(), pkg_deps_tree(), pkg_deps(), pkg_install(), pkg_remove(), pkg_status(), pkg_sysreqs()


[Package pak version 0.7.2 Index]