R/install_d6_packages.R

Defines functions install_d6_packages

Documented in install_d6_packages

#' Install common packages used in the D6 department
#'
#' @param geo Boolean. Do you intent to process geodata? Installs important geo packages if `TRUE` (the default)
#' 
#' @importFrom utils install.packages
#' @importFrom utils installed.packages
#' @export
install_d6_packages <- function(geo = TRUE) {
  list.of.packages <- c(
    "readr",
    "tibble",
    "dplyr",
    "tidyr",
    "ggplot2",
    "forcats",
    "stringr",
    "purrr",
    "lubridate",
    "here",
    "patchwork",
    "usethis",
    "remotes"
  )
  if (geo == TRUE) {
    list.of.packages <- c(
      list.of.packages,
      "sf",
      "terra",
      "stars",
      "tmap"
    )
  }
  new.packages <- list.of.packages[!(list.of.packages %in% utils::installed.packages()[,"Package"])]
  if(length(new.packages)) utils::install.packages(new.packages)
}
EcoDynIZW/d6 documentation built on June 30, 2024, 2:02 p.m.