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.
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.
library(foreign)
dat <- read.dbf("C:/Users/Richy/Downloads/pennsylv.dbf")
The dataset contains a number of variables about each hospital, many of them are clear and straight forward.
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"
I focussed on accident trauma hospitals in the Pennsylvania dataset.
There are around 32 hospitals spread around PA that have accident trauma care, with a higher concentration around Philadelphia.
subset1 <- subset(dat, acc_trauma == "Y")
qmplot(x, y, data = subset1, source = "google", maptype = "roadmap", legend = "none", colour = I("red"), mapcolor = "color", extent = "panel", main = "Accident Trauma Hospitals in PA", xlab = "Longitute", ylab = "Latitude", zoom = 7, , size = I(3))
## Source : https://maps.googleapis.com/maps/api/staticmap?center=40.995052,-77.505472&zoom=7&size=640x640&scale=2&maptype=roadmap&language=en-EN&key=xxx-_9A77SuWa663qWHVIE9PZTupA
Looking deeper at Philly, there are 8 accident trauma hospitals, with 4 hospitals around the downtown area.
subset2 <- subset(subset1, county == "Philadelphia")
qmplot(x, y, data = subset2, source = "google", maptype = "roadmap", legend = "none", colour = I("red"), mapcolor = "color", extent = "panel", main = "Accident Trauma Hospitals in Philly", xlab = "Longitute", ylab = "Latitude", zoom = 11, size = I(3))
## Source : https://maps.googleapis.com/maps/api/staticmap?center=40.009619,-75.087825&zoom=11&size=640x640&scale=2&maptype=roadmap&language=en-EN&key=xxx-_9A77SuWa663qWHVIE9PZTupA
Typically in accident trauma cases, MRI and surgery are important steps, followed by physical therapy to complete rehabilitation. Hence, I focussed on these 3 aspects in the data.
7 out of 8 accident trauma hospitals had MRI facilities.
subset3 <- subset(subset2, mri == "Y")
qmplot(x, y, data = subset3, source = "google", maptype = "roadmap", legend = "none", colour = I("red"), mapcolor = "color", extent = "panel", main = "Accident Trauma Hospitals with MRI Facilities in Philly", xlab = "Longitute", ylab = "Latitude", zoom = 12, size = I(3))
## Source : https://maps.googleapis.com/maps/api/staticmap?center=39.992417,-75.159234&zoom=12&size=640x640&scale=2&maptype=roadmap&language=en-EN&key=xxx-_9A77SuWa663qWHVIE9PZTupA
5 out of 8 accident trauma hospitals had surgical facilities.
subset4 <- subset(subset2, surgical == "Y")
qmplot(x, y, data = subset4, source = "google", maptype = "roadmap", legend = "none", colour = I("red"), mapcolor = "color", extent = "panel", main = "Accident Trauma Hospitals with Surgical Facilities in Philly", xlab = "Longitute", ylab = "Latitude", zoom = 12, size = I(3))
## Source : https://maps.googleapis.com/maps/api/staticmap?center=39.992417,-75.16827&zoom=12&size=640x640&scale=2&maptype=roadmap&language=en-EN&key=xxx-_9A77SuWa663qWHVIE9PZTupA
7 out of 8 accident trauma hospitals had physical therapy facilities.
subset5 <- subset(subset2, phys_ther == "Y")
qmplot(x, y, data = subset5, source = "google", maptype = "roadmap", legend = "none", colour = I("red"), mapcolor = "color", extent = "panel", main = "Accident Trauma Hospitals with Physical Therapy Facilities in Philly", xlab = "Longitute", ylab = "Latitude", zoom = 12, size = I(3))
## Source : https://maps.googleapis.com/maps/api/staticmap?center=39.992417,-75.159234&zoom=12&size=640x640&scale=2&maptype=roadmap&language=en-EN&key=xxx-_9A77SuWa663qWHVIE9PZTupA
5 out of 8 accident trauma hospitals had MRI, surgical and physical therapy facilities. I would suggest these 5 hospitals as they have a complete set of facilities to treat and rehab accident trauma patients.
subset6 <- subset(subset2, phys_ther == "Y" & surgical == "Y" & mri == "Y")
qmplot(x, y, data = subset6, source = "google", maptype = "roadmap", legend = "none", colour = I("red"), mapcolor = "color", extent = "panel", main = "Accident Trauma Hospitals with MRI, Surgical and Physical Therapy Facilities in Philly", xlab = "Longitute", ylab = "Latitude", zoom = 12, size = I(3))
## Source : https://maps.googleapis.com/maps/api/staticmap?center=39.992417,-75.16827&zoom=12&size=640x640&scale=2&maptype=roadmap&language=en-EN&key=xxx-_9A77SuWa663qWHVIE9PZTupA