From 982abc72914ba55a687dffa23cc2547059b97a67 Mon Sep 17 00:00:00 2001 From: Ernest Guevarra Date: Wed, 17 Apr 2024 07:33:45 +0100 Subject: [PATCH] tidy up and re-organise sub-projects --- R/pagasa_heat_index.R | 1 - _targets.R | 8 ++++---- _targets_climate.R | 7 +++---- _targets_cyclones.R | 5 ++--- _targets_heat.R | 8 ++++---- _targets_setup.R | 5 +++++ 6 files changed, 18 insertions(+), 16 deletions(-) create mode 100644 _targets_setup.R diff --git a/R/pagasa_heat_index.R b/R/pagasa_heat_index.R index 530b431..12990e1 100644 --- a/R/pagasa_heat_index.R +++ b/R/pagasa_heat_index.R @@ -48,7 +48,6 @@ heat_index_get_image_urls <- function(.url = "https://pubfiles.pagasa.dost.gov.p #' #' @export #' -#' heat_index_download_image_files <- function(heat_index_url, .date, diff --git a/_targets.R b/_targets.R index 1f6c145..a26e68a 100644 --- a/_targets.R +++ b/_targets.R @@ -1,12 +1,12 @@ ################################################################################ # -# General Targets Workflow +# Overall targets workflow for PAGASA data processing and archiving # ################################################################################ -## Load libraries and custom functions ----------------------------------------- -suppressPackageStartupMessages(source("packages.R")) -for (f in list.files(here::here("R"), full.names = TRUE)) source (f) +## Setup workflow using project-wide settings ---------------------------------- +source("_targets_setup") + ## Create targets and list targets objects ------------------------------------- diff --git a/_targets_climate.R b/_targets_climate.R index 92b10f1..ba992b6 100644 --- a/_targets_climate.R +++ b/_targets_climate.R @@ -1,12 +1,11 @@ ################################################################################ # -# General Targets Workflow +# Targets workflow for climate data download, extraction, and processing # ################################################################################ -## Load libraries and custom functions ----------------------------------------- -suppressPackageStartupMessages(source("packages.R")) -for (f in list.files(here::here("R"), full.names = TRUE)) source (f) +## Setup workflow using project-wide settings ---------------------------------- +source("_targets_setup") ## Download targets ------------------------------------------------------------ diff --git a/_targets_cyclones.R b/_targets_cyclones.R index 817bb00..e6d2c30 100644 --- a/_targets_cyclones.R +++ b/_targets_cyclones.R @@ -4,9 +4,8 @@ # ################################################################################ -## Load libraries and custom functions ----------------------------------------- -suppressPackageStartupMessages(source("packages.R")) -for (f in list.files(here::here("R"), full.names = TRUE)) source (f) +## Setup workflow using project-wide settings ---------------------------------- +source("_targets_setup") ## Download targets ------------------------------------------------------------ diff --git a/_targets_heat.R b/_targets_heat.R index 00be766..536a939 100644 --- a/_targets_heat.R +++ b/_targets_heat.R @@ -1,12 +1,12 @@ ################################################################################ # -# General Targets Workflow +# Targets workflow for heat index data download, extraction, and processing # ################################################################################ -## Load libraries and custom functions ----------------------------------------- -suppressPackageStartupMessages(source("packages.R")) -for (f in list.files(here::here("R"), full.names = TRUE)) source (f) +## Setup workflow using project-wide settings ---------------------------------- +source("_targets_setup") + ## Create targets and list targets objects ------------------------------------- diff --git a/_targets_setup.R b/_targets_setup.R new file mode 100644 index 0000000..fa99d1e --- /dev/null +++ b/_targets_setup.R @@ -0,0 +1,5 @@ +# Project-wide targets workflow setup ------------------------------------------ + +## Load libraries and custom functions ----------------------------------------- +suppressPackageStartupMessages(source("packages.R")) +for (f in list.files(here::here("R"), full.names = TRUE)) source (f)