-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_targets.R
88 lines (69 loc) · 1.66 KB
/
_targets.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
################################################################################
#
# Project build script
#
################################################################################
# Load packages (in packages.R) and load project-specific functions in R folder
suppressPackageStartupMessages(source("packages.R"))
for (f in list.files(here::here("R"), full.names = TRUE)) source (f)
# Set build options ------------------------------------------------------------
# Groups of targets ------------------------------------------------------------
## Spatial
spatial_data <- tar_plan(
country = get_country(),
regions = get_regions(),
districts = get_districts(),
ta_areas = get_ta_areas(),
lhz = get_lhz(),
country_centroid = sf::st_centroid(country) |>
sf::st_geometry() |> unlist(),
leaflet_map = create_leaflet_map(
username = "mapbox",
country_centroid = country_centroid,
data = districts
)
)
## Read raw data
raw_data <- tar_plan(
mapping_data = read_mapping_data(),
national_summary = mapping_data[[1]],
district_summary = mapping_data[[2]],
full_data = mapping_data[[3]]
)
## Process data
processed_data <- tar_plan(
##
)
## Analysis
analysis <- tar_plan(
##
)
## Outputs
outputs <- tar_plan(
##
)
## Reports
reports <- tar_plan(
tar_render(
name = nutrition_map_site,
path = "reports/index.Rmd",
output_dir = "docs",
knit_root_dir = here::here()
)
)
## Deploy targets
deploy <- tar_plan(
##
)
## Set seed
set.seed(1977)
# Concatenate targets ----------------------------------------------------------
list(
spatial_data,
raw_data,
processed_data,
analysis,
outputs,
reports,
deploy
)