Get package installation status (e.g., if packages of interest are installed or need to be updated) and package installation code.

get_pkgs_installation_status(
  list_name = NULL,
  include = "outdated",
  show_status = include,
  install = include,
  cran = install,
  github = install,
  other_repos = install,
  using_code = install,
  local_list = getOption("bio.local_list", FALSE),
  pkgs = NULL
)

get_pkg_lists_local()

get_last_pkgs_installation_status()

# S3 method for class 'pkgs_installation_status'
print(x, show_status = x$show_status, ...)

get_pkgs_installation_code(x = NULL, ..., to_clipboard = FALSE, upgrade = TRUE)

Arguments

list_name

(character) The name of the list with required R packages. E.g., "mini", "Rcmdr", "Rcmdr-biostat", "bio", etc.

include

(character) Which packages from the list (indicated in list_name) must be included in the results. One of:

  • "always" or TRUE: all packages;

  • "newer_on_cran" – only the packages that are "outdated" or have newer version on CRAN. For arguments github and elsewhere, value "newer_on_cran" is replaced with "outdated".

  • "outdated" (default): only the packages that are not installed or do not have a minimum required version installed.

  • "missing": only the packages that are not installed.

  • "never" or FALSE: none.

show_status

(character) Which packages should be included in the package installation status summary. See options of include. Defaults to the value of include.

install

(character) Which packages should be included in the package installation code. See options of include. Defaults to the value of include. Sets the default value for cran, github, and elsewhere.

cran

(character) Condition to filter packages that should be included in code that installs packages from CRAN. See options of include plus value "required". Defaults to the value of install.

  • "required" – packages that do not have a minimum required version installed even if the required version is not on CRAN.

github

(character) Condition to filter packages that should be included in code that installs packages from GitHub. See options of include plus value "required". Defaults to the value of install.

other_repos

(character) Condition to filter packages that should be included in code that installs packages from other CRAN-like repositories. See options of include plus value "required". Defaults to the value of install.

using_code

(character) Condition to filter packages that should be included in code that installs packages from other sources. See options of include plus value "required". Defaults to the value of install.

local_list

(logical) If TRUE, the list, which is locally installed in the folder of package bio ("local list"), is used. If FALSE, the list on "GitHub" repository of the package is used. It is recommended using the online version of the list, as it may contain more recent changes. Optiom bight be set globally by, e.g., options(bio.local_list = TRUE).

pkgs

(character) The name (vector of names) of R packages. Either list_name or pkgs must be NULL.

x

Object of interest.

...

Arguments to other methods.

to_clipboard

(logical) If TRUE, the code is copied to clipboard and returned only invisibly.

upgrade

Upgrade dependencies. See upgrade in remotes::install_cran().

See also

Other R-packages-related functions: compare_version(), get_pkgs_installed()

Examples

if (FALSE) {

# NOTE: It is not recommended to use the local lists as they might be out of date.
options(bio.local_list = TRUE)
list_name <- "mini"

# Use package name
(status_out <- get_pkgs_installation_status(pkgs = "bio"))

(status_out <- get_pkgs_installation_status(pkgs = "bio", include = "always"))

# Use list name
(status_out <- get_pkgs_installation_status("mini"))
get_pkgs_installation_code(status_out)

(status_all <- get_pkgs_installation_status("mini", include = "always"))
get_pkgs_installation_code(status_all)

(status_custom <-
  get_pkgs_installation_status("mini", include = "always", install = "outdated"))
get_pkgs_installation_code(status_custom)

# Package "remembers" the last created 'pkgs_installation_status' object
get_pkgs_installation_status("snippets")
get_last_pkgs_installation_status()
get_pkgs_installation_code()

}