-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpurl.R
More file actions
39 lines (37 loc) · 1.17 KB
/
purl.R
File metadata and controls
39 lines (37 loc) · 1.17 KB
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
if(!dir.exists("docs/scripts")){
dir.create("docs")
dir.create("docs/scripts")
}
# For Chapter 5
solutions_shown <- c('')
show_solutions <- function(section){
return(solutions_shown == "ALL" | section %in% solutions_shown)
}
# Note order matters here:
chapter_titles <- c("getting-started",
"visualization",
"wrangling",
"tidy",
"regression",
"multiple-regression",
"causality",
"populations",
"sampling-distributions",
"confidence-intervals",
"p-values",
"hypothesis-tests",
"putting-together"
)
chapter_numbers <- stringr::str_pad(
string = 2:(length(chapter_titles) + 1),
width = 2,
side = "left",
pad = "0"
)
for(i in seq_len(length(chapter_numbers))){
Rmd_file <- stringr::str_c(chapter_numbers[i], "-",
chapter_titles[i], ".Rmd")
R_file <- stringr::str_c("docs/scripts/", chapter_numbers[i],
"-", chapter_titles[i], ".R")
knitr::purl(Rmd_file, R_file)
}