-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_targets.R
125 lines (97 loc) · 2.58 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
# Source ------------------------------------------------------------------
library(targets)
tar_source('R')
# Options -----------------------------------------------------------------
# Targets
tar_option_set(format = 'qs')
# Renv --------------------------------------------------------------------
activate()
snapshot()
restore()
# Targets -----------------------------------------------------------------
c(
tar_file_read(
trees_raw,
"input/trees_openrefine.csv",
read.csv(!!.x)
),
tar_file_read(
trees_ranges,
"input/species_ranges.csv",
read.csv(!!.x)
),
tar_file_read(
parks,
"input/Park.densiometer.csv",
read.csv(!!.x)
),
tar_target(
data_plot,
plot_data(trees_raw, trees_ranges, parks, "input/660_IndiceCanopee_2021.tif", "input/gps_sppts.gpkg")
),
tar_target(
data_park,
park_data(trees_raw, trees_ranges, parks, "input/660_IndiceCanopee_2021.tif", "input/study_parks_spatial.gpkg")
),
tar_target(
sr_park,
glm(SR ~ 1 + Conservation.area + Park.size_s + PropInv_s,
family = gaussian(),
data = data_park)
),
tar_target(
shan_park,
glm(formula = Shannon ~ 1 + Conservation.area + Park.size_s + PropInv_s,
family = gaussian(),
data = data_park)
),
tar_target(
can_park,
betareg(formula = percan ~ 1 + Conservation.area + Park.size_s + PropInv_s,
data = data_park)
),
tar_target(
complexity_park,
glm(formula = MeanComplexity ~ 1 + Conservation.area + Park.size_s + PropInv_s,
family = gaussian(),
data = data_park)
),
tar_target(
inv_sp_park,
betareg(formula = PropInvSp ~ 1 + Conservation.area + Park.size,
data = data_park)
),
tar_target(
inv_stems_park,
betareg(formula = PropInv ~ 1 + Conservation.area + Park.size,
data = data_park)
),
tar_target(
model_diagnostics,
diagnostics(sr_park, shan_park, complexity_park,
can_park, inv_sp_park, inv_stems_park)
),
tar_target(
figure_1,
make_figure_1("input/study_parks_spatial.gpkg")
),
tar_target(
figure_canopy,
make_figure_canopy(can_park, data_park)
),
tar_target(
figure_complexity,
make_figure_complexity(complexity_park, data_park)
),
tar_target(
figure_invasive,
make_figure_invasive(inv_stems_park, data_park, trees_raw, trees_ranges)
),
tar_render(
supplementary_info,
'supplementary-info.qmd'
)
)
## TODO
# model plot data?
# NOTE: if using plot data - missing some canopy and have 96 plots instead of 92