Skip to contents

This file contains general utility functions used throughout the package.

Usage

check_deps(required_packages, install_missing = FALSE)

Arguments

required_packages

Character vector of required package names

install_missing

Logical, whether to suggest installing missing packages

Value

Logical vector indicating which packages are available

Details

This function checks if required packages are installed using requireNamespace to check availability without loading packages. For CRAN compliance, this function does not automatically install packages.

Examples

# Check if packages are available
required <- c("ggplot2", "dplyr")
availability <- check_deps(required)
print(availability)
#> ggplot2   dplyr 
#>    TRUE    TRUE 

# Get suggestions for missing packages
required_with_missing <- c("ggplot2", "dplyr", "nonexistent_package")
availability <- check_deps(required_with_missing, install_missing = TRUE)
#> Missing packages detected: nonexistent_package
#> To install missing packages, run:
#> install.packages(c("nonexistent_package"))
print(availability)
#>             ggplot2               dplyr nonexistent_package 
#>                TRUE                TRUE               FALSE