Learn R Programming

risk.assessr (version 3.0.1)

check_and_fetch_cran_package: Check and Fetch CRAN Package

Description

This function checks if a package exists on CRAN and retrieves the corresponding package URL and version details. If a specific version is not provided, the latest version is used.

Usage

check_and_fetch_cran_package(package_name, package_version = NULL)

Value

A list with one of the following structures:

package_url

Character string; the URL to download the package tarball.

last_version

A named list with version and date for the latest available version.

version

Character string; the requested version (or NULL if not specified).

all_versions

A list of named lists, each with version and date, representing all available versions.

Arguments

package_name

A character string specifying the name of the package to check and fetch.

package_version

An optional character string specifying the version of the package to fetch. Defaults to `NULL`.

Examples

Run this code
if (FALSE) {
# Check and fetch a specific version of "ggplot2"
result <- check_and_fetch_cran_package("ggplot2", package_version = "3.3.5")
print(result)
}

Run the code above in your browser using DataLab