generated from OxfordIHTM/ihtm-targets-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_targets_data_website.R
100 lines (96 loc) · 2.64 KB
/
_targets_data_website.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
89
90
91
92
93
94
95
96
97
98
99
100
################################################################################
#
# Data ingest and processing workflow - website data
#
################################################################################
## Website data targets ----
data_website_targets <- tar_plan(
### Download Pandemic PACT data from website ----
tar_target(
name = pact_data_download,
command = pact_download_website(
path = "data-raw", overwrite = FALSE, quiet = TRUE
),
format = "file"
),
### Archive downloaded dataset ----
tar_target(
name = pact_data_archive,
command = archive_website_data(path_from = pact_data_download),
format = "file"
),
### Read Pandemic PACT data from download ----
tar_target(
name = pact_data,
command = read.csv(file = pact_data_download)
)
)
## Website data processing targets ----
process_website_targets <- tar_plan(
### Process website data ----
tar_target(
name = pact_data_list_cols,
command = pact_process_website(pact_data)
),
### Tabulate disease ----
tar_target(
name = pact_disease_year_table,
command = pact_table_topic_group(
pact_data_list_cols, topic = "Disease", group = "GrantStartYear"
)
),
tar_target(
name = pact_disease_table,
command = pact_table_disease(pact_data_list_cols)
),
### Tabulate research categories ----
tar_target(
name = pact_category_table,
command = pact_table_category(
pact_data_list_cols, topic = "ResearchCat"
)
),
tar_target(
name = pact_subcategory_table,
command = pact_table_category(
pact_data_list_cols, topic = "ResearchSubcat",
na_values = "No subcategory"
)
),
tar_target(
name = pact_region_funder_table,
command = pact_table_location_funder(
pact_data_list_cols, topic = "FunderRegion"
)
),
tar_target(
name = pact_country_funder_table,
command = pact_table_location_funder(
pact_data_list_cols, topic = "FunderCountry"
)
),
tar_target(
name = pact_region_institution_table,
command = pact_table_location_institution(
pact_data_list_cols, topic = "ResearchInstitutionRegion"
)
),
tar_target(
name = pact_country_institution_table,
command = pact_table_location_institution(
pact_data_list_cols, topic = "ResearchInstitutionCountry"
)
),
tar_target(
name = pact_region_research_table,
command = pact_table_location_research(
pact_data_list_cols, topic = "ResearchLocationRegion"
)
),
tar_target(
name = pact_country_research_table,
command = pact_table_location_research(
pact_data_list_cols, topic = "ResearchLocationCountry"
)
)
)