-
Notifications
You must be signed in to change notification settings - Fork 1
/
session_06_materials.Rmd
33 lines (28 loc) · 1.1 KB
/
session_06_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
---
title: Session 6 — Materials
date: "August 22, 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 <- "06"
ZIPFILE <- glue::glue("core-r_session-{SESSION}_materials.zip")
SESSION_DIR <- here::here("materials", SESSION)
```
Materials for [Session 6](session_05.html).
```{r eval=TRUE}
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)
```