-
Notifications
You must be signed in to change notification settings - Fork 1
/
course_code.Rmd
76 lines (61 loc) · 2.09 KB
/
course_code.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
---
title: "Offline exercise solutions"
output:
html_document:
toc: false
---
```{r, include=FALSE}
library(knitr)
library(stringr)
knitr::opts_chunk$set(message=FALSE, warning=FALSE, eval=TRUE, echo=FALSE)
suppressPackageStartupMessages(library(dplyr))
suppressPackageStartupMessages(library(stringr))
source('reveal.R')
```
\
```{r, reveal, echo = FALSE, eval = isFALSE(show_text12)}
cat("solutions will be released as the course progresses")
```
\
To download the solutions for each of the exercises as individual R scripts click the relevant links below. If the code opens in a browser window then right click on the link and select 'save link as' (or similar).
\
```{r sol12, results='asis', , eval = isTRUE(show_text12)}
dir <- "exercise_solutions/"
file_name <- list.files(dir) %>%
sort %>%
grep("(exercise_[12]_solution.R)", . , value=TRUE)
link_name <- file_name %>%
gsub("\\.R", "", .) %>%
paste0(., "s") %>%
gsub("_", " ", .) %>%
str_to_sentence(.)
paste0("- [", link_name, "](", "exercise_solutions/", file_name, ")") %>%
cat(sep="\n\n")
```
```{r sol34, results='asis', , eval = isTRUE(show_text34)}
dir <- "exercise_solutions/"
file_name <- list.files(dir) %>%
sort %>%
grep("(exercise_[34]_solution.R|exercise_[34]_ggplot_solution.R)", . , value=TRUE) %>%
.[c(1,3,2)]
link_name <- file_name %>%
gsub("\\.R", "", .) %>%
paste0(., "s") %>%
gsub("_", " ", .) %>%
str_to_sentence(.)
paste0("- [", link_name, "](", "exercise_solutions/", file_name, ")") %>%
cat(sep="\n\n")
```
```{r sol56, results='asis', , eval = isTRUE(show_text56)}
dir <- "exercise_solutions/"
file_name <- list.files(dir) %>%
sort %>%
grep("(exercise_[56]_solution.R)", . , value=TRUE)
link_name <- file_name %>%
gsub("\\.R", "", .) %>%
paste0(., "s") %>%
gsub("_", " ", .) %>%
str_to_sentence(.)
paste0("- [", link_name, "](", "exercise_solutions/", file_name, ")") %>%
cat(sep="\n\n")
```