Using the spatial visualization techniques, explore this data set on Pennsylvania hospitals (http://www.arcgis.com/home/item.html?id=eccee5dfe01e4c4283c9be0cfc596882). Create a series of 5 maps that highlight spatial differences in hospital service coverage for the state of PA.
To help you in getting the data imported into R, I have included the code below:
To import the data I use the foreign package, if you do not have it than be sure to install it prior to testing the code.
The dataset contains a number of variables about each hospital, many of there are clear and straight forward.
Now create 5 maps, including decriptions, that highlight the spatial distribution of hosptical services in the state of PA. Upload these maps as a document to rpubs.com and submit that link the Moodle assignment.
library(ggplot2)
library(ggmap)
## Warning: package 'ggmap' was built under R version 3.4.4
library(foreign)
dat <- read.dbf("C:/Users/Calmth of Life/Dropbox/Harrisburg Semesters/ANLY 512/Problem Set 5/pennsylv/pennsylv.dbf")
names(dat)
## [1] "acc_trauma" "air_amb" "als" "arc_street" "arc_zone"
## [6] "bas_ls" "bassinets" "bb_id" "bc_beds" "bc_sus_bed"
## [11] "beds_sus" "birthing_r" "bone_marro" "burn_car" "burn_care"
## [16] "card_beds" "card_surge" "card_sus_b" "cardiac" "cardiac_ca"
## [21] "cardio_reh" "chemo" "city" "clin_lab" "clin_psych"
## [26] "county" "countyname" "ct_scan" "cty_key" "cystoscopi"
## [31] "deliv_rms" "dental" "detox_alc_" "diag_radio" "diag_xray"
## [36] "doh_hosp" "doh_phone" "emer_dept" "endoscopie" "fac_id"
## [41] "facility" "flu_old" "fred_con_1" "fred_conta" "fred_email"
## [46] "fred_fax" "fred_hosp" "fred_pager" "fred_phone" "gamma_knif"
## [51] "gen_outpat" "gene_counc" "heart_tran" "helipad" "hemodial_c"
## [56] "hemodial_m" "hosp_id" "hospice" "hyper_cham" "icu"
## [61] "icu_beds" "icu_sus_be" "inpat_flu_" "inpat_pneu" "kidney_tra"
## [66] "labor_rms" "lic_beds" "lic_dent" "lic_dos" "lic_mds"
## [71] "lic_pod" "linear_acc" "lithotrips" "liver_tran" "loc_method"
## [76] "ltc" "mcd" "mcd_key" "mcd_name" "medical"
## [81] "mob_ccu" "mob_icu" "mri" "ms1" "neo2_beds"
## [86] "neo2_sus_b" "neo3_beds" "neo3_sus_b" "neuro_surg" "neurology"
## [91] "obs_gyn" "occ_ther" "optometry" "organ_bank" "ped_trauma"
## [96] "pediatric" "pet" "pharmacy" "phys_med" "phys_ther"
## [101] "podiatry" "providerid" "psych" "psych_inpa" "reg_trauma"
## [106] "resp_ther" "so_flu_65u" "social_wor" "speech_pat" "street"
## [111] "surgical" "surgical_s" "thera_radi" "typ_org" "typ_serv"
## [116] "ultrasound" "x" "y" "zip"
This map shows hospitals in PA with heart transplant surgery capability
heart_transplant = subset(dat, heart_tran == "Y")
qmplot(x, y, data = heart_transplant, legend = "none", colour= I('blue'), mapcolor = "color", extent = "panel", main = "Hospitals in PA with Heart Transplant Surgery Capability", xlab = "Longitude", ylab = "Latitude", source = 'google', maptype = 'roadmap', zoom = 6)
## Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=40.20258,-77.577704&zoom=6&size=640x640&scale=2&maptype=roadmap&language=en-EN&sensor=false
This map shows hospitals in Philadelphia with chemotherapy capability
chemotherapy = subset(dat, chemo == "Y")
chemoPA = subset(chemotherapy, county == "Philadelphia")
qmplot(x, y, data = chemoPA, legend = "none", colour= I('red'), mapcolor = "color", extent = "panel", main = "Hospitals in Philadelphia with Chemotherapy Capability", xlab = "Longitude", ylab = "Latitude", source = 'google', maptype = 'terrain', zoom = 12)
## Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=40.012589,-75.136495&zoom=12&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false
This map shows hospitals in Pittsburgh with organ bank
organbank = subset(dat, organ_bank=="Y")
organbankPI = subset(organbank, city == "Pittsburgh")
qmplot(x,y, data = organbankPI, colour = I('orange'), size = I(4), zoom = 10, extent = "panel", source = "google", maptype = "toner", main = "Hospitals in Pittsburgh with Organ Bank", xlab = "Longitude", ylab = "Latitude")
## maptype = "toner" is only available with source = "stamen".
## resetting to source = "stamen"...
## Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=40.499521,-80.002839&zoom=10&size=640x640&scale=2&maptype=terrain&sensor=false
## Map from URL : http://tile.stamen.com/toner/10/283/384.png
## Map from URL : http://tile.stamen.com/toner/10/284/384.png
## Map from URL : http://tile.stamen.com/toner/10/285/384.png
## Map from URL : http://tile.stamen.com/toner/10/283/385.png
## Map from URL : http://tile.stamen.com/toner/10/284/385.png
## Map from URL : http://tile.stamen.com/toner/10/285/385.png
## Map from URL : http://tile.stamen.com/toner/10/283/386.png
## Map from URL : http://tile.stamen.com/toner/10/284/386.png
## Map from URL : http://tile.stamen.com/toner/10/285/386.png
## Map from URL : http://tile.stamen.com/toner/10/283/387.png
## Map from URL : http://tile.stamen.com/toner/10/284/387.png
## Map from URL : http://tile.stamen.com/toner/10/285/387.png
This map shows hospitals in Dauphin county with neurosurgery capability
neurosur = subset(dat, neuro_surg == "Y")
neurosurDA = subset(neurosur, county == "Dauphin")
qmplot(x,y, data = neurosurDA, colour = I('tomato1'), size = I(4), zoom = 10, extent = "panel", source = "google", maptype = "roadmap", main = "Hospitals in Dauphin County with Neurosurgery capability", xlab = "Longitude", ylab = "Latitude")
## Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=40.263754,-76.674842&zoom=10&size=640x640&scale=2&maptype=roadmap&language=en-EN&sensor=false
This map shows hospitals in Erie with optometry
opt = subset(dat, optometry == "Y")
optE = subset(opt, city == "Erie")
qmplot(x,y, data = optE, colour = I('seagreen1'), size = I(4), zoom = 8, extent = "panel", source = "google", maptype = "hybrid", main = "Hospitals in Erie with Optometry", xlab = "Longitude", ylab = "Latitude")
## Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=42.133605,-80.087098&zoom=8&size=640x640&scale=2&maptype=hybrid&language=en-EN&sensor=false