forked from hospitalbuildings/site2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path02render.Rmd
47 lines (37 loc) · 1.27 KB
/
02render.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
---
title: "02render"
output: html_document
date: "2024-01-02"
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Rendering the markdown files
Allow around 20 minutes for these files to be generated.
```{r import data and clean}
#the POSS DEF LIST sheet
lookupcsv <- "https://docs.google.com/spreadsheets/d/1vwLItvXToSttFaqaT4EkXpVryR58O9coeVxtskB-X38/pub?gid=1756379641&single=true&output=csv"
#import as data frame
lookupdf <- readr::read_csv(lookupcsv)
#create a list of orgs
las <- unique(lookupdf$`LA NAME (cleaned)`)
#remove Bournemouth
las <- las[las != "Bournemouth, Christchurch and Poole"]
#remove Somerset
las <- las[las != "Somerset"]
#remove West Northants
las <- las[las != "Northamptonshire"]
las <- las[las != "West Northamptonshire"]
las <- las[las != "North Northamptonshire"]
```
This code will throw an error if the 'site' folder hasn't been created earlier by knitting the 01 template file.
```{r generate md files}
#store the location of the template
paramsfile <- "01templateBYLA.Rmd"
#loop through all regions
for (t in las) {
print(t)
rmarkdown::render(paramsfile, params = list(la = t), output_file = paste(sep="",'site/',stringr::str_replace_all(stringr::str_replace_all(t," ","-"),"'",""),'.md'),
envir = parent.frame())
}
```