-
Notifications
You must be signed in to change notification settings - Fork 1
/
project_timelines_generic.Rmd
77 lines (57 loc) · 2.35 KB
/
project_timelines_generic.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
---
title: "MHK_Timeline_General_Timeframe"
output:
html_document:
self_contained: false
mathjax: null
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
Using [MHK Project Timeline Input - Google Sheets](https://docs.google.com/spreadsheets/d/1HC5hXyi2RQSHevnV7rvyk748U5-X3iUw70ewHEfrHm0/edit#gid=793817660)
```{r}
library(dplyr)
#library(htmltools)
#library(htmlwidgets)
#library(jsonlite)
#library(plotly)
#library(ggplot2)
#library(ggiraph)
#library(RColorBrewer)
#get the data
csv_key <- "1HC5hXyi2RQSHevnV7rvyk748U5-X3iUw70ewHEfrHm0"
csv_url <- glue::glue("https://docs.google.com/spreadsheets/d/{csv_key}/gviz/tq?tqx=out:csv&sheet=0")
d <- readr::read_csv(csv_url) %>%
select(-starts_with("X"))
```
Data Cleaning
```{r}
#sort data by permit type
d$permit_type <- factor(d$permit_type, levels = c("Notice of Intent/Preliminary Permit Application", 'Draft Pilot License App', 'Final Pilot License App', "Draft License App", "Final License App", 'Environmental Assessment', 'Settlement Agreement', "Permit Issued"))
d$technology_type <- factor(d$technology_type, levels = c('Riverine Energy', 'Tidal Energy', 'Wave Energy'))
#data cleanup
d_gen <- d %>%
filter(!is.na(date_beg)) %>%
tidyr::pivot_longer(c(date_beg, date_end), names_to = "proj_ev", values_to = "proj_ev_date") %>%
mutate(
proj_ev_date = as.Date(proj_ev_date, format = "%m/%d/%Y")) %>%
arrange(project_number, project_name) %>%
select(project_name, project_number, proj_ev, proj_ev_date, technology_type)
#data cleanup
d_permits <- d %>%
filter(!is.na(permit_type)) %>%
rename(., proj_ev = permit_type,
proj_ev_date = license_date) %>%
mutate(
proj_ev_date = as.Date(proj_ev_date, format = "%m/%d/%Y")) %>%
arrange(proj_ev, project_number, project_name, proj_ev_date) %>%
select(project_name, project_number, proj_ev, proj_ev_date, technology_type)
#combine into single dataset
d_all <- bind_rows(d_gen, d_permits)
d_all_w<- d_all %>%
tidyr::pivot_wider(names_from = proj_ev, values_from = proj_ev_date) %>%
relocate(date_end, .after = last_col())
#TO DO N SWANSON: calculate typical time intervals between project events/permits
# How should the two WET environmental assessments with different dates be handled?
# Are the settlement agreement and environmental assessment date markers important for calculating typical permitting time?
```