library(tidycensus); library(tidyverse); library(sf)
## ── Attaching packages ────────────────────────────────── tidyverse 1.2.1 ──
## ✔ ggplot2 2.2.1.9000 ✔ purrr 0.2.5
## ✔ tibble 1.4.2 ✔ dplyr 0.7.5
## ✔ tidyr 0.8.1 ✔ stringr 1.3.1
## ✔ readr 1.1.1 ✔ forcats 0.3.0
## ── Conflicts ───────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## Linking to GEOS 3.6.1, GDAL 2.1.3, proj.4 4.9.3
v15_Profile <- load_variables(2015 , "acs5/profile", cache = TRUE) #demographic profile tables
v15_tables <- load_variables(2015 , "acs5", cache = TRUE) #all tables
#v10_sf1_tables <- load_variables(2010 , "sf1", cache = TRUE) #all tables for 2010 SF1
#v10_sf1_tables <- load_variables(2000 , "sf3", cache = TRUE) #all tables for 2000 SF#
#View(v15_Profile)
DP05_0066E: Estimate!!HISPANIC OR LATINO AND RACE!!Total population!!Hispanic or Latino (of any race) DP05_0066PE: is all hispanic population proportion DP04_0019E: Estimate of all Houses built between 2000 and 2009 DP04_0019PE : proportion of all Houses built between 2000 and 2009
Writing the files into local folders
sf::st_write(da_acs2,dsn="/Users/fikrewoldbitew/Google Drive/PhD_Courses/Summer 2018/GIS_class_2018/data",layer="sa_tract_dp", driver="ESRI Shapefile", delete_layer=T, update=T)
## Deleting layer `sa_tract_dp' using driver `ESRI Shapefile'
## Updating layer `sa_tract_dp' to data source `/Users/fikrewoldbitew/Google Drive/PhD_Courses/Summer 2018/GIS_class_2018/data' using driver `ESRI Shapefile'
## features: 527
## fields: 17
## geometry type: Multi Polygon
sf::st_write(ha_acs2,dsn="/Users/fikrewoldbitew/Google Drive/PhD_Courses/Summer 2018/GIS_class_2018/data",layer="sa_tract_dp", driver="ESRI Shapefile", delete_layer=T, update=T)
## Deleting layer `sa_tract_dp' using driver `ESRI Shapefile'
## Updating layer `sa_tract_dp' to data source `/Users/fikrewoldbitew/Google Drive/PhD_Courses/Summer 2018/GIS_class_2018/data' using driver `ESRI Shapefile'
## features: 784
## fields: 17
## geometry type: Multi Polygon
library(classInt)
library(patchwork)
library(dplyr)
library(ggplot2)
da_hisp_map<-da_acs2 %>%
mutate(phispanic = cut(hispanic,breaks=data.frame(classIntervals(var=da_acs2$hispanic, n=5, style="jenks")[2])[,1], include.lowest = T))
p1<-ggplot(da_hisp_map, aes(fill = phispanic, color = phispanic)) +
geom_sf() +
ggtitle("Proportion hispanic",
subtitle = "Dallas County Texas, 2015 - Jenks Breaks")+
coord_sf(crs = 102009) +
scale_fill_brewer(palette = "Blues") +
scale_color_brewer(palette = "Blues")+
theme(axis.text.x = element_blank(), axis.text.y = element_blank())
p1
library(classInt)
library(patchwork)
library(dplyr)
library(ggplot2)
ha_hisp_map<-ha_acs2 %>%
mutate(phispanic = cut(hispanic,breaks=data.frame(classIntervals(var=ha_acs2$hispanic, n=5, style="jenks")[2])[,1], include.lowest = T))
p2<-ggplot(ha_hisp_map, aes(fill = phispanic, color = phispanic)) +
geom_sf() +
ggtitle("Proportion hispanic",
subtitle = "Harris County Texas, 2015 - Jenks Breaks")+
coord_sf(crs = 102009) +
scale_fill_brewer(palette = "Blues") +
scale_color_brewer(palette = "Blues")+
theme(axis.text.x = element_blank(), axis.text.y = element_blank())
p2
library(classInt)
library(patchwork)
library(dplyr)
library(ggplot2)
da_hous_map<-da_acs2 %>%
mutate(phousing = cut(housing,breaks=data.frame(classIntervals(var=da_acs2$housing, n=5, style="jenks")[2])[,1], include.lowest = T))
p3<-ggplot(da_hous_map, aes(fill = phousing, color = phousing)) +
geom_sf() +
ggtitle("Proportion Houses built from 2000 to 2009",
subtitle = "Dallas County Texas, 2015 - Jenks Breaks")+
coord_sf(crs = 102009) +
scale_fill_brewer(palette = "Blues") +
scale_color_brewer(palette = "Blues")+
theme(axis.text.x = element_blank(), axis.text.y = element_blank())
p3
library(classInt)
library(patchwork)
library(dplyr)
library(ggplot2)
ha_hous_map<-ha_acs2 %>%
mutate(phousing = cut(housing,breaks=data.frame(classIntervals(var=ha_acs2$housing, n=5, style="jenks")[2])[,1], include.lowest = T))
p4<-ggplot(ha_hous_map, aes(fill = phousing, color = phousing)) +
geom_sf() +
ggtitle("Proportion Houses built from 2000 to 2009",
subtitle = "Harris County Texas, 2015 - Jenks Breaks")+
coord_sf(crs = 102009) +
scale_fill_brewer(palette = "Blues") +
scale_color_brewer(palette = "Blues")+
theme(axis.text.x = element_blank(), axis.text.y = element_blank())
p4
library(mapview)
library(RColorBrewer)
pal <- colorRampPalette(brewer.pal(6, "Blues")) #set colors
mapview(da_hisp_map["phispanic"], col.regions=pal, legend=T,map.types="OpenStreetMap", layer.name="% Hispanic")
library(mapview)
library(RColorBrewer)
pal <- colorRampPalette(brewer.pal(6, "Blues")) #set colors
mapview(ha_hisp_map["phispanic"], col.regions=pal, legend=T,map.types="OpenStreetMap", layer.name="% Hispanic")
The total hispanic population residing in Dallas county were (969,793 in 2015, comprising 37.7% of the total population); which was relatively lower than their corresponding counterparts residing in Harris county (1,809,773; comprising 41.5%).
A total of 137,478 houses were built between 2000 and 2009 in Dallas county, which were relatively lower than the total number of houses built in Harris county (359,314).
# Hispanic population in Dallas and Harris County
sum(da_acs2$nhispanic)
## [1] 969793
sum(ha_acs2$nhispanic)
## [1] 1809773
summary(da_acs2$hispanic)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.00 16.20 33.50 37.65 57.00 96.20
summary(ha_acs2$hispanic)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.00 20.68 35.70 41.50 60.40 97.40
# Housing in Dallas and Harris County
sum(da_acs2$nhousing)
## [1] 137478
sum(ha_acs2$nhousing)
## [1] 359314
summary(da_acs2$housing)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.00 2.15 6.80 12.75 18.50 83.50
summary(ha_acs2$housing)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.00 3.50 11.65 17.65 26.12 90.60