-
Notifications
You must be signed in to change notification settings - Fork 0
/
vizome_map.Rmd
142 lines (121 loc) · 4.42 KB
/
vizome_map.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
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
137
138
139
140
141
---
title: "Vizome dissemination map figure for U24 grant"
author: "Pierrette Lo"
date: "11/7/2019"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(tidyverse)
library(fiftystater)
library(viridis)
```
Data sources:
- U54 DSRN: https://ncihub.org/groups/drsn
- CTD2: https://ocg.cancer.gov/programs/ctd2/centers
- CTSA (CD2H): https://ncats.nih.gov/files/ctsa-funding-information.pdf
- click on Hub awards for 2019 (60 UL1 awards), export from NIH RePORTER
- NCI-Designated Cancer Centers (CI4CC): https://cancercenters.cancer.gov/Center/CCList
- Look up partner centers on Google Maps -> right click -> What's here? -> c&p lat & long
Excel cleaning:
- Pulled data and mostly manually inputted states for each center
- Quick manual correction for centers with multiple spellings/wordings of name - C&P one version for all
Read in data
```{r}
data <- readxl::read_xlsx("centers.xlsx")
point_data <- readxl::read_xlsx("partner_coords.xlsx")
```
Clean up center data
```{r}
# make lookup table to convert state abbs to names from {state} dataset
# add dc from {fifty_states} (not contained in {state})
state_lookup <- data.frame(state.abb, state = tolower(state.name), stringsAsFactors = F) %>%
rbind(c("DC", "district of columbia"))
# add full state names to centers
centers <- data %>%
left_join(state_lookup, by = c("state_abb" = "state.abb"))
# lowercase center names for consistency
centers$center <- tolower(centers$center)
```
Version 1: format data for mapping, all states coloured
```{r}
# remove duplicate centers (so plotting no. of unique centers per state)
# get center count per state
# add missing states (center_count will = NA), otherwise there will be holes in the map
mapdata <- centers %>%
distinct(center, .keep_all = T) %>%
group_by(state) %>%
summarize(center_count = n()) %>%
ungroup() %>%
right_join(state_lookup, by = "state")
# replace NAs with 0
mapdata$center_count <- replace_na(mapdata$center_count, 0)
```
Version 2: keep states with 0 centers separate so they can be grey
```{r}
mapdata2 <- centers %>%
distinct(center, .keep_all = T) %>%
group_by(state) %>%
summarize(center_count = n()) %>%
ungroup()
zero_states <- state_lookup %>%
anti_join(mapdata2, by = "state")
```
Add state counts to point data
```{r}
point_data <- point_data %>%
add_count(state_abb)
```
Version 1 map:
unique centers per state (network + partners)
plot partner locations on top (size by number since a couple in PDX, seattle, etc. are overlapping)
```{r}
mapdata %>%
ggplot() +
geom_map(aes(map_id = state, fill = center_count),
map = fifty_states, color = "white") +
geom_point(data = point_data,
aes(x = long, y = lat, size = n),
shape = 21, fill = "darkorange") +
expand_limits(x = fifty_states$long, y = fifty_states$lat) +
coord_map() +
scale_fill_viridis(breaks = c(0, 5, 10, 15),
name = "Network centers\nper state") +
scale_x_continuous(breaks = NULL) +
scale_y_continuous(breaks = NULL) +
scale_size_continuous(breaks = c(1, 2),
range = c(3,5),
name = "Collaborators\nper state") +
labs(x = NULL, y = NULL) +
theme(panel.background = element_blank(),
plot.caption = element_text(hjust = 0.5, size = 10))
ggsave("vizome_map.png", height = 5, width = 9)
```
Version 2 map: zero_states are grey (easier to see)
```{r}
ggplot() +
geom_map(data = mapdata2,
aes(map_id = state, fill = center_count),
map = fifty_states, color = "white") +
geom_map(data = zero_states,
aes(map_id = state),
map = fifty_states,
fill = "lightgrey",
color = "white") +
geom_point(data = point_data,
aes(x = long, y = lat, size = n),
shape = 21, fill = "darkorange") +
expand_limits(x = fifty_states$long, y = fifty_states$lat) +
coord_map() +
scale_fill_viridis(breaks = c(1, 7, 13),
name = "Network centers\nper state\n(grey = 0)") +
scale_x_continuous(breaks = NULL) +
scale_y_continuous(breaks = NULL) +
scale_size_continuous(breaks = c(1, 2),
range = c(3,5),
name = "Collaborators\nper state") +
labs(x = NULL, y = NULL) +
theme(panel.background = element_blank(),
plot.caption = element_text(hjust = 0.5, size = 10))
ggsave("vizome_map_withgrey.png", height = 5, width = 9)
```