-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDRC_HZ_Map.Rmd
More file actions
104 lines (79 loc) · 2.28 KB
/
DRC_HZ_Map.Rmd
File metadata and controls
104 lines (79 loc) · 2.28 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
---
title: "DRC_HZ_Map"
author: "Andrea Quevedo"
date: "10/17/2019"
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
require(tidyverse)
require(ggthemes)
require(ggvoronoi)
require(deldir)
require(maptools)
require(rgdal)
require(sf)
require(sp)
require(plyr)
require(ggplot2)
theme_set(theme_bw())
```
#Reading shape file
```{r}
#Setting unique paths
Andrea <- '/Users/andreaquevedo/Documents/Georgetown/Fall_2019/TA/'
#Reading file
DRC_path<- paste(Andrea,"dviz/rdc_zone_de_sante_09092019/", sep="")
DRC_shape <-"RDC_Zone_de_sante_09092019.shp"
DRC_file <- paste(DRC_path, DRC_shape, sep="")
DRC_shp <- rgdal::readOGR(DRC_file)
```
## Converting shapefile to dataframe for use in ggplot2
```{r}
DRC_shp_df <- fortify(DRC_shp)
```
## Plotting Map
```{r, fig.height=3,fig.width=3}
map_DRC <- ggplot() +
geom_sf() +
coord_sf(crs= "+proj=longlat +datum=WGS84",xlim = c(27.5, 30.7), ylim = c(-1.8,2), expand = TRUE)+
geom_path(data = DRC_shp_df,
aes(x = long, y = lat, group = group),
color = 'black', size = .15)+
ggtitle("DRC Health Centers by Health Zones: North Kivu & Ituri")+
theme_map()
print(map_DRC)
```
#Reading health center data
```{r}
HZ <- readr::read_csv(paste(Andrea,'dviz/health_centers.csv', sep=""))
HZ<-distinct(HZ, LATITUDE,LONGITUDE, .keep_all= TRUE)
```
#Reading ebola data
```{r}
EB <- readr::read_csv(paste(Andrea,'dviz/Data_ DRC Ebola Outbreak, North Kivu and Ituri - MOH-By-Health-Zone.csv', sep=""))
```
```{r,fig.height=3,fig.width=3}
map_DRC_HZ<-
map_DRC +
geom_point(data=HZ, aes(x=LONGITUDE, y=LATITUDE),
size=.5, alpha=0.8, color='blue', inherit.aes = FALSE)
print(map_DRC_HZ)
```
```{r,fig.height=3,fig.width=3}
voronoi <- deldir(HZ$LONGITUDE, HZ$LATITUDE) #deldir package to compute the Voronoi tesselation
map_DRC_HZ_v<-
map_DRC +
geom_segment(
aes(x = x1, y = y1, xend = x2, yend = y2),
size = 0.25,
data = voronoi$dirsgs,
linetype = 1,
color= "#a5a5a5")+
geom_point(data=HZ, aes(x=LONGITUDE, y=LATITUDE),
size=0.5, alpha=0.8, color='blue', inherit.aes = FALSE)
print(map_DRC_HZ_v)
```
```{r,fig.height=3,fig.width=3}
map_DRC_HZ+geom_voronoi(aes(x=HZ$LONGITUDE, y=HZ$LATITUDE),fill='#FFFFFF00', na.rm= TRUE, color= '#a5a5a5', size=0.25)
```