-
Notifications
You must be signed in to change notification settings - Fork 0
/
Child-Metrics-Region.Rmd
79 lines (60 loc) · 2.27 KB
/
Child-Metrics-Region.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
77
```{r bdsetup-{{i}}}
# create intro text
i <- as.integer({{i}})
has_points <- !is.na(breakdowns$pointdf[i])
b_name <- breakdowns$Name[i]
if(has_points){ b_pointdf <- eval(as.symbol(breakdowns$pointdf[i])) }
b_polydf <- eval(as.symbol(breakdowns$polydf[i]))
b_items <- eval(as.symbol(breakdowns$items[i]))
b_idcol <- breakdowns$idcolpoly[i]
loop_df <- st_as_sf(eval(b_polydf)) %>% mutate(tomatch = eval(as.symbol(b_idcol)))
score_breakdowns <- score_breakdowns %>%
bind_rows(tibble(Area = b_items, Score = NA))
```
### `r b_name`
```{r bdtext-{{i}}}
intro_text <- paste0("Kitsap County has ",
ifelse(!has_points, # poly only
paste(nrow(b_polydf),
b_name)
, # now the ones with points
paste0(nrow(b_pointdf),
" ",
b_name,
"; however, only ",
nrow(b_polydf),
" are outside of city limits. Here they are shown with a 15 minute walking distance")
),".")
title_text <- paste("Kitsap County",b_name)
subtitle_text <- ifelse(b_name %ni% c("Commissioner Districts","LAMIRDs"),
"only showing the unincorporated county","")
caption_text <- paste("Data source:",breakdowns$data_source[i])
```
`r intro_text`
```{r bdmap-{{i}}}
#| fig.width = 8,
#| fig.height = 8,
#| out.width = '100%',
#| dpi = 96
#|
kitsap +
geom_sf(data = b_polydf, aes(fill = eval(as.symbol(b_idcol))),
lwd = 0, alpha = 0.6) +
{if (has_points) geom_sf(data = b_pointdf, aes(color = 1),
color = "black", show.legend = FALSE) } +
theme_void() +
labs(title = title_text,
#subtitle = subtitle_text,
caption = caption_text,
fill = b_name)
```
```{r bdloop-{{i}}, include=FALSE, echo=FALSE}
expanded_child <- lapply(
seq_along(1:length(b_items)),
function(xrow) {
knitr::knit_expand(file = "Child-Metrics-Geo.Rmd",
x = xrow )
})
parsed_child <- knitr::knit_child(text = unlist(expanded_child))
```
`r parsed_child`