-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreport-mic.Rmd
More file actions
136 lines (99 loc) · 3.35 KB
/
Copy pathreport-mic.Rmd
File metadata and controls
136 lines (99 loc) · 3.35 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
126
127
128
129
130
131
132
133
134
135
136
---
title: "`r params$center_name_clean`"
output:
officedown::rdocx_document:
reference_docx: custom-reference-doc-rmd-mic.docx
params:
center: "Ballard-Interbay"
filename: "Ballard-Interbay"
center_name_clean: "City of Seattle Ballard-Interbay"
---
```{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 params$center` Manufacturing/Industrial Center"
```
```{r}
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-mic.xlsx")|>
filter(center_name == params$center) |>
mutate(core_ind_uses = str_replace(core_ind_uses, "\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-mic.xlsx")
# shapes
wgs84 <- 4326
rgc_shp <- readRDS("data/mics.rds")
rgc_ctr <- rgc_shp |>
st_transform(wgs84) |>
filter(name_monitoring == params$center)
```
```{r prep table}
df_filled <- df |>
select(center_name, center_type, existing_jobs, planned_jobs, industrial_employment, size, transit_service, core_ind_uses, ind_ret_strategies, 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-mic.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_alt_text <- paste("A map of", params$center,"with the manufacturing/industrial center outlined in pink")
```
```{r map, fig.width=3, fig.alt=map_alt_text}
m <- create_map(center_shape = rgc_ctr)
m
```
`r df$info`
\
::: {custom-style="Table Caption"}
Evaluation of Manufacturing/Industrial Centers Requirements
:::
<!--  -->
```{r, fig.height= .5, fig.width=6.5, fig.align="left", fig.alt = "A key for the Status Icons. A green checkmark means 'on track'; a yellow triangle with an exclamation mark inside means 'needs improvement'; a red circle with a line across it means 'does not meet criteria'; a grey dash means 'not applicable.'."}
knitr::include_graphics("images/status_icons/legend.png")
```
```{r criteria table}
cft <- create_table(data_table = crit_df2)
cft
```
\
::: {custom-style="Comment Header"}
Jurisdiction Comments / Additional Context
:::