### Solve and Get Installation Solution Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_proposal Shows how to resolve dependencies and then solve the installation plan, retrieving the final solution. ```R if (FALSE) { # \dontrun{ pdi <- new_pkg_installation_proposal( "r-lib/pkgdepends", config = list(library = tempfile()) ) pdi$resolve() pdi$solve() pdi$get_solution() } # } ``` -------------------------------- ### Conditional Example (Not Run) Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_proposal.html A commented-out example demonstrating the full lifecycle of a package installation proposal, including resolve, solve, and download steps. This code is not executed by default. ```r if (FALSE) { # \dontrun{ pdi <- new_pkg_installation_proposal( "pak", config = list(library = tempfile()) ) pdi pdi$resolve() pdi pdi$solve() pdi pdi$download() pdi } # } ``` -------------------------------- ### Create and Resolve Package Installation Proposal Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_proposal Demonstrates the initial steps of creating a package installation proposal, resolving dependencies, and solving the dependency graph. This is a common starting point for package installation workflows. ```R pdi <- new_pkg_installation_proposal( c("r-lib/pak", "cran::pak"), config = list(library = tempfile()) ) pdi$resolve() pdi$solve() pdi$download() pdi$get_downloads() ``` -------------------------------- ### Create and process an installation plan Source: https://r-lib.github.io/pkgdepends/reference/install_plans.html Demonstrates the workflow for creating an installation plan from scratch using a package installation proposal. This involves resolving, solving, and downloading dependencies before retrieving the final installation plan. Use this when you need to programmatically manage package installations. ```r if (FALSE) { # \dontrun{ pdi <- new_pkg_installation_proposal( "pak", config = list(library = tempfile()) ) pdi$resolve() pdi$solve() pdi$download() pdi$get_install_plan() # } } ``` -------------------------------- ### Create and process an installation plan Source: https://r-lib.github.io/pkgdepends/reference/install_plans Demonstrates the workflow for creating a new package installation proposal, resolving dependencies, solving the installation, downloading packages, and finally obtaining the installation plan. This is typically used for complex installation scenarios. ```r if (FALSE) { # \dontrun{ pdi <- new_pkg_installation_proposal( "pak", config = list(library = tempfile()) ) pdi$resolve() pdi$solve() pdi$download() pdi$get_install_plan() } # } ``` -------------------------------- ### Show Installation Solution Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_proposal Illustrates how to display the resolved installation solution. ```R if (FALSE) { # \dontrun{ pdi <- new_pkg_installation_proposal( "r-lib/pkgdepends", config = list(library = tempfile()) ) pdi$resolve() pdi$solve() pdi$get_solution() pdi$show_solution() } # } ``` -------------------------------- ### Install a Package into a New Library Source: https://r-lib.github.io/pkgdepends/articles/pkgdepends-how-to Demonstrates how to install a package into a newly created library directory. This involves creating an installation proposal, solving dependencies, downloading, and installing the package, then checking the library status. ```r library(pkgdepends) dir.create(new_lib <- tempfile()) prop <- new_pkg_installation_proposal("pkgconfig", config = list(library = new_lib)) prop$solve() prop$download() prop$install() lib_status(new_lib) ``` -------------------------------- ### Download Packages and Get Download Details Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_proposal Illustrates the process of downloading packages based on the installation proposal and retrieving details about the downloads. ```R if (FALSE) { # \dontrun{ pdi <- new_pkg_installation_proposal( c("r-lib/pak", "cran::pak"), config = list(library = tempfile()) ) pdi$resolve() pdi$solve() pdi$download() pdi$get_downloads() } # } ``` -------------------------------- ### install() Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_proposal Installs the downloaded packages by calling the `install_package_plan()` function. ```APIDOC ## Method `install()` ### Description Install the downloaded packages. It calls [`install_package_plan()`](https://r-lib.github.io/pkgdepends/reference/install_package_plan.md). ### Usage ```r pkg_installation_proposal$install() ``` ### Returns The return value of [`install_package_plan()`](https://r-lib.github.io/pkgdepends/reference/install_package_plan.md). ``` -------------------------------- ### Get Package Installation Plan Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_proposal Generates an installation plan for downloaded packages. This plan outlines the steps required to install the packages and their dependencies. ```R pdi <- new_pkg_installation_proposal( "pak", config = list(library = tempfile()) ) pdi$resolve() pdi$solve() pdi$download() pdi$get_install_plan() ``` -------------------------------- ### install_plans Source: https://r-lib.github.io/pkgdepends/reference/install_plans.html An installation plan contains all data that is needed to install a set of package files. It is usually created from an installation proposal with solving the dependencies and downloading the package files. It is also possible to create an installation plan a different way. An installation plan object must be a data frame, with at least the following columns: package, type, binary, file, dependencies, needscompilation. For installation plans created via pkg_installation_proposal, the plan contains all columns from pkg_download_result objects, and some additional ones: library, direct, vignettes, packaged. ```APIDOC ## Function: install_plans ### Description Provides a detailed description of the structure and content of an installation plan object used by the pkgdepends R package. An installation plan is a data frame that holds all information required for installing a set of package files. ### Details An installation plan object must be a data frame with the following minimum columns: * `package`: The name of the package. * `type`: The type of the package reference. * `binary`: A boolean indicating if the package is a binary package. * `file`: The full path to the package file or directory. * `dependencies`: A list column containing the names of dependent packages. * `needscompilation`: A boolean indicating if the package needs compilation (should be `FALSE` for binary packages). When created via `pkg_installation_proposal`, the plan includes additional columns from `pkg_download_result` objects and the following: * `library`: The library path where the package is intended to be installed. * `direct`: A boolean indicating if the package was directly requested or installed as a dependency. * `vignettes`: A boolean indicating if package vignettes need to be (re)built. * `packaged`: A boolean indicating if `R CMD build` has already been called for the package. ### See Also * [`pkg_installation_proposal`](pkg_installation_proposal.html) to create install plans. * [`install_package_plan()`](install_package_plan.html) to install plans from any source. ### Example ```r if (FALSE) { # \dontrun{ pdi <- new_pkg_installation_proposal( "pak", config = list(library = tempfile()) ) pdi$resolve() pdi$solve() pdi$download() pdi$get_install_plan() } ``` ``` -------------------------------- ### R: Initialize and resolve package installation proposal Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_proposal Initializes a package installation proposal for a given package and resolves its dependencies. The configuration specifies a temporary library path. This is a common setup for testing or isolated installations. ```r pdi <- new_pkg_installation_proposal( "r-lib/pkgdepends", config = list(library = tempfile()) ) pdi$resolve() pdi$solve() pdi$get_solution() ``` -------------------------------- ### pkg_installation_proposal$install Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_proposal.html Installs the downloaded package files. ```APIDOC ## pkg_installation_proposal$install() ### Description Installs the downloaded files. ``` -------------------------------- ### Generate system requirements installation plan for a package Source: https://r-lib.github.io/pkgdepends/reference/sysreqs_install_plan Use `sysreqs_install_plan()` to create an installation plan for the system requirements of a specified R package. This example targets a specific platform (ubuntu-22.04) to ensure compatibility. ```r sysreqs_install_plan( "tidyverse", config = list(sysreqs_platform = "ubuntu-22.04") ) #> $os #> [1] "linux" #> #> $distribution #> [1] "ubuntu" #> #> $version #> [1] "22.04" #> #> $pre_install #> [1] "apt-get -y update" #> #> $install_scripts #> [1] "apt-get -y install libx11-dev libcurl4-openssl-dev libssl-dev cmake make libuv1-dev zlib1g-dev pandoc libfreetype6-dev libjpeg-dev libpng-dev libtiff-dev libwebp-dev libicu-dev libfontconfig1-dev libfribidi-dev libharfbuzz-dev libxml2-dev" #> #> $post_install #> character(0) #> #> $packages #> # A data frame: 18 × 5 #> sysreq packages pre_install system_packages post_install #> #> 1 cmake #> 2 fontconfig #> 3 freetype #> 4 fribidi #> 5 gnumake #> 6 harfbuzz #> 7 libcurl #> 8 libicu #> 9 libjpeg #> 10 libpng #> 11 libtiff #> 12 libuv #> 13 libwebp #> 14 libxml2 #> 15 openssl #> 16 pandoc #> 17 x11 #> 18 zlib #> ``` -------------------------------- ### List System Requirements for Ubuntu 22.04 Source: https://r-lib.github.io/pkgdepends/reference/sysreqs_db_list This example demonstrates how to list the system requirements for a specific platform, 'ubuntu-22.04', using the `sysreqs_db_list()` function. The output is a data frame containing dependency names, patterns, package names, and installation commands. ```r sysreqs_db_list(sysreqs_platform = "ubuntu-22.04") #> # A data frame: 131 × 5 #> name patterns packages pre_install post_install #> #> 1 Abseil #> 2 QuantLib #> 3 apparmor #> 4 atk #> 5 automake #> 6 berkeleydb #> 7 blender #> 8 blosc #> 9 boost #> 10 bowtie2 #> # ℹ 121 more rows ``` -------------------------------- ### Get Configuration of pkg_installation_proposal Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_proposal Displays the current configuration settings for a package installation proposal. This is helpful for verifying or understanding the proposal's behavior. ```r pdi <- new_pkg_installation_proposal( "pak", config = list(library = tempfile()) ) #> ℹ Creating library directory: /tmp/RtmpvL8Ybz/file1ea67db1a7f9 pdi$get_config() ``` -------------------------------- ### Install Package with Dependencies Source: https://r-lib.github.io/pkgdepends/llms.txt Creates an installation proposal for a package ('r-lib/cli'), resolves dependencies, downloads them, and installs the package into a temporary library. This demonstrates a full installation workflow. ```r lib <- tempfile() dir.create(lib) pdi <- new_pkg_installation_proposal( "r-lib/cli", config = list(library = lib) ) pdi$solve() pdi$download() pdi$install() ``` -------------------------------- ### Draw Package Installation Proposal Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_proposal Shows how to visualize the package installation plan using a drawing method. ```R if (FALSE) { # \dontrun{ pdi <- new_pkg_installation_proposal( "pak", config = list(library = tempfile()) ) pdi$resolve() pdi$solve() pdi$draw() } # } ``` -------------------------------- ### pkg_installation_proposal$print Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_proposal.html Prints a summary of the installation proposal. ```APIDOC ## pkg_installation_proposal$print() ### Description Prints the object. ``` -------------------------------- ### Create Package Installation Proposal Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_proposal.html Initializes a new package installation proposal. Can specify package references and configuration options like the library path. ```r pdi <- new_pkg_installation_proposal( "pak", config = list(library = tempfile()) ) #> ℹ Creating library directory: /tmp/RtmpvL8Ybz/file1ea67db1a7f9 pdi$get_config() #> # pkg config #> ## build_vignettes #> #> [1] FALSE #> #> ## sysreqs_verbose #> #> [1] TRUE #> #> ## sysreqs_db_update #> #> [1] TRUE #> #> ## metadata_cache_dir #> #> [1] "/tmp/RtmpvL8Ybz/file1ea63546373b" #> #> ## platforms #> #> [1] "x86_64-pc-linux-gnu-ubuntu-24.04" #> [2] "source" #> #> ## goal #> #> [1] "install" #> #> ## r_versions #> #> [1] "4.5.3" #> #> ## cache_dir #> #> [1] "/tmp/RtmpvL8Ybz/file1ea67b56c090" #> #> ## library #> #> [1] "/tmp/RtmpvL8Ybz/file1ea67db1a7f9" #> #> ## metadata_update_after #> #> Time difference of 24 hours #> #> ## include_linkingto #> #> [1] FALSE #> #> ## sysreqs_rspm_repo_id #> #> [1] "1" #> #> ## sysreqs_update #> #> [1] TRUE #> #> ## package_cache_dir #> #> NULL #> #> ## sysreqs_rspm_url #> #> [1] "https://packagemanager.posit.co" #> #> ## sysreqs_sudo #> #> [1] TRUE #> #> ## sysreqs_db_update_timeout #> #> Time difference of 60 secs #> #> ## sysreqs_lookup_system #> #> [1] TRUE #> #> ## git_submodules #> #> [1] FALSE #> #> ## sysreqs_platform #> #> [1] "x86_64-pc-linux-gnu-ubuntu-24.04" #> #> ## dependencies #> #> [1] "Depends" "Imports" "LinkingTo" #> #> ## sysreqs #> #> [1] TRUE #> #> ## sysreqs_dry_run #> #> [1] FALSE #> #> ## windows_archs #> #> [1] "prefer-x64" #> #> ## use_bioconductor #> #> [1] TRUE #> #> ## cran_mirror #> #> CRAN #> "https://cran.rstudio.com" ``` ```r pdi <- new_pkg_installation_proposal( "r-lib/pkgdepends", config = list(library = tempfile()) ) #> ℹ Creating library directory: /tmp/RtmpvL8Ybz/file1ea67a490b2b pdi #> #> + refs: #> - r-lib/pkgdepends #> + solution policy: lazy #> (use `$solve()` to solve dependencies) ``` -------------------------------- ### Package Installation Proposal Lifecycle Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_proposal.html Illustrates the typical workflow for a package installation proposal: creating, resolving, solving, and downloading packages. ```r pdi <- new_pkg_installation_proposal( "pak", config = list(library = tempfile()) ) #> ℹ Creating library directory: /tmp/RtmpvL8Ybz/file1ea63b3d76f3 pdi #> #> + refs: #> - pak #> + solution policy: lazy #> (use `$solve()` to solve dependencies) pdi$resolve() pdi #> #> + refs: #> - pak #> + solution policy: lazy #> (use `$solve()` to solve dependencies) pdi$solve() pdi #> #> + refs: #> - pak #> + solution policy: lazy #> + has solution #> (use `$download()` to download packages) #> (use `$show_solution()` to see the packages to install #> (use `$get_solution()` to see the full solution results) #> (use `$draw()` to draw the dependency tree) #> (use `$create_lockfile()` to write a lock file) pdi$download() #> ℹ Getting 1 pkg with unknown size #> ✔ Got pak 0.9.2 (x86_64-pc-linux-gnu-ubuntu-24.04) (7.03 MB) pdi #> #> + refs: #> - pak #> + solution policy: lazy #> + has solution #> + has downloads ``` -------------------------------- ### pkg_installation_proposal$show_solution Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_proposal.html Displays the current installation solution. ```APIDOC ## pkg_installation_proposal$show_solution() ### Description Shows the solution. ``` -------------------------------- ### Get References from pkg_installation_proposal Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_proposal Retrieves the package references associated with an installation proposal. This confirms which packages the proposal is set up to handle. ```r pdi <- new_pkg_installation_proposal("r-lib/pkgdepends") pdi$get_refs() #> [1] "r-lib/pkgdepends" ``` -------------------------------- ### pkg_installation_proposal$get_solution Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_proposal.html Retrieves the calculated installation solution. ```APIDOC ## pkg_installation_proposal$get_solution() ### Description Retrieves the solution. ``` -------------------------------- ### Example Output of sysreqs_platforms() Source: https://r-lib.github.io/pkgdepends/reference/sysreqs_platforms This example shows the typical output of `sysreqs_platforms()`, illustrating the columns and data format returned. It includes OS names, distribution details, and commands for package management. ```r sysreqs_platforms() #> # A data frame: 19 × 9 #> name os id distribution version version_match update_command #> #> 1 Ubunt… linux ubun… ubuntu * NA apt-get -y up… #> 2 Debia… linux debi… debian * NA apt-get -y up… #> 3 CentO… linux cent… centos * major NA #> 4 Rocky… linux rocky rockylinux * major NA #> 5 Rocky… linux rock… rockylinux * major NA #> 6 AlmaL… linux alma… rockylinux * major NA #> 7 Red H… linux rhel redhat 6 major NA #> 8 Red H… linux rhel redhat 7 major NA #> 9 Red H… linux redh… redhat * major NA #> 10 Red H… linux redh… redhat 6 major NA #> 11 Red H… linux redh… redhat 7 major NA #> 12 Red H… linux redh… redhat * major NA #> 13 Fedor… linux fedo… fedora * NA NA #> 14 openS… linux open… opensuse * NA NA #> 15 openS… linux open… opensuse * NA NA #> 16 openS… linux open… opensuse * NA NA #> 17 SUSE … linux sles sle * NA NA #> 18 SUSE … linux sle sle * NA NA #> 19 Alpin… linux alpi… alpine * minor NA #> # ℹ 2 more variables: install_command , query_command ``` -------------------------------- ### pkg_installation_proposal$show_sysreqs Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_proposal.html Displays the system requirements for the installation plan. ```APIDOC ## pkg_installation_proposal$show_sysreqs() ### Description Shows the system requirements. ``` -------------------------------- ### get_install_plan() Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_proposal Retrieves the installation plan for the downloaded packages. The format of the plan is detailed in the 'Installation plans' documentation. ```APIDOC ## Method `get_install_plan()` ### Usage ```r pkg_installation_proposal$get_install_plan() ``` ### Returns An installation plan, see ['Installation plans'](https://r-lib.github.io/pkgdepends/reference/install_plans.md) for the format. ### Examples ```r # \dontrun{ # pdi <- new_pkg_installation_proposal( # "pak", # config = list(library = tempfile()) # ) # pdi$resolve() # pdi$solve() # pdi$download() # pdi$get_install_plan() # } ``` ``` -------------------------------- ### pkg_installation_proposal$get_install_plan Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_proposal.html Retrieves the final installation plan. ```APIDOC ## pkg_installation_proposal$get_install_plan() ### Description Retrieves the install plan. ``` -------------------------------- ### pkg_installation_proposal$format Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_proposal.html Formats the installation proposal for display. ```APIDOC ## pkg_installation_proposal$format() ### Description Formats the object. ``` -------------------------------- ### sysreqs_install_plan Source: https://r-lib.github.io/pkgdepends/reference/sysreqs_install_plan Creates an installation plan for the system requirements of one or more R packages. It leverages `new_pkg_installation_proposal()` to determine and list the necessary system dependencies and commands for installation. ```APIDOC ## sysreqs_install_plan ### Description Creates an installation plan for the system requirements of specified R packages. ### Usage ```r sysreqs_install_plan(refs, upgrade = TRUE, config = list()) ``` ### Arguments - **refs** (character or list): Packages to install. - **upgrade** (logical): If `TRUE`, pkgdepends will choose the latest available versions of packages, instead of preferring binary packages over source packages. - **config** (list): Configuration options. See ['Configuration'](https://r-lib.github.io/pkgdepends/reference/pkg_config.md). If it does not include `library`, then a temporary library is used, which is equivalent to not assuming any preinstalled packages. Pass `sysreqs_platform` here if you want a different platform than the one R is running on. ### Value List with entries: - **os** (character string): Operating system. - **distribution** (character string): Linux distribution, `NA` if the OS is not Linux. - **version** (character string): Distribution version, `NA` is the OS is not Linux. - **pre_install** (character vector): Commands to run before the installation of system packages. - **install_scripts** (character vector): Commands to run to install the system packages. - **post_install** (character vector): Commands to run after the installation of system packages. - **packages** (data frame): Information about the system packages that are needed. It has columns: - **sysreq** (string): cross-platform name of the system requirement. - **packages** (list column of character vectors): The names of the R packages that have this system requirement. - **pre_install** (list column of character vectors): Commands run before the package installation for this system requirement. - **system_packages** (list column of character vectors): Names of system packages to install. - **post_install** (list column of character vectors): Commands run after the package installation for this system requirement. ### Examples ```r sysreqs_install_plan( "tidyverse", config = list(sysreqs_platform = "ubuntu-22.04") ) #> $os #> [1] "linux" #> #> $distribution #> [1] "ubuntu" #> #> $version #> [1] "22.04" #> #> $pre_install #> [1] "apt-get -y update" #> #> $install_scripts #> [1] "apt-get -y install libx11-dev libcurl4-openssl-dev libssl-dev cmake make libuv1-dev zlib1g-dev pandoc libfreetype6-dev libjpeg-dev libpng-dev libtiff-dev libwebp-dev libicu-dev libfontconfig1-dev libfribidi-dev libharfbuzz-dev libxml2-dev" #> #> $post_install #> character(0) #> #> $packages #> # A data frame: 18 × 5 #> sysreq packages pre_install system_packages post_install #> #> 1 cmake #> 2 fontconfig #> 3 freetype #> 4 fribidi #> 5 gnumake #> 6 harfbuzz #> 7 libcurl #> 8 libicu #> 9 libjpeg #> 10 libpng #> 11 libtiff #> 12 libuv #> 13 libwebp #> 14 libxml2 #> 15 openssl #> 16 pandoc #> 17 x11 #> 18 zlib #> ``` ``` -------------------------------- ### install_sysreqs() Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_proposal Installs system requirements. This method does nothing if system requirements are disabled. It also creates an installation plan for the downloaded packages. ```APIDOC ## Method `install_sysreqs()` ### Description Install system requirements. It does nothing if system requirements are turned off. Create an installation plan for the downloaded packages. ### Usage ```r pkg_installation_proposal$install_sysreqs() ``` ``` -------------------------------- ### R: Show package installation solution Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_proposal Displays the package installation solution to the console. This method can optionally show a key for annotations within the package list. It returns the solution result object. ```r pdi <- new_pkg_installation_proposal( "r-lib/pkgdepends", config = list(library = tempfile()) ) pdi$resolve() pdi$solve() pdi$get_solution() pdi$show_solution() ``` -------------------------------- ### pkg_installation_proposal$get_config Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_proposal.html Retrieves the configuration options for the installation proposal. ```APIDOC ## pkg_installation_proposal$get_config() ### Description Retrieves the configuration options. ``` -------------------------------- ### pkg_installation_proposal$get_sysreqs Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_proposal.html Retrieves the system requirements for the installation plan. ```APIDOC ## pkg_installation_proposal$get_sysreqs() ### Description Retrieves the system requirements. ``` -------------------------------- ### show_solution() Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_proposal Displays the package installation solution to the console. It can optionally show a key for annotations within the package list. ```APIDOC ## Method `show_solution()` ### Description Show the solution on the screen. ### Usage ```r pkg_installation_proposal$show_solution(key = FALSE) ``` ### Arguments - `key`: Whether to show the key to the package list annotation. ### Returns A [pkg_solution_result](https://r-lib.github.io/pkgdepends/reference/pkg_solution.md) object, which is a list. See [pkg_solution_result](https://r-lib.github.io/pkgdepends/reference/pkg_solution.md) for details. ``` -------------------------------- ### pkg_installation_proposal$install_sysreqs Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_proposal.html Installs the system requirements for the packages. ```APIDOC ## pkg_installation_proposal$install_sysreqs() ### Description Installs the system requirements. ``` -------------------------------- ### pkg_installation_proposal$new Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_proposal.html Constructor for the pkg_installation_proposal class. Initializes a new object to manage package installation proposals. ```APIDOC ## pkg_installation_proposal$new() ### Description Constructor for the `pkg_installation_proposal` class. ``` -------------------------------- ### pkg_installation_proposal$download Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_proposal.html Downloads all necessary package files according to the installation plan. ```APIDOC ## pkg_installation_proposal$download() ### Description Downloads all files. ``` -------------------------------- ### pkg_installation_proposal$get_refs Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_proposal.html Retrieves the package references associated with the installation proposal. ```APIDOC ## pkg_installation_proposal$get_refs() ### Description Retrieves the package references. ``` -------------------------------- ### show_sysreqs() Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_proposal Displays the system requirements for all packages included in the installation solution. ```APIDOC ## Method `show_sysreqs()` ### Description Show system requirements for the packages in the solution. ### Usage ```r pkg_installation_proposal$show_sysreqs() ``` ``` -------------------------------- ### Display first 10 installed system packages Source: https://r-lib.github.io/pkgdepends/reference/sysreqs_list_system_packages Use this snippet to view the first 10 entries of the installed system packages data frame. This is useful for a quick overview of the function's output format. ```r sysreqs_list_system_packages()[1:10,] ``` -------------------------------- ### R: Download packages for installation Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_proposal Downloads all packages included in the installation solution. It leverages the pkgcache package's cache to avoid redundant downloads. The method returns the proposal object invisibly. ```r pdi <- new_pkg_installation_proposal( "r-lib/pkgdepends", config = list(library = tempfile()) ) pdi$resolve() pdi$solve() pdi$download() ``` -------------------------------- ### solve() Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_plan This method is implemented for installation plans and will always result in an error. ```APIDOC ## Method `solve()` ### Description This function is implemented for installation plans, and will error. ### Usage ```r pkg_installation_plan$solve() ``` ``` -------------------------------- ### Initialize and Use pkg_installation_proposal Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_proposal Demonstrates the lifecycle of a package installation proposal, from initialization through resolution, solving, and downloading. Use this to understand the basic workflow. ```r if (FALSE) { # \dontrun{ pdi <- new_pkg_installation_proposal( "pak", config = list(library = tempfile()) ) pdi pdi$resolve() pdi pdi$solve() pdi pdi$download() pdi } # } ``` -------------------------------- ### pkg_installation_proposal$draw Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_proposal.html Draws a dependency graph based on the installation proposal. ```APIDOC ## pkg_installation_proposal$draw() ### Description Draws the dependency graph. ``` -------------------------------- ### Initialize pkg_installation_proposal with a GitHub Reference Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_proposal Shows how to create a proposal for a package hosted on GitHub. This is useful for installing packages directly from repositories. ```r pdi <- new_pkg_installation_proposal( "r-lib/pkgdepends", config = list(library = tempfile())) #> ℹ Creating library directory: /tmp/RtmpvL8Ybz/file1ea67a490b2b pdi ``` -------------------------------- ### List all installed system packages Source: https://r-lib.github.io/pkgdepends/reference/sysreqs_list_system_packages Call this function to get a data frame of all system packages currently installed on your system. The output includes package status, name, version, and capabilities. ```r sysreqs_list_system_packages() ``` -------------------------------- ### Get the solve policy of a pkg_installation_plan object Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_plan Installation plans are already solved, so this method will always return NA_character_. ```R pkg_installation_plan$get_solve_policy() ``` -------------------------------- ### Set and Get Solve Policy Source: https://r-lib.github.io/pkgdepends/reference/pkg_deps.html Shows how to change the solve policy to 'upgrade' and then verify the change by retrieving it again. ```R pdi$set_solve_policy("upgrade") pdi$get_solve_policy() #> [1] "upgrade" ``` -------------------------------- ### Create and Download Package Proposal Source: https://r-lib.github.io/pkgdepends/reference/pkg_download_proposal Demonstrates the basic workflow of creating a package download proposal, resolving dependencies, and initiating the download process. This is useful for understanding the initial steps of managing package downloads. ```R pdl <- new_pkg_download_proposal("pkgload") pdl$resolve() pdl$download() ``` -------------------------------- ### R: Handle package installation solution errors Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_proposal This example demonstrates how to identify a conflicting package set that would cause the dependency solver to fail. The `stop_for_solution_error()` method is intended to be called when such conflicts are detected, though it's commented out here as it would halt execution. ```r # This is an error, because the packages conflict: pdi <- new_pkg_installation_proposal( c("r-lib/pak", "cran::pak"), config = list(library = tempfile()) ) pdi$resolve() pdi$solve() pdi # This fails: # pdi$stop_for_solution_error() ``` -------------------------------- ### Example R package regular expressions Source: https://r-lib.github.io/pkgdepends/reference/pkg_rx Demonstrates the output of `pkg_rx()`, showing the specific regex patterns for package names, CRAN, Bioc, standard, GitHub, Git, local, deps, and installed package references, as well as GitHub username, repository, and URL patterns. ```r pkg_rx() #> $pkg_name #> [1] "[a-zA-Z][a-zA-Z0-9.]*[a-zA-Z0-9]" #> #> $type_cran #> [1] "^(?:cran::)?(?[a-zA-Z][a-zA-Z0-9.]*[a-zA-Z0-9])(?:@(?:(?:(?>=)?(?[0-9]+[-\.][0-9]+(?:[-\.][0-9]+)*|current|last))))?$" #> #> $type_bioc #> [1] "^(?:bioc::)?(?[a-zA-Z][a-zA-Z0-9.]*[a-zA-Z0-9])(?:@(?:(?:(?>=)?(?[0-9]+[-\.][0-9]+(?:[-\.][0-9]+)*|current|last))))?$" #> #> $type_standard #> [1] "^(?:standard::)?(?[a-zA-Z][a-zA-Z0-9.]*[a-zA-Z0-9])(?:@(?:(?:(?>=)?(?[0-9]+[-\.][0-9]+(?:[-\.][0-9]+)*|current|last))))?$" #> #> $type_github #> [1] "^(?:(?[a-zA-Z][a-zA-Z0-9.]*[a-zA-Z0-9])=)?(?:github::)?(?(?:[a-zA-Z\d](?:[a-zA-Z\d-]){0,38}))/(?[^/@#]+)(?:/(?(?:[^@#]*[^@#/])/?))?(?:(?:(?:@(?[^*].*)))|(?:(?:#(?[0-9]+)))|(?:(?:@(?[*]release))))?$" #> #> $type_git #> [1] "^(?:(?[a-zA-Z][a-zA-Z0-9.]*[a-zA-Z0-9])=)?(?:git::)(?:(?[^/]*)://)?(?[^/]+)(?[^@]*/)(?[^/@]*)(?:@(?.*))?$" #> #> $type_local #> [1] "^(?:(?[a-zA-Z][a-zA-Z0-9.]*[a-zA-Z0-9])=)?(?|local::(?.*)|(?(?:/|\\|~|[.]/|[.]\\|[.]$).*))$" #> #> $type_deps #> [1] "^(?:deps::)(?.*)$" #> #> $type_installed #> [1] "^(?:installed::)?(?.*)/(?[a-zA-Z][a-zA-Z0-9.]*[a-zA-Z0-9])$" #> #> $github_username #> [1] "(?(?:[a-zA-Z\d](?:[a-zA-Z\d-]){0,38}))" #> #> $github_repo #> [1] "(?[^/@#]+)" #> #> $github_url #> [1] "^(?:(?[a-zA-Z][a-zA-Z0-9.]*[a-zA-Z0-9])=)?(?:github::)?(?:(?:https?://)|(?:(?:ssh://|[^@]+@)))(?:[^/:]+)[/:](?(?:[a-zA-Z\d](?:[a-zA-Z\d-]){0,38}))/(?[^/@#]+?)(?)(?:[.]git)?(?:/(?:(?:(?:tree|commit|releases/tag)/(?.+$))|(?:pull/(?.+$))|(?:releases/)(?.+$)))?$" #> ``` -------------------------------- ### new() Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_plan Creates a new pkg_installation_plan object. It is recommended to use `new_pkg_installation_plan()` instead of calling the constructor directly. The returned object can be used to download and install packages according to the plan. ```APIDOC ## Method `new()` ### Description Create a new `pkg_installation_plan` object. Consider using `new_pkg_installation_plan()` instead of calling the constructor directly. The returned object can be used to download and install packages, according to the plan. ### Usage ```r pkg_installation_plan$new( lockfile = "pkg.lock", config = list(), remote_types = NULL ) ``` ### Arguments - `lockfile` (character) - Path to the lock file to use. - `config` (list) - Configuration options. See ['Configuration'](https://r-lib.github.io/pkgdepends/reference/pkg_config.md). It needs to include the package library to install to, in `library`. - `remote_types` (any) - Custom remote ref types, this is for advanced use, and experimental currently. ``` -------------------------------- ### Create a new pkg_installation_plan object Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_plan Use `new_pkg_installation_plan()` to create an installation plan from a lock file. You can specify configuration options and pass additional arguments to the underlying `pkg_installation_plan$new()` method. ```r new_pkg_installation_plan(lockfile = "pkg.lock", config = list(), ...) ``` -------------------------------- ### Solve package dependencies for installation Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_proposal Determines a set of packages that can be installed together to create a functional installation, including directly specified and required/suggested packages. Use this to finalize the installation plan. ```r pkg_installation_proposal$solve() ``` -------------------------------- ### Initialize pkg_installation_proposal object Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_proposal Directly construct a `pkg_installation_proposal` object. This method is used internally by `new_pkg_installation_proposal()` and allows specifying resolution policies and remote types. ```r pkg_installation_proposal$new( refs, config = list(), policy = c("lazy", "upgrade"), remote_types = NULL ) ``` -------------------------------- ### Install missing system requirements Source: https://r-lib.github.io/pkgdepends/reference/sysreqs_check_installed Installs missing system packages required by R packages. This function is used to automatically resolve and install system-level dependencies. ```r sysreqs_fix_installed(packages = NULL, library = .libPaths()[1]) ``` -------------------------------- ### Install pkgdepends from CRAN Source: https://r-lib.github.io/pkgdepends/llms.txt Installs the stable version of the pkgdepends package from CRAN. This is the recommended method for most users. ```r install.packages("pkgdepends") ``` -------------------------------- ### print() Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_proposal Prints a `pkg_installation_proposal` object to the console. The output includes details about package references, solver policy, solution status, download status, and guidance on next steps. ```APIDOC ## Method [`print()`](https://rdrr.io/r/base/print.html) ### Description Prints a `pkg_installation_proposal` object to the screen. The printout includes: - The package refs. - The policy of the dependency solver. - Whether the object has the solved dependencies. - Whether the solution had errors. - Whether the object has downloads. - Whether the downloads had errors. - Advice on which methods to call next. See the example below. ### Usage ```r pkg_installation_proposal$print(...) ``` ### Arguments - `...`: not used currently. ### Returns The `pkg_installation_proposal` object itself, invisibly. ``` -------------------------------- ### Update system requirements for a pkg_installation_plan object Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_plan Updates information about installed and missing system requirements for the installation plan. ```R pkg_installation_plan$update_sysreqs() ``` -------------------------------- ### Get configuration options Source: https://r-lib.github.io/pkgdepends/reference/pkg_installation_proposal.html Retrieves the named list of configuration options for the `pkg_installation_proposal` object. Refer to the 'Configuration' documentation for details on available options. ```R pkg_installation_proposal$get_config() ``` -------------------------------- ### Installed Package Reference Source: https://r-lib.github.io/pkgdepends/reference/pkg_refs.html References a package installed in a specific library path. Used internally but can be specified directly. ```R installed::~/R/3.6/crayon ```