-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path_targets.R
87 lines (83 loc) · 2.31 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
# 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
# Load packages required to define the pipeline:
library(targets)
# Set target options:
tar_option_set(
packages = c("tibble"), # Packages that your targets need for their tasks.
# format = "qs", # Optionally set the default storage format. qs is fast.
seed = 123 # Set a seed for reproducibility (needed for data simulation)
)
# Run the R scripts in the R/ folder with your custom functions:
tar_source()
source(here::here("data-raw/algorithm.R"))
source(here::here("data-raw/variable-description.R"))
source(here::here("data-raw/simulate-data.R"))
# Replace the target list below with your own:
list(
tar_target(
name = algorithm_csv,
command = "data-raw/algorithm.csv",
format = "file"
),
tar_target(
name = algorithm,
command = read_algorithm_data(algorithm_csv)
),
tar_target(
name = algorithm_rda,
command = {
usethis::use_data(algorithm, overwrite = TRUE)
here::here("data/algorithm.rda")
},
format = "file"
),
tar_target(
name = variable_description_csv,
command = "data-raw/variable-description.csv",
format = "file"
),
tar_target(
name = variable_description,
command = read_variable_description_data(variable_description_csv)
),
tar_target(
name = variable_description_rda,
command = {
usethis::use_data(variable_description, overwrite = TRUE)
here::here("data/variable_description.rda")
},
format = "file"
),
tar_target(
name = simulation_definitions_csv,
command = "data-raw/simulation-definitions.csv",
format = "file"
),
tar_target(
name = register_data,
command = create_simulated_data(simulation_definitions_csv),
),
tar_target(
name = register_data_rda,
command = {
usethis::use_data(register_data, overwrite = TRUE)
here::here("data/register_data.rda")
},
format = "file"
),
tar_target(
name = internal_rda,
command = {
usethis::use_data(algorithm,
variable_description,
register_data,
overwrite = TRUE, internal = TRUE
)
here::here("R/sysdata.rda")
},
format = "file"
)
)