Mapping Trials

Using spatial visualization techniques available in R, 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 (install as needed).

library(foreign)
library(maps)
library(ggmap)
## Loading required package: ggplot2
dat <- read.dbf("~/Downloads/pennsylv/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"

For this assignment, create 5 maps. Each map should have an accompanying description that is detailed and clearly written. Make note of any spatial patterns or anomalies of hospital services in the state of PA. Upload these maps as a document to rpubs.com and submit that link the Moodle assignment.

Map 1: Hospitals counts and locations in Pennsylvania

Hospitals in Pennsylvania are generally scattered across the entire state, however, there are two major concentration zones. The first concentration is in the south eastern area of Pennsylvania, near Philadelphia. In There are 2 smaller zones here which have 25 and 20 hospitals. The second major concentration is in the south western area of Pennsylvania, near Pittsburgh. Only one of the zones here have a count of around 20 hospitals. However, it can be seen that the hospitals generally cover almost all of the state of Pennsylvania. This makes sense as even areas with low population require hospitals for their inhabitants

ggmap(get_map(geocode("Pennsylvania"),zoom = 7))+
stat_bin2d(aes(x, y), data = dat)
## Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=Pennsylvania&sensor=false
## Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=41.203322,-77.194525&zoom=7&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false

Map 2: Pet service in Pennsylvania

Pet services are concentrated around 3 major areas in Pennsylvania. The first and largest is Philadelphia, with Pittsburgh being second and Allentown third. Although the pet services do cover a large area of the state, there are some deadzones in the southern and northern regions of Pennsylvania.

pet <- subset(dat, pet=="Y")
qmplot(x, y, data =pet, colour = I('green'), size= I(3), darken=.1)
## Using zoom = 8...
## Map from URL : http://tile.stamen.com/toner-lite/8/70/94.png
## Map from URL : http://tile.stamen.com/toner-lite/8/71/94.png
## Map from URL : http://tile.stamen.com/toner-lite/8/72/94.png
## Map from URL : http://tile.stamen.com/toner-lite/8/73/94.png
## Map from URL : http://tile.stamen.com/toner-lite/8/74/94.png
## Map from URL : http://tile.stamen.com/toner-lite/8/70/95.png
## Map from URL : http://tile.stamen.com/toner-lite/8/71/95.png
## Map from URL : http://tile.stamen.com/toner-lite/8/72/95.png
## Map from URL : http://tile.stamen.com/toner-lite/8/73/95.png
## Map from URL : http://tile.stamen.com/toner-lite/8/74/95.png
## Map from URL : http://tile.stamen.com/toner-lite/8/70/96.png
## Map from URL : http://tile.stamen.com/toner-lite/8/71/96.png
## Map from URL : http://tile.stamen.com/toner-lite/8/72/96.png
## Map from URL : http://tile.stamen.com/toner-lite/8/73/96.png
## Map from URL : http://tile.stamen.com/toner-lite/8/74/96.png
## Map from URL : http://tile.stamen.com/toner-lite/8/70/97.png
## Map from URL : http://tile.stamen.com/toner-lite/8/71/97.png
## Map from URL : http://tile.stamen.com/toner-lite/8/72/97.png
## Map from URL : http://tile.stamen.com/toner-lite/8/73/97.png
## Map from URL : http://tile.stamen.com/toner-lite/8/74/97.png
## Warning: `panel.margin` is deprecated. Please use `panel.spacing` property
## instead

Map 3: Pharmacy locations in Philadelphia

Pharmacy locations were analyzed on the eastern side of the state, close to Philadelphia. There is a heavy concentration of pharmacies the closer it is to Philadelphia, which is expected. There is also a concentration in Allentown and Scranton. Pharmacies are scattered across the rest of the region, however, the northern area of the state has the smallest number of pharmacies.

pharmacy <- subset(dat, pharmacy =="Y")
qmap("philadelphia", maptype = "hybrid", zoom = 7)+
  geom_point(aes(x, y), data = pharmacy, colour = "orange", size = 2)
## Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=philadelphia&zoom=7&size=640x640&scale=2&maptype=hybrid&language=en-EN&sensor=false
## Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=philadelphia&sensor=false
## Warning: `panel.margin` is deprecated. Please use `panel.spacing` property
## instead
## Warning: Removed 73 rows containing missing values (geom_point).

Map 4: ICU beds numbers in Pennsylvania

The number of ICU beds are most concentrated in Philadelphia, Pittsburgh, and Allentown. Although Philadelphia has the larger concentration, the ICU beds seem to be more spread out in the city, whereas Pittsburgh has one area with 150 beds. There are also ICU beds throughout the rest of the state, however, there is an area in the northern part of the state without any ICU beds nearby. This area accounts for roughly 20% of the entire state.

qmplot(x, y, data = dat, color = I("blue"), size = icu_beds)
## Using zoom = 8...
## Warning: `panel.margin` is deprecated. Please use `panel.spacing` property
## instead
## Warning: Removed 208 rows containing missing values (geom_point).

qmap(“Eire,PA”,maptype(“roadmap”),zoom=14,main = “Liscenced Hospitalbeds in Eire PA”)+geom_point(aes(x,y,color=I(‘red’),size = lic_beds),data = penn)

Map 5:Hospitals in Philadelphia with organ bank

The city of Philadelphia was analyzed for hospitals that have organ banks. The results indicated either yes, no or not applicable. There are about 7 hospitals in the entire city that have organ banks. 4 of them are concentrated in the center of the city, while the other 3 are spread out towards the northern part of the city.

ggmap(get_map(location="Philadelphia", maptype="satellite", zoom=9))+geom_point(aes(x, y, colour = organ_bank), data = dat)
## Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=Philadelphia&zoom=9&size=640x640&scale=2&maptype=satellite&language=en-EN&sensor=false
## Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=Philadelphia&sensor=false
## Warning: Removed 181 rows containing missing values (geom_point).