-
Notifications
You must be signed in to change notification settings - Fork 0
/
2018 House Predict Prep.Rmd
43 lines (35 loc) · 1.06 KB
/
2018 House Predict Prep.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
---
title: "2018 House Predict Prep"
author: "Scott Onestak"
date: "June 3, 2018"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r libraries}
library(rgdal)
library(ggplot2)
library(ggmap)
library(dplyr)
library(maptools)
library(raster)
```
```{r pa shapefile}
state = "PA"
thefile = gsub("'", '"',paste("C:/Users/onest/Desktop/districts-gh-pages/districts-gh-pages/cds/2018/",state,"-18","/shape.geojson",sep=''))
test = geojsonio::geojson_read(thefile,what="sp")
assign(paste("PA",1,sep=""),test)
PA = fortify(test)
PA_map = ggplot(PA,aes(x=long,y=lat,group=group)) +
geom_polygon(color = 'black',fill='white',size=1,aes(group=group)) +
theme(panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.background = element_blank(),
axis.line = element_blank(),
axis.title = element_blank(),
axis.text = element_blank(),
axis.ticks = element_blank())
print(PA_map)
write.csv(PA,file="PA.csv",row.names = F)
```