-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreport-rgc.Rmd
More file actions
127 lines (92 loc) · 2.74 KB
/
Copy pathreport-rgc.Rmd
File metadata and controls
127 lines (92 loc) · 2.74 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
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
---
title: "`r params$center` Regional Growth Center"
output:
officedown::rdocx_document:
reference_docx: custom-reference-doc-rmd-rgc.docx
params:
center: "Renton"
filename: "Renton"
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE,
warning = FALSE,
message = FALSE)
fx_files <- list.files('functions', full.names = TRUE)
sapply(fx_files, source)
```
```{r packages}
library(tidyverse)
library(flextable)
library(openxlsx)
library(officer)
library(leaflet)
library(sf)
library(officedown)
library(here)
```
```{r gen data}
# tables
df <- read.xlsx("data/all-data.xlsx")|>
filter(center_name == params$center) |>
mutate(transit_service = str_replace(transit_service, "\n", "\n\n")) |>
mutate(market_targets = str_replace(market_targets, "\n", "\n\n"))
# criteria table will be based on urban or metro ...
crit_df_main <- read.xlsx("criteria-table-ref-rgc.xlsx",
sheet = df$center_type)
# shapes
wgs84 <- 4326
rgc_shp <- readRDS("data/proposed_rgcs.rds")
rgc_ctr <- rgc_shp |>
st_transform(wgs84) |>
filter(name_monitoring == params$center)
```
```{r prep table}
df_filled <- df |>
select(center_name, center_type, density_acre, planned_target_density, mix_of_uses, size, transit_service, market_targets, subarea_plan)
df_filled <- df_filled |>
pivot_longer(cols = colnames(df_filled)[!(colnames(df_filled) %in% "center_name")],
names_to = "join_field",
values_to = "Status_filled")
crit_df <- crit_df_main |>
left_join(df_filled , by = "join_field") |>
mutate(Status = Status_filled)|>
select(-Status_filled, -center_name)
```
```{r icons}
# https://stackoverflow.com/questions/77597806/how-to-add-fontawesome-icons-to-a-flextable
# https://ardata-fr.github.io/flextable-book/cell-content.html#images
df_icon_paths <- add_image_paths(data_path = "data/all-data-icons.xlsx",
center = params$center)
```
```{r assemble tables}
crit_df2 <- crit_df |>
left_join(df_icon_paths, by = "join_field") |>
mutate(Icon = icon) |>
mutate(Icon = ifelse(is.na(Icon), "./images/status_icons/hyphen-solid.png", Icon)) |>
select(-icon, -join_field)
```
::: {custom-style="Designation Recommendation"}
Designation Recommendation
:::
::: {custom-style="Designation Recommendation Text"}
`r df$desig_rec`
:::
# Background
```{r map, fig.width=3}
m <- create_map(center_shape = rgc_ctr)
m
```
`r df$info`
\
::: {custom-style="Table Caption"}
Evaluation of Regional Growth Centers Requirements
:::

```{r criteria table}
cft <- create_table(data_table = crit_df2)
cft
```
\
::: {custom-style="Comment Header"}
Jurisdiction Comments / Additional Context
:::