# Install required packages for SmartCane project # This script installs all packages needed to run the CI report dashboard # List of required packages required_packages <- c( # Core packages "here", "tidyverse", "sf", "terra", "tmap", "lubridate", # Additional data manipulation "zoo", "readxl", "knitr", "rmarkdown", "dplyr", "purrr", "stringr", # Spatial analysis "exactextractr", # Machine learning and statistics "rsample", "caret", "randomForest", "CAST" ) # Function to install missing packages install_if_missing <- function(pkg) { if (!requireNamespace(pkg, quietly = TRUE)) { message(paste("Installing package:", pkg)) install.packages(pkg, repos = "https://cloud.r-project.org") } else { message(paste("Package already installed:", pkg)) } } # Install missing packages for (pkg in required_packages) { install_if_missing(pkg) } # Load core packages to verify installation library(here) library(tidyverse) library(sf) library(terra) message("All required packages have been installed!")