-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_targets.R
145 lines (142 loc) · 3.47 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
library(targets)
tar_option_set(
packages = c("ggplot2", "here", "keedwell", "scico", "tibble")
)
tar_source()
list(
tar_target(
name = latin_square_12,
command = first_row_natural(12) |> add_rows(2:12)
),
tar_target(
name = latin_square_13,
command = first_row_natural(13) |> add_rows(2:13)
),
tar_target(
name = latin_square_14,
command = first_row_natural(14) |> add_rows(2:14)
),
tar_target(
name = latin_square_15,
command = first_row_natural(15) |> add_rows(2:15)
),
tar_target(
name = latin_square_16,
command = first_row_natural(16) |> add_rows(2:16)
),
tar_target(
name = latin_square_80,
command = first_row_natural(80) |> add_rows(2:80)
),
tar_target(
name = latin_square_495,
command = first_row_natural(495) |> add_rows(2:495)
),
tar_target(
name = plot_latin_square_12,
command = plot_latin_square(latin_square_12) + geom_text(aes(label = symbol), size = 5, colour = "white")
),
tar_target(
name = plot_latin_square_13,
command = plot_latin_square(latin_square_13)
),
tar_target(
name = plot_latin_square_14,
command = plot_latin_square(latin_square_14)
),
tar_target(
name = plot_latin_square_15,
command = plot_latin_square(latin_square_15)
),
tar_target(
name = plot_latin_square_16,
command = plot_latin_square(latin_square_16)
),
tar_target(
name = plot_latin_square_80,
command = {
ggplot(latin_square_80, aes(column, row)) +
geom_tile(aes(fill = symbol)) +
scale_y_reverse() +
coord_fixed() +
theme_void() +
theme(legend.position = "none") +
scale_fill_viridis_c(option = "magma")
}
),
tar_target(
name = plot_latin_square_495,
command = {
ggplot(latin_square_495, aes(column, row)) +
geom_tile(aes(fill = symbol)) +
scale_y_reverse() +
coord_fixed() +
theme_void() +
theme(legend.position = "none") +
scale_fill_scico(palette = 'davos')
}
),
tar_target(
name = save_plot_12,
command = ggsave(
plot = plot_latin_square_12,
filename = here("plots", "12x12_latin-square.png"),
width = 8,
height = 8
)
),
tar_target(
name = save_plot_13,
command = ggsave(
plot = plot_latin_square_13,
filename = here("plots", "13x13_latin-square.png"),
width = 8,
height = 8
)
),
tar_target(
name = save_plot_14,
command = ggsave(
plot = plot_latin_square_14,
filename = here("plots", "14x14_latin-square.png"),
width = 8,
height = 8
)
),
tar_target(
name = save_plot_15,
command = ggsave(
plot = plot_latin_square_15,
filename = here("plots", "15x15_latin-square.png"),
width = 8,
height = 8
)
),
tar_target(
name = save_plot_16,
command = ggsave(
plot = plot_latin_square_16,
filename = here("plots", "16x16_latin-square.png"),
width = 8,
height = 8
)
),
tar_target(
name = save_plot_80,
command = ggsave(
plot = plot_latin_square_80,
filename = here("plots", "80x80_latin-square.png"),
width = 8,
height = 8
)
),
tar_target(
name = save_plot_495,
command = ggsave(
plot = plot_latin_square_495,
filename = here("plots", "495x495_latin-square.png"),
width = 8,
height = 8
)
)
)