-
Notifications
You must be signed in to change notification settings - Fork 1
/
session_05_materials.Rmd
42 lines (34 loc) · 1.57 KB
/
session_05_materials.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
---
title: Session 4 — Materials
date: "August 8, 2018"
---
```{r include=FALSE}
knitr::opts_chunk$set(echo = FALSE, results = 'asis')
make_listing <- function(filename, path_rel, base_url = "https://gerkelab.github.io/core-r-course") {
cat(glue::glue('\n- [{filename}]({path_rel})\n\n ```\n download.file("{file.path(base_url, path_rel)}", "{filename}")\n ```\n\n'))
}
needs_zip <- function(zipfile, dirpath) {
zipfile <- here::here(dirpath, "..", zipfile)
if (!file.exists(zipfile)) return(TRUE)
zip_modtime <- fs::file_info(zipfile)$modification_time
files_modtime <- fs::file_info(fs::dir_ls(dirpath)) %>% pull(modification_time) %>% max()
zip_modtime < files_modtime
}
SESSION <- "05"
ZIPFILE <- glue::glue("core-r_session-{SESSION}_materials.zip")
SESSION_DIR <- file.path("materials", SESSION)
```
Materials for [Session 5](session_05.html).
## Partially completed [dplyr]{.pkg} homework
You can find the [original file](https://gerkelab.github.io/core-r-course/materials/04/cancer_registry_dplyr.R)
and data in the [Session 4 Materials page](session_04_materials.html).
We completed up to **Task 2** in class, please try to finish the rest on your own.
If you get stuck, you can also look at [my completed notes](https://gerkelab.github.io/core-r-course/materials/04/cancer_registry_dplyr.html)
(but try to use this only to get unstuck!).
```{r}
fs::file_info(fs::dir_ls(SESSION_DIR, regexp = "\\.(R|csv|xlsx)")) %>%
mutate(path_rel = fs::path_rel(path, here::here())) %>%
select(path_rel) %>%
mutate(filename = basename(path_rel)) %>%
purrr::pwalk(make_listing)
```