-
Notifications
You must be signed in to change notification settings - Fork 2
/
schedule.Rmd
91 lines (85 loc) · 3.46 KB
/
schedule.Rmd
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
---
title: "Course Schedule"
output:
html_document:
number_sections: false
toc: no
---
```{r setup, echo=FALSE, message=FALSE, warning=FALSE}
rm(list=objects()) # start with a clean workspace
source("knitr_setup.R")
```
```{r echo=FALSE, message=FALSE, warning=FALSE, eval=FALSE}
# Run to compute dates
# https://www.gwu.edu/academic-calendar
# Classes Begin = Monday, August 31
# Labor Day (no classes) = Monday, September 7
# Fall Break (no classes) = Friday, October 9
# Thanksgiving Break (no classes) = Wed, November 25 - Saturday, November 28
# Designated Friday = Tuesday, December 8
# Last Day of Classes = Saturday, December 12
# Final Examinations = Monday, December 14 - Tuesday, December 22
start <- as.Date("2020/09/01")
end <- as.Date("2020/12/08")
dates <- format(seq(start, end, by = "week"), format="%m/%d")
cbind(seq(length(dates)), dates)
```
```{r echo=FALSE, message=FALSE, warning=FALSE}
library(tidyverse)
library(kableExtra)
library(gsheet)
options(knitr.kable.NA = '')
# Setup some common values
fa <- list(
book = '[<i class="fas fa-book"></i>]',
file = '[<i class="fas fa-file-pdf"></i>]',
file_code = '[<i class="fas fa-file-code"></i>]',
file_archive = '[<i class="fas fa-file-archive"></i>]',
laptop = '[<i class="fas fa-laptop"></i>]')
notesRoot <- '(http://p4a.seas.gwu.edu/2020-Fall/class/'
# Make the schedule data frame
schedule <- gsheet2tbl('https://docs.google.com/spreadsheets/d/1i0_7bX1rzy9YC7sSNEDmqgwzQW_VC5DVqr0yqPVpoIQ/edit?usp=sharing') %>%
mutate(topics = ifelse(!is.na(lesson), paste0(
fa$book, '(', lesson, '.html) ', topics), topics)) %>%
group_by(week) %>%
mutate(topics = paste(topics, collapse = '<br>'),
id = row_number()) %>%
filter(id == min(id)) %>%
ungroup() %>%
mutate(
slides_pdf = paste0(
fa$file, notesRoot, class, '/slides-', class, '.pdf) pdf'),
slides_html = paste0(
fa$file_code, notesRoot, class, '/slides-', class, '.html) html'),
slides_all = paste(slides_pdf, slides_html, sep = '<br>'),
slides = ifelse(slides == 'x', slides_all, ''),
notes_blank = paste0(
fa$file_archive, notesRoot, class, '/notes-blank-', class,
'.zip) blank'),
notes_complete = paste0(
fa$file_archive, notesRoot, class, '/notes-complete-', class,
'.zip) complete'),
notes_all = paste(notes_blank, notes_complete, sep = '<br>'),
notes = case_when(
(blank == 'x' & complete == 'x') ~ notes_all,
(blank == 'x') ~ notes_blank,
(complete == 'x') ~ notes_complete,
TRUE ~ ''),
hwName = toupper(gsub('-.*', '', assignments)),
assignments = ifelse(!is.na(hwName), paste0(
fa$laptop, '(', assignments, '.html) ',
hwName, '<br>Due ', format(date + 6, format = "%d-%b"),
' by 11pm'), ''),
date = format(date, format = "%m/%d")
)
# Make the final schedule
names(schedule) <- tools::toTitleCase(names(schedule))
schedule %>%
select(Week, Date, Topics, Slides, Notes, Quizzes, Assignments) %>%
# Render the schedule as markdown
kable(format = 'html', escape = FALSE,
align = c('c', 'c', 'l', 'l', 'l', 'l', 'l')) %>%
kable_styling(full_width = F) %>%
column_spec(column = 3, width = '14em') %>%
column_spec(column = 7, width = '11em')
```