Loading Data

library(foreign)
library(ggplot2)
library(ggmap)
## Google's Terms of Service: https://cloud.google.com/maps-platform/terms/.
## Please cite ggmap if you use it! See citation("ggmap") for details.
hospital <- read.dbf("~/Google Drive/Harrisburg U/ANLY 512/Problem Set 5/pennsylv/pennsylv.dbf")

Locations with Ultra sound services

Ultra <- subset(hospital, ultrasound == "Y")

register_google(key = "AIzaSyBtYhbIcj15sgOi3XJ8UIISn-akXQ_w4SY")
qmplot(x, y, data = Ultra, legend = "none", colour= I('orange'), mapcolor = "color",extent = "panel",darken = 0.1, main = "Hospital With Ultra Sound", xlab = "Longitude", ylab = "Latitude", source = 'google', maptype = 'terrain', size = I(1), zoom = 7)
## Source : https://maps.googleapis.com/maps/api/staticmap?center=40.942648,-77.681596&zoom=7&size=640x640&scale=2&maptype=terrain&language=en-EN&key=xxx-akXQ_w4SY
## Warning in get_googlemap(center = location, zoom = zoom, maptype =
## maptype, : HTTP 400 Bad Request

Hospitals in City Area

CityHospital <- subset(hospital, city == "Philadelphia")
qmplot(x,y,data = CityHospital, size = 5, darken = 0.5, extent = "normal", main = "Hospitals in Philadelphia City Area",xlab = "longitude",ylab = "latitude")
## Using zoom = 12...
## Source : http://tile.stamen.com/terrain/12/1191/1549.png
## Source : http://tile.stamen.com/terrain/12/1192/1549.png
## Source : http://tile.stamen.com/terrain/12/1193/1549.png
## Source : http://tile.stamen.com/terrain/12/1194/1549.png
## Source : http://tile.stamen.com/terrain/12/1195/1549.png
## Source : http://tile.stamen.com/terrain/12/1191/1550.png
## Source : http://tile.stamen.com/terrain/12/1192/1550.png
## Source : http://tile.stamen.com/terrain/12/1193/1550.png
## Source : http://tile.stamen.com/terrain/12/1194/1550.png
## Source : http://tile.stamen.com/terrain/12/1195/1550.png
## Source : http://tile.stamen.com/terrain/12/1191/1551.png
## Source : http://tile.stamen.com/terrain/12/1192/1551.png
## Source : http://tile.stamen.com/terrain/12/1193/1551.png
## Source : http://tile.stamen.com/terrain/12/1194/1551.png
## Source : http://tile.stamen.com/terrain/12/1195/1551.png

Hospital with MRI in Philadelphia

CityHospital_MRI <- subset(CityHospital, mri == "Y")

qmplot(x, y, data = CityHospital_MRI, color = I('blue'), size = 4, darken = .4, extent = "device", main = "Hospitals with MRI", xlab = "Longitude", ylab = "Latitude")
## Using zoom = 12...

Hospital With Trauma Unit

Trauma <- subset(hospital, acc_trauma == "Y")

qmplot(x, y, data = Trauma, color = I('red'), size = 4, darken = .4, extent = "device", main = "Hospitals with Trauma Units", xlab = "Longitude", ylab = "Latitude")
## Using zoom = 8...
## Source : http://tile.stamen.com/terrain/8/70/94.png
## Source : http://tile.stamen.com/terrain/8/71/94.png
## Source : http://tile.stamen.com/terrain/8/72/94.png
## Source : http://tile.stamen.com/terrain/8/73/94.png
## Source : http://tile.stamen.com/terrain/8/74/94.png
## Source : http://tile.stamen.com/terrain/8/70/95.png
## Source : http://tile.stamen.com/terrain/8/71/95.png
## Source : http://tile.stamen.com/terrain/8/72/95.png
## Source : http://tile.stamen.com/terrain/8/73/95.png
## Source : http://tile.stamen.com/terrain/8/74/95.png
## Source : http://tile.stamen.com/terrain/8/70/96.png
## Source : http://tile.stamen.com/terrain/8/71/96.png
## Source : http://tile.stamen.com/terrain/8/72/96.png
## Source : http://tile.stamen.com/terrain/8/73/96.png
## Source : http://tile.stamen.com/terrain/8/74/96.png
## Source : http://tile.stamen.com/terrain/8/70/97.png
## Source : http://tile.stamen.com/terrain/8/71/97.png
## Source : http://tile.stamen.com/terrain/8/72/97.png
## Source : http://tile.stamen.com/terrain/8/73/97.png
## Source : http://tile.stamen.com/terrain/8/74/97.png

Hospital With Dental Service

Dental <- subset(hospital,  dental == "Y")

qmplot(x, y, data = Dental, color= I('green'), size = 4, darken = .4, extent = "device", main = "Hospitals with Dental", xlab = "Longitude", ylab = "Latitude")
## Using zoom = 8...