check_and_fetch_cran_package {risk.assessr}R Documentation

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)

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'.

Value

A list containing: - 'package_url': URL to download the package tarball. - 'last_version': Latest version available - 'version': The requested version of the package (or 'NULL' if not specified). - 'all_versions': A character vector of all available package versions - 'error': If the package or version is not found, an error message is included.

Examples

## Not run: 
# Check and fetch a specific version of "ggplot2"
result <- check_and_fetch_cran_package("ggplot2", package_version = "3.3.5")
print(result)

## End(Not run)

[Package risk.assessr version 2.0.0 Index]