-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathschedule.qmd
183 lines (163 loc) · 4.62 KB
/
schedule.qmd
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
---
title: "Schedule"
---
```{r, echo=FALSE, warning=FALSE, message=FALSE}
library(gt)
library(dplyr)
library(RColorBrewer)
library(viridis)
timetable <- data.frame(
Time_D1 = c("09 - 09:10", "9:10 - 10:30", "10:30 - 11", "11 - 12", "12 - 13",
"13 - 14", "14 - 15", "15 - 15:30", "15:30 - 16:50", "16:50 - 17", "17 - 18", "19+"),
Title_D1 = c("Opening", "Session 1: Fertility", "Coffee", "Keynote: Ian Lundberg", "Lunch",
"Session 2: Mortality", "Poster presentations", "Coffee", "Session 3: Migration and SES", "Break", "Session 4: Methods", "Social dinner"),
Time_D2 = c("9:10 - 10:10", "10:10 - 10:40", "10:40 - 12", "12 - 13", "13 - 14",
"14 - 14:20", "14:20 - 15:20", "15:20 - 15:50", "15:50 - 16:50", "16:50 - 17", "17 - 18",""),
Title_D2 = c("Computer Tutorial", "Coffee", "Session 5: Causal Inference", "Lunch", "Session 6: Predicting health",
"Coffee", "Session 7: Understanding complexity", "Coffee", "Panel discussion", "Break", "Keynote: Jennie Brand","")
)
# Create the table using gt
gt_table <- gt(timetable) %>%
tab_header(
title = "Timetable"
) %>%
tab_spanner(
label = "Day 1 - 05/11/2024",
columns = c(Time_D1, Title_D1)
) %>%
tab_spanner(
label = "Day 2 - 06/11/2024",
columns = c(Time_D2, Title_D2)
) %>%
cols_label(
Time_D1 = "",
Title_D1 = "",
Time_D2 = "",
Title_D2 = ""
) %>%
cols_align(
align = "center",
columns = everything()
)
# Manually color specific cells
gt_table <- gt_table %>%
# Color the second cell in the first column yellow
tab_style(
style = cell_fill(color = "#FFDDC1"),
locations = cells_body(
columns = vars(Title_D1),
rows = 3
)
) %>%
# Color the second cell in the second column green
tab_style(
style = cell_fill(color = "#FFDDC1"),
locations = cells_body(
columns = vars(Title_D1),
rows = 5
)
) %>%
# Color the fourth cell in the first column blue
tab_style(
style = cell_fill(color = "#FFDDC1"),
locations = cells_body(
columns = vars(Title_D1),
rows = 8
)
) %>%
# Color the fourth cell in the second column red
tab_style(
style = cell_fill(color = "#FFDDC1"),
locations = cells_body(
columns = vars(Title_D1),
rows = 10
)
) %>%
# Color the last cell in the first column purple
tab_style(
style = cell_fill(color = "#FFDDC1"),
locations = cells_body(
columns = vars(Title_D1),
rows = 12
)
) %>%
# Color the second cell in the first column yellow
tab_style(
style = cell_fill(color = "#FFDDC1"),
locations = cells_body(
columns = vars(Title_D2),
rows = 2
)
) %>%
# Color the second cell in the second column green
tab_style(
style = cell_fill(color = "#FFDDC1"),
locations = cells_body(
columns = vars(Title_D2),
rows = 4
)
) %>%
# Color the fourth cell in the first column blue
tab_style(
style = cell_fill(color = "#FFDDC1"),
locations = cells_body(
columns = vars(Title_D2),
rows = 6
)
) %>%
# Color the fourth cell in the second column red
tab_style(
style = cell_fill(color = "#FFDDC1"),
locations = cells_body(
columns = vars(Title_D2),
rows = 8
)
) %>%
# Color the last cell in the first column purple
tab_style(
style = cell_fill(color = "#FFDDC1"),
locations = cells_body(
columns = vars(Title_D2),
rows = 10
)
)
# Render the table
gt_table
```
```{r, echo=FALSE, warning=FALSE, message=FALSE}
library(gt)
library(reactable)
library(dplyr)
library(readxl)
# Read the schedule data from the Excel file
schedule <- read_excel("./titles.xlsx")
# Ensure the columns are named correctly
# Assuming the columns are named "Session", "Presenters", and "Title"
# Create a summary table for the sessions
session_summary <- schedule %>%
group_by(Session) %>%
summarise(Details = paste(Presenters, "-", Title, collapse = "<br>"), .groups = 'drop')
# Define the reactable table without the search box
table <- reactable(
session_summary,
details = function(index) {
session_name <- session_summary$Session[index]
reactable(
schedule[schedule$Session == session_name, c("Presenters", "Title")],
columns = list(
Presenters = colDef(name = "Presenter"),
Title = colDef(name = "Presentation Title")
),
highlight = TRUE,
fullWidth = TRUE
)
},
columns = list(
Session = colDef(name = "Session presenters"),
Details = colDef(show = FALSE) # Hide the combined details from the main table view
),
showPageSizeOptions = TRUE,
pagination = TRUE
)
table
```