generated from efcaguab/r-data-analysis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_targets.R
66 lines (61 loc) · 1.92 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
# Prepare workspace -------------------------------------------------------
options(tidyverse.quiet = TRUE)
library(targets)
library(tarchetypes)
library(tidyverse)
# load functions
f <- lapply(list.files(path = here::here("R"), full.names = TRUE,
include.dirs = TRUE, pattern = "*.R"), source)
# Plan analysis ------------------------------------------------------------
list(
tar_target(
name = asfis_list,
command = readr::read_csv(
file = "data/raw/ASFIS_sp_2020.txt",
col_types = readr::cols(.default = readr::col_character()))
),
tar_target(
name = asfis_divisions,
command = readr::read_csv(
file = "data/raw/CL_FI_SPECIES_ISSCAAP_DIVISION.csv",
col_types = readr::cols(.default = readr::col_character()))
),
tar_target(
name = ihh_list,
command = readr::read_csv(
file = "data/raw/IHH_species_list.csv",
col_types = readr::cols(.default = readr::col_character()),
locale = locale(encoding = "ISO-8859-1"))
),
tar_target(
name = isscaap_species_info,
command = merge_asfis_info(asfis_divisions, asfis_list)
),
tar_target(
name = isscaap_genus_specific_info,
command = get_genus_specified_info(isscaap_species_info)
),
tar_target(
name = isscaap_genus_derived_info,
command = derive_genus_info(isscaap_species_info)
),
tar_target(
name = isscaap_family_derived_info,
command = derive_family_info(isscaap_species_info)
),
tar_target(
name = merged_list,
command = fill_list(ihh_list, isscaap_species_info,
isscaap_genus_specific_info, isscaap_genus_derived_info,
isscaap_family_derived_info)
),
tar_target(
name = output_list_csv,
command = (function(x, file) {readr::write_csv(x, file); file})(merged_list, "data/processed/species_list_isscaap.csv"),
format = "file"
),
tar_render(
name = readme,
path = "README.Rmd"
)
)