-
Notifications
You must be signed in to change notification settings - Fork 1
/
_targets.R
128 lines (127 loc) · 2.53 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# _targets.R file
library(targets)
source("R/functions.R")
options(tidyverse.quiet = TRUE)
tar_option_set(packages = c("tidyverse",
"Hmsc",
"corrplot",
"ape",
"tidyverse",
"readxl",
"readr",
"odbc",
"DBI"))
list(
tar_target(
raw_data_phylo,
"data/Tronderlag/Ctree (1).tre",
format = "file"
),
tar_target(
raw_data_Tr,
"data/Tronderlag/traits.csv",
format = "file"
),
#tar_target(
# raw_data_TOVE_Points_2006_2020,
# "data/TOVE_Points_2006_2020.xlsx",
# format = "file"
#),
#tar_target(
# raw_data_Habitat_data_TOVE_routes,
# "data/Tronderlag/Habitat_data_TOVE_routes2.csv",
# format = "file"
#),
tar_target(
phylo,
ape::read.tree(raw_data_phylo)
),
tar_target(
Tr,
read.csv(raw_data_Tr)
),
tar_target(
TOVE_Points,
download_TOVE_Points()
),
tar_target(
Habitat_data_TOVE_routes,
download_TOVE_Habitat()
),
tar_target(
jn_habitat_points,
joint_habitat_2_points(Habitat_data_TOVE_routes, TOVE_Points)
),
tar_target(
pivot_data,
Pivot_data(jn_habitat_points)
),
tar_target(
studyDesign,
make_studyDesign(pivot_data)
),
tar_target(
variableStr,
make_variables(studyDesign)
),
tar_target(
covariates,
make_covariates(pivot_data)
),
tar_target(
phylo_mod,
make_phylogeny(phylo)
),
tar_target(
splist,
make_splist(Tr, pivot_data)
),
tar_target(
Y_obs,
make_Y(pivot_data, splist)
),
tar_target(
trait_mod,
make_traits_df(Tr, Y_obs)
),
tar_target(
formulas,
make_formulas()
),
tar_target(
poiss_mod_str,
poissMod(Y_obs,covariates, formulas, trait_mod,phylo_mod,
studyDesign,variableStr)
),
tar_target(
modelSettings,
list(thin = 1,
samples = 50,
nChains = 3,
transient = 50)
),
tar_target(
mod_HMSC,
run_HMSC(poiss_mod_str, modelSettings)
),
tar_target(
model_diagnostics,
check_model(mod_HMSC)
),
tar_target(
postBeta,
Hmsc::getPostEstimate(mod_HMSC, parName = "Beta")
),
tar_target(
postGamma,
Hmsc::getPostEstimate(mod_HMSC, parName="Gamma")
),
tar_target(
plotBeta,
Hmsc::plotBeta(mod_HMSC, post = postBeta, supportLevel = 0.2)
),
tar_target(
plotGamma,
Hmsc::plotGamma(mod_HMSC, post = postGamma, supportLevel = 0.2)
)
)