-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path_targets.R
59 lines (50 loc) · 1.33 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
# Created by use_targets().
# Follow the comments below to fill in this target script.
# Then follow the manual to check and run the pipeline:
# https://books.ropensci.org/targets/walkthrough.html#inspect-the-pipeline
library(targets)
library(tarchetypes)
# Set target options:
tar_option_set(
packages = c("dplyr", "lubridate", "forcats")
)
# Run the R scripts in the R/ folder with your custom functions:
tar_source()
# Replace the target list below with your own:
list(
# MyNorfolk Source Data ----
tar_age(
norfolk,
get_my_norfolk_tickets(),
age = as.difftime(3, units = "hours"),
format = "parquet"
),
# Dates ----
tar_target(today, floor_date(max(norfolk$creation_date), unit = "day")),
tar_target(yesterday, today - days(1)),
tar_target(week_this, list(start = today - days(6), end = today() + days(1))),
tar_target(week_prev, list(start = week_this$start - days(7), end = week_this$start)),
# Page: Today ----
tar_target(
today_stats,
stats_today(norfolk, today, yesterday)
),
tar_target(
today_plots,
plots_today(today_stats)
),
# Page: Week ----
tar_target(
week_stats,
stats_week(norfolk, week_this, week_prev)
),
tar_target(
week_plots,
plots_week(week_stats)
),
# Render Quarto Dashboard ----
tar_quarto(
quarto_dashboard,
"index.qmd"
)
)