Skip to content

Commit

Permalink
Added basic schedule and website structure
Browse files Browse the repository at this point in the history
  • Loading branch information
robjhyndman committed Jan 17, 2024
1 parent 78e11bb commit 05b77a7
Show file tree
Hide file tree
Showing 22 changed files with 2,182 additions and 6 deletions.
17 changes: 15 additions & 2 deletions _quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ project:
render:
- "*.qmd"
- "*.md"
- "!/slides/"

website:
title: "ETC4500/ETC5450 Advanced R Programming"
Expand All @@ -14,6 +13,21 @@ website:
- href: index.qmd
text: Home
icon: house-fill
- text: Schedule
icon: calendar2-fill
menu:
- week1/index.qmd
- week2/index.qmd
- week3/index.qmd
- week4/index.qmd
- week5/index.qmd
- week6/index.qmd
- week7/index.qmd
- week8/index.qmd
- week9/index.qmd
- week10/index.qmd
- week11/index.qmd
- week12/index.qmd
- text: Discussion
icon: chat-fill
href: "https://learning.monash.edu/mod/forum/view.php?id=2034181"
Expand All @@ -30,7 +44,6 @@ format:
html:
theme: [cosmo, numbat.scss]
highlight: textmate
css: styles.css
toc: true
mainfont: "Fira Sans"
html-math-method: katex
Expand Down
5 changes: 5 additions & 0 deletions assignments.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Assignment, Due, Moodle, File, Marks
Assignment 1, 2024-03-22, ????, "A1.qmd", 25
Assignment 2, 2024-04-05, ????, "A2.qmd", 25
Assignment 3, 2024-05-03, ????, "A3.qmd", 20
Assignment 4, 2024-06-01, ????, "A4.qmd", 30
11 changes: 11 additions & 0 deletions assignments/A1.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: Assignment 1 (25%)
---

> Create package skeleton. Include a basic function from set of options
```{r}
#| output: asis
source(here::here("course_info.R"))
submit(schedule, "Assignment 1")
```
11 changes: 11 additions & 0 deletions assignments/A2.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: Assignment 2 (25%)
---

> Give bad broken complicated function for their package, fix it thanks Write tests and docs Explain why it doesn’t work and is now better
```{r}
#| output: asis
source(here::here("course_info.R"))
submit(schedule, "Assignment 2")
```
11 changes: 11 additions & 0 deletions assignments/A3.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: Assignment 3 (20%)
---

> Use package within larger quarto targets workflow Uses broken function from A2
```{r}
#| output: asis
source(here::here("course_info.R"))
submit(schedule, "Assignment 3")
```
11 changes: 11 additions & 0 deletions assignments/A4.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: Assignment 4 (30%)
---

> Extend A1 package with object-oriented Extend tidyverse with some tidy interfacesInstructions
```{r}
#| output: asis
source(here::here("course_info.R"))
submit(schedule, "Assignment 4")
```
120 changes: 120 additions & 0 deletions course_info.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
######## Course info ########
library(tidyverse)

# Start of semester
start_semester <- "2024-02-26"

# Week of mid-semester break
mid_semester_break <- "2024-04-01"

# Schedule
schedule <- tibble(
Week = seq(12),
Topic = c(
"Foundations of R programming",
"R package development",
"R package development",
"Debugging and profiling",
"Functional programming",
"Object-oriented programming",
"Reactive programming: shiny",
"Reactive programming: targets",
"Metaprogramming",
"Metaprogramming",
"Rewriting R code in C++",
"Interfacing with other languages"
),
Reference = c(
"1-8. *Advanced R*",
"*R Packages*",
"*R Packages*",
"22-24. *Advanced R*",
"9-11. *Advanced R*",
"12-13. *Advanced R*",
"*Mastering Shiny*",
"*The {targets} R package user manual*",
"17-20. *Advanced R*",
"17-20. *Advanced R*",
"25. *Advanced R*",
"21. *Advanced R*"
),
Reference_URL = c(
"https://adv-r.hadley.nz/foundations-intro.html",
"https://r-pkgs.org",
"https://r-pkgs.org",
"https://adv-r.hadley.nz/debugging.html",
"https://adv-r.hadley.nz/fp.html",
"https://adv-r.hadley.nz/oo.html",
"https://mastering-shiny.org",
"https://books.ropensci.org/targets/",
"https://adv-r.hadley.nz/metaprogramming.html",
"https://adv-r.hadley.nz/metaprogramming.html",
"https://adv-r.hadley.nz/rcpp.html",
"https://adv-r.hadley.nz/translation.html"
)
)

# Add mid-semester break
calendar <- tibble(
Date = seq(as.Date(start_semester), by = "1 week", length.out = 13)
) |>
mutate(
Week = row_number(),
Week = if_else(Date < mid_semester_break, Week, Week - 1),
#Week =
)

# Add calendar to schedule
schedule <- schedule |>
left_join(calendar, by = "Week") |>
mutate(
Week = if_else(Date == mid_semester_break, NA, Week),
Topic = if_else(Date == mid_semester_break, "Mid-semester break", Topic),
Reference = if_else(Date == mid_semester_break, NA, Reference),
Reference_URL = if_else(Date == mid_semester_break, NA, Reference_URL)
) |>
select(Week, Date, everything())

# Add assignment details
lastmon <- function(x) {
7 * floor(as.numeric(x-1+4)/7) + as.Date(1-4, origin="1970-01-01")
}

assignments <- read_csv(here::here("assignments.csv")) |>
mutate(
Date = lastmon(Due),
Moodle = paste0("https://learning.monash.edu/mod/assign/view.php?id=", Moodle),
File = paste0("assignments/", File)
)

schedule <- schedule |>
full_join(assignments, by = "Date") |>
mutate(Week = if_else(is.na(Week) & Date > "2024-05-20", 13, Week))

show_assignments <- function(week) {
ass <- schedule |>
filter(
Week >= week & (week > Week - 3 | week > 8),
!is.na(Assignment),
) |>
select(Assignment:File)
if(NROW(ass) > 0) {
cat("\n\n## Assignments\n\n")
for(i in seq(NROW(ass))) {
cat("* [", ass$Assignment[i], "](../", ass$File[i], ") is due on ",
format(ass$Due[i], "%A %d %B.\n"), sep="")
}
}
}


submit <- function(schedule, assignment) {
ass <- schedule |>
filter(Assignment == assignment)
due <- format(ass$Due, "%e %B %Y") |> stringr::str_trim()
url <- ass$Moodle
button <- paste0("<br><br><hr><b>Due: ", due, "</b><br>",
"<a href=",url," class = 'badge badge-large badge-blue'>",
"<font size='+2'>&nbsp;&nbsp;<b>Submit</b>&nbsp;&nbsp;</font><br></a>")
cat(button)
}
62 changes: 58 additions & 4 deletions index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,67 @@
title: "ETC4500/5450 Advanced R Programming"
---

R is widely used as a tool for data analysis and one of the most popular programming languages. This unit delves into R from the programming aspect instead of using it as a data analysis tool. You will learn a variety of programming paradigms and delve into the foundations of R as a programming language.

## Learning outcomes

1. be familiar with the foundations of R programming
2. understand a variety of programming paradigms, including functional programming and object-oriented programming
3. utilise R’s functional and object-oriented programming systems
4. integrate the concept of metaprogramming to evaluate and construct new functions

## Teachers

* [**Rob J Hyndman**](https://robjhyndman.com). Email: [[email protected]](mailto:[email protected])
* [**Rob J Hyndman**](https://robjhyndman.com). Chief Examiner. Email: [[email protected]](mailto:[email protected])
* [**Mitchell O'Hara-Wild**](https://mitchelloharawild.com). Email: [[email protected]](mailto:[email protected])
* [**Thomas Lumley**](https://profiles.auckland.ac.nz/t-lumley). (Week 6?)
* [**Tomasz Wozniak**](https://github.com/donotdespair). (Week 11)

## References

* [Advanced R, 2e](https://adv-r.hadley.nz/) by Hadley Wickham.
* [R packages, 2e](http://r-pkgs.org/) by Hadley Wickham & Jenny Bryan.
* [Targets user manual](https://books.ropensci.org/targets/) by Will Landau.
* [*Advanced R*, 2e](https://adv-r.hadley.nz/) by Hadley Wickham.
* [*R packages*, 2e](http://r-pkgs.org/) by Hadley Wickham & Jenny Bryan.
* [*Mastering Shiny*](https://mastering-shiny.org/) by Hadley Wickham.
* [*The {targets} R package user manual*](https://books.ropensci.org/targets/) by Will Landau.

```{r}
#| label: load_packages
#| include: false
#| message: false
#| warning: false
#| echo: false
#| cache: false
library(tidyverse)
options(knitr.kable.NA = '')
source(here::here("course_info.R"))
week <- as.integer(1 + ((Sys.Date() - as_date(start_semester))/7))
```

## Weekly schedule

* Workshop: 2 hours in class per week

```{r}
#| label: schedule2
#| message: false
#| warning: false
#| echo: false
#| output: asis
schedule |>
transmute(
Date = format(Date+1, "%d %b"),
Show = !is.na(Week) & Week <= 12,
Topic = if_else(!Show, Topic, glue::glue("[{Topic}](./week{Week}/index.html)")),
Reference = if_else(!Show, Reference, glue::glue("[{Reference}]({Reference_URL})")),
Assessments = if_else(is.na(Assignment), Assignment, glue::glue("[{Assignment}]({File})"))
) |>
select(-Show) |>
knitr::kable(format = "markdown")
```

## Assessments

* Make an R package (25%)
* Fix a broken function (25%)
* Use your package within a quarto targets workflow (20%)
* Advanced package and metaprogramming methods (30%)
71 changes: 71 additions & 0 deletions numbat.scss
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,74 @@ a {
display: block!important;
}
}


/* Badges */

.badge {
font-family: $font-family-sans-serif;
font-size: 12.75px;
display: inline-block;
line-height: 1;
padding: 4px 7px 3px 7px;
text-align: center;
font-weight: normal;
text-transform: uppercase;
border-radius: 15px;
opacity: .75;
}

a.badge.badge-red {
color: #fff;
}
a.badge.badge-blue {
color: #fff;
}
a.badge.badge-green {
color: #fff;
}

.badge-large {
font-size: 18px !important;
text-transform: none !important;
padding: 5px 5px 3px 5px;
text-transform: none;
font-family: $font-family-sans-serif;
}

.badge-small {
font-size: 11.25px;
padding: 5px 5px 3px 5px;
}

.badge:hover {
opacity: 1;
}

.badge-black,
.badge-blue,
.badge-red,
.badge-green {
color: #ffffff !important;
}
.badge-black {
background: #0f0f0f;
}
.badge-blue {
background: #006DAE;
}
.badge-red {
background: #BD666D;
}
.badge-green {
background: #2c9f42;
}
.badge-yellow {
background: #ffc800;
}
.badge-white {
background: #ffffff;
}
.badge-grey {
background: #cccccc;
}
Loading

0 comments on commit 05b77a7

Please sign in to comment.