Objectives

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.

library(foreign)
data= read.dbf("/Users/deepikagrover/Documents/Pennsylvaniahospitals/pennsylv.dbf") 
summary(data)
##  acc_trauma air_amb      als                   arc_street     arc_zone  
##  N:243      N   :226   N   :212   1 Hospital Dr     :  4   18702  :  6  
##  Y: 32      Y   : 23   Y   : 37   100 N Academy Ave :  2   15213  :  5  
##             NA's: 26   NA's: 26   1001 S George St  :  2   19104  :  5  
##                                   1086 Franklin St  :  2   16602  :  4  
##                                   1500 Lansdowne Ave:  2   16507  :  3  
##                                   250 S 21st St     :  2   17042  :  3  
##                                   (Other)           :261   (Other):249  
##   bas_ls      bassinets         bb_id        bc_beds        bc_sus_bed   
##  N   :220   Min.   : 3.00   1      :  1   Min.   : 7.00   Min.   : 7.00  
##  Y   : 29   1st Qu.:10.75   100    :  1   1st Qu.:10.25   1st Qu.:10.25  
##  NA's: 26   Median :15.00   101    :  1   Median :14.00   Median :14.50  
##             Mean   :18.28   102    :  1   Mean   :13.33   Mean   :13.33  
##             3rd Qu.:22.00   103    :  1   3rd Qu.:17.00   3rd Qu.:16.50  
##             Max.   :80.00   104    :  1   Max.   :18.00   Max.   :18.00  
##             NA's   :171     (Other):269   NA's   :269     NA's   :269    
##     beds_sus        birthing_r     bone_marro burn_car   burn_care 
##  Min.   :  10.0   Min.   : 1.000   N   :237   N   :228   N   :243  
##  1st Qu.:  50.0   1st Qu.: 3.000   Y   : 12   Y   : 21   Y   :  6  
##  Median : 102.0   Median : 4.000   NA's: 26   NA's: 26   NA's: 26  
##  Mean   : 164.8   Mean   : 5.961                                   
##  3rd Qu.: 209.2   3rd Qu.: 7.000                                   
##  Max.   :1485.0   Max.   :22.000                                   
##  NA's   :31       NA's   :224                                      
##    card_beds      card_surge   card_sus_b     cardiac    cardiac_ca cardio_reh
##  Min.   :  6.00   N   :189   Min.   :  4.00   N   :204   N   :153   N   :118  
##  1st Qu.: 10.00   Y   : 60   1st Qu.: 10.00   Y   : 45   Y   : 96   Y   :131  
##  Median : 12.00   NA's: 26   Median : 12.00   NA's: 26   NA's: 26   NA's: 26  
##  Mean   : 22.98              Mean   : 21.82                                   
##  3rd Qu.: 22.00              3rd Qu.: 19.00                                   
##  Max.   :189.00              Max.   :177.00                                   
##  NA's   :230                 NA's   :230                                      
##   chemo               city     clin_lab   clin_psych          county   
##  N   :119   Philadelphia: 39   N   : 62   N   :123   Philadelphia: 39  
##  Y   :130   Pittsburgh  : 22   Y   :187   Y   :126   Allegheny   : 32  
##  NA's: 26   Allentown   :  7   NA's: 26   NA's: 26   Montgomery  : 14  
##             Erie        :  7                         Lehigh      : 11  
##             Wilkes-Barre:  6                         Chester     : 10  
##             Altoona     :  4                         Luzerne     :  9  
##             (Other)     :190                         (Other)     :160  
##         countyname  ct_scan       cty_key    cystoscopi   deliv_rms     
##  Philadelphia: 40   N   : 80   42101  : 40   N   :174   Min.   : 1.000  
##  Allegheny   : 32   Y   :169   42003  : 32   Y   : 75   1st Qu.: 1.000  
##  Montgomery  : 14   NA's: 26   42091  : 14   NA's: 26   Median : 2.000  
##  Lehigh      : 11              42077  : 11              Mean   : 2.234  
##  Chester     : 10              42029  : 10              3rd Qu.: 2.000  
##  Luzerne     :  9              42079  :  9              Max.   :12.000  
##  (Other)     :159              (Other):159              NA's   :228     
##   dental    detox_alc_ diag_radio diag_xray  doh_hosp      doh_phone  
##  N   :222   N   :205   N   : 96   N   : 52   N: 20    7177823131:  2  
##  Y   : 27   Y   : 44   Y   :153   Y   :197   Y:255    8148892011:  2  
##  NA's: 26   NA's: 26   NA's: 26   NA's: 26            2152336200:  1  
##                                                       2152488200:  1  
##                                                       2153324500:  1  
##                                                       (Other)   :250  
##                                                       NA's      : 18  
##  emer_dept  endoscopie     fac_id                              facility  
##  N   : 87   N   :125   0      : 17   Altoona Regional Health System:  2  
##  Y   :162   Y   :124   0618   :  3   Pinnacle Health Hospitals     :  2  
##  NA's: 26   NA's: 26   0128   :  2   Abington Memorial Hospital    :  1  
##                        0836   :  2   Albert Einstein Medical Center:  1  
##                        1037   :  2   Alle-Kiski Medical Center     :  1  
##                        0020   :  1   Allegheny General Hospital    :  1  
##                        (Other):248   (Other)                       :267  
##  flu_old                               fred_con_1             fred_conta 
##  N   : 33   Emergency Management Coordinator:  4   Armand Alessi   :  2  
##  Y   :216   ER Nurse Manager                :  4   Chris Coforio   :  2  
##  NA's: 26   Nurse Manager                   :  4   Mike Rosensteel :  2  
##             Safety Officer                  :  4   Steve Jakubcanin:  2  
##             Administrator                   :  3   Adam Bakaj      :  1  
##             (Other)                         :171   (Other)         :235  
##             NA's                            : 85   NA's            : 31  
##                          fred_email        fred_fax   fred_hosp
##  bburger@selectmedicalcorp.com:  3   6103941853:  2   N:  6    
##  armand.alessi@crozer.org     :  2   7249837568:  2   Y:269    
##  brenda.miller-reeser@lvh.com :  2   2152465451:  1            
##  coforioc@email.chop.edu      :  2   2152488070:  1            
##  mrosensteel@excelahealth.org :  2   2152913617:  1            
##  (Other)                      :246   (Other)   :234            
##  NA's                         : 18   NA's      : 34            
##       fred_pager       fred_phone  gamma_knif gen_outpat gene_counc heart_tran
##  2155076665:  2   2154568053:  2   N   :236   N   :205   N   :202   N   :240  
##  4129170105:  2   2672405394:  2   Y   : 13   Y   : 44   Y   : 47   Y   :  9  
##  7174991392:  2   6102848599:  2   NA's: 26   NA's: 26   NA's: 26   NA's: 26  
##  7246464689:  2   6104026115:  2                                              
##  0000000000:  1   7173587390:  2                                              
##  (Other)   :107   (Other)   :254                                              
##  NA's      :159   NA's      : 11                                              
##  helipad hemodial_c hemodial_m    hosp_id    hospice    hyper_cham   icu     
##  N:155   N   :214   N   :245   0      : 17   N   :152   N   :199   N   :180  
##  Y:120   Y   : 35   Y   :  4   002000 :  1   Y   : 97   Y   : 50   Y   : 69  
##          NA's: 26   NA's: 26   002100 :  1   NA's: 26   NA's: 26   NA's: 26  
##                                002200 :  1                                   
##                                002300 :  1                                   
##                                002600 :  1                                   
##                                (Other):253                                   
##     icu_beds        icu_sus_be      inpat_flu_       inpat_pneu     kidney_tra
##  Min.   :  2.00   Min.   :  2.0   Min.   :   1.0   Min.   :   1.0   N   :234  
##  1st Qu.:  8.00   1st Qu.:  8.0   1st Qu.:  25.0   1st Qu.:  24.0   Y   : 15  
##  Median : 12.00   Median : 12.0   Median : 123.0   Median : 135.0   NA's: 26  
##  Mean   : 21.91   Mean   : 20.8   Mean   : 260.8   Mean   : 313.6             
##  3rd Qu.: 22.00   3rd Qu.: 20.0   3rd Qu.: 393.2   3rd Qu.: 419.0             
##  Max.   :198.00   Max.   :194.0   Max.   :2420.0   Max.   :3100.0             
##  NA's   :208      NA's   :206     NA's   :67       NA's   :74                 
##    labor_rms         lic_beds         lic_dent        lic_dos      
##  Min.   : 1.000   Min.   :  10.0   Min.   : 1.00   Min.   :  1.00  
##  1st Qu.: 2.000   1st Qu.:  55.0   1st Qu.: 1.00   1st Qu.:  5.00  
##  Median : 3.000   Median : 116.0   Median : 3.00   Median : 17.00  
##  Mean   : 3.423   Mean   : 176.7   Mean   : 6.92   Mean   : 25.32  
##  3rd Qu.: 4.000   3rd Qu.: 214.0   3rd Qu.: 7.75   3rd Qu.: 34.50  
##  Max.   :10.000   Max.   :1573.0   Max.   :74.00   Max.   :184.00  
##  NA's   :249      NA's   :34       NA's   :137     NA's   :48      
##     lic_mds           lic_pod       linear_acc lithotrips liver_tran loc_method
##  Min.   :   1.00   Min.   : 1.000   N   :182   N   :155   N   :237   G: 13     
##  1st Qu.:  22.75   1st Qu.: 2.000   Y   : 67   Y   : 94   Y   : 12   R:262     
##  Median :  79.50   Median : 5.000   NA's: 26   NA's: 26   NA's: 26             
##  Mean   : 171.17   Mean   : 8.132                                              
##  3rd Qu.: 196.00   3rd Qu.:11.750                                              
##  Max.   :1887.00   Max.   :37.000                                              
##  NA's   :33        NA's   :101                                                 
##    ltc           mcd            mcd_key                 mcd_name   medical   
##  N   :196   60000  : 40   4210160000: 40   Philadelphia     : 35   N   :188  
##  Y   : 53   61000  : 15   4200361000: 15   Pittsburgh       : 13   Y   : 61  
##  NA's: 26   24000  :  6   4204924000:  6   Erie City        :  6   NA's: 26  
##             02000  :  4   4206969000:  4   Philadelphia City:  5             
##             46656  :  4   4207702000:  4   Allentown City   :  4             
##             69000  :  4   4209346656:  4   Mahoning Township:  4             
##             (Other):202   (Other)   :202   (Other)          :208             
##  mob_ccu    mob_icu      mri                         ms1        neo2_beds     
##  N   :244   N   :236   N   : 91   Limerick             :  4   Min.   : 2.000  
##  Y   :  5   Y   : 13   Y   :158   TMI                  :  4   1st Qu.: 4.000  
##  NA's: 26   NA's: 26   NA's: 26   Susquehanna          :  3   Median : 6.000  
##                                   Beaver               :  2   Mean   : 7.892  
##                                   Limerick/Peach Bottom:  1   3rd Qu.:10.000  
##                                   (Other)              :  2   Max.   :27.000  
##                                   NA's                 :259   NA's   :238     
##    neo2_sus_b       neo3_beds       neo3_sus_b    neuro_surg neurology 
##  Min.   : 1.000   Min.   : 2.00   Min.   : 2.00   N   :149   N   :101  
##  1st Qu.: 3.000   1st Qu.:14.00   1st Qu.:13.00   Y   :100   Y   :148  
##  Median : 5.000   Median :17.00   Median :17.00   NA's: 26   NA's: 26  
##  Mean   : 7.351   Mean   :22.91   Mean   :21.97                        
##  3rd Qu.: 9.000   3rd Qu.:30.00   3rd Qu.:28.00                        
##  Max.   :27.000   Max.   :75.00   Max.   :66.00                        
##  NA's   :238      NA's   :242     NA's   :242                          
##  obs_gyn    occ_ther   optometry  organ_bank    ped_trauma  pediatric 
##  N   :203   N   : 26   N   :198   N   :228   Level I :  4   N   :220  
##  Y   : 46   Y   :223   Y   : 51   Y   : 21   Level II:  2   Y   : 29  
##  NA's: 26   NA's: 26   NA's: 26   NA's: 26   NA's    :269   NA's: 26  
##                                                                       
##                                                                       
##                                                                       
##                                                                       
##    pet      pharmacy   phys_med   phys_ther  podiatry     providerid    
##  N   :163   N   : 30   N   :204   N   : 28   N   : 86   Min.   :  68.0  
##  Y   : 86   Y   :219   Y   : 45   Y   :221   Y   :163   1st Qu.: 177.2  
##  NA's: 26   NA's: 26   NA's: 26   NA's: 26   NA's: 26   Median : 273.5  
##                                                         Mean   : 898.1  
##                                                         3rd Qu.:2412.2  
##                                                         Max.   :2587.0  
##                                                         NA's   :1       
##   psych     psych_inpa     reg_trauma  resp_ther  so_flu_65u social_wor
##  N   :214   N   :124   Level I  : 14   N   : 37   N   : 78   N   : 12  
##  Y   : 35   Y   :125   Level II : 13   Y   :212   Y   :171   Y   :237  
##  NA's: 26   NA's: 26   Level III:  2   NA's: 26   NA's: 26   NA's: 26  
##                        NA's     :246                                   
##                                                                        
##                                                                        
##                                                                        
##  speech_pat                      street    surgical   surgical_s thera_radi
##  N   : 41   One Hospital Drive      :  3   N   :195   N   : 74   N   :172  
##  Y   :208   1000 Dutch Ridge Road   :  2   Y   : 54   Y   :175   Y   : 77  
##  NA's: 26   200 Lothrop Street      :  2   NA's: 26   NA's: 26   NA's: 26  
##             250 South 21st Street   :  2                                   
##             2545 Schoenersville Road:  2                                   
##             620 Howard Avenue       :  2                                   
##             (Other)                 :262                                   
##                  typ_org                            typ_serv   ultrasound
##  Non-profit Corp.    :142   General Medical and Surgical:167   N   : 68  
##  Corporation         : 62   Long-term Acute Care        : 27   Y   :181  
##  Other,Not For Profit: 20   Psychiatric                 : 25   NA's: 26  
##  Partnership         :  8   Rehabilitation              : 18             
##  State               :  8   Other                       : 11             
##  (Other)             : 15   (Other)                     :  7             
##  NA's                : 20   NA's                        : 20             
##        x                y              zip     
##  Min.   :-80.50   Min.   :39.75   19104  :  5  
##  1st Qu.:-79.20   1st Qu.:40.05   15213  :  4  
##  Median :-76.45   Median :40.41   15224  :  3  
##  Mean   :-77.15   Mean   :40.55   17105  :  3  
##  3rd Qu.:-75.36   3rd Qu.:40.87   17405  :  3  
##  Max.   :-74.87   Max.   :42.13   17822  :  3  
##                                   (Other):254

The dataset contains a number of variables about each hospital, many of them are clear and straight forward.

names(data)
##   [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"

Now create 5 maps, including descriptions, that highlight the spatial distribution of hospital services in the state of PA. Upload these maps as a document to rpubs.com and submit that link to the Canvas assignment.

library(ggmap)
## Loading required package: ggplot2
## Google's Terms of Service: https://cloud.google.com/maps-platform/terms/.
## Please cite ggmap if you use it! See citation("ggmap") for details.
acc_trauma=subset(data, acc_trauma=="Y")
qmplot(x, y, data = acc_trauma, legend = "none", colour= I('red'), mapcolor = "color", extent = "panel", main = "ACC Trauma Hospitals", xlab = "Longitude", ylab = "Latitude",zoom=8, maptype = "terrain-lines")
## 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

dental=subset(data, dental =="Y")
qmplot(x, y, data = dental, legend = "none", colour= I('red'), mapcolor = "color", extent = "panel", main = "Dental Services", xlab = "Longitude", ylab = "Latitude",zoom=8, maptype = "terrain-lines")

neurology=subset(data, county =="Philadelphia")
qmplot(x, y, data = neurology, legend = "none", colour= I('red'), mapcolor = "color", extent = "panel", main = "Neurology Services", xlab = "Longitude", ylab = "Latitude", zoom =14, maptype = "terrain")
## 154 tiles needed, this may take a while (try a smaller zoom).
## Source : http://tile.stamen.com/terrain/14/4767/6197.png
## Source : http://tile.stamen.com/terrain/14/4768/6197.png
## Source : http://tile.stamen.com/terrain/14/4769/6197.png
## Source : http://tile.stamen.com/terrain/14/4770/6197.png
## Source : http://tile.stamen.com/terrain/14/4771/6197.png
## Source : http://tile.stamen.com/terrain/14/4772/6197.png
## Source : http://tile.stamen.com/terrain/14/4773/6197.png
## Source : http://tile.stamen.com/terrain/14/4774/6197.png
## Source : http://tile.stamen.com/terrain/14/4775/6197.png
## Source : http://tile.stamen.com/terrain/14/4776/6197.png
## Source : http://tile.stamen.com/terrain/14/4777/6197.png
## Source : http://tile.stamen.com/terrain/14/4778/6197.png
## Source : http://tile.stamen.com/terrain/14/4779/6197.png
## Source : http://tile.stamen.com/terrain/14/4780/6197.png
## Source : http://tile.stamen.com/terrain/14/4767/6198.png
## Source : http://tile.stamen.com/terrain/14/4768/6198.png
## Source : http://tile.stamen.com/terrain/14/4769/6198.png
## Source : http://tile.stamen.com/terrain/14/4770/6198.png
## Source : http://tile.stamen.com/terrain/14/4771/6198.png
## Source : http://tile.stamen.com/terrain/14/4772/6198.png
## Source : http://tile.stamen.com/terrain/14/4773/6198.png
## Source : http://tile.stamen.com/terrain/14/4774/6198.png
## Source : http://tile.stamen.com/terrain/14/4775/6198.png
## Source : http://tile.stamen.com/terrain/14/4776/6198.png
## Source : http://tile.stamen.com/terrain/14/4777/6198.png
## Source : http://tile.stamen.com/terrain/14/4778/6198.png
## Source : http://tile.stamen.com/terrain/14/4779/6198.png
## Source : http://tile.stamen.com/terrain/14/4780/6198.png
## Source : http://tile.stamen.com/terrain/14/4767/6199.png
## Source : http://tile.stamen.com/terrain/14/4768/6199.png
## Source : http://tile.stamen.com/terrain/14/4769/6199.png
## Source : http://tile.stamen.com/terrain/14/4770/6199.png
## Source : http://tile.stamen.com/terrain/14/4771/6199.png
## Source : http://tile.stamen.com/terrain/14/4772/6199.png
## Source : http://tile.stamen.com/terrain/14/4773/6199.png
## Source : http://tile.stamen.com/terrain/14/4774/6199.png
## Source : http://tile.stamen.com/terrain/14/4775/6199.png
## Source : http://tile.stamen.com/terrain/14/4776/6199.png
## Source : http://tile.stamen.com/terrain/14/4777/6199.png
## Source : http://tile.stamen.com/terrain/14/4778/6199.png
## Source : http://tile.stamen.com/terrain/14/4779/6199.png
## Source : http://tile.stamen.com/terrain/14/4780/6199.png
## Source : http://tile.stamen.com/terrain/14/4767/6200.png
## Source : http://tile.stamen.com/terrain/14/4768/6200.png
## Source : http://tile.stamen.com/terrain/14/4769/6200.png
## Source : http://tile.stamen.com/terrain/14/4770/6200.png
## Source : http://tile.stamen.com/terrain/14/4771/6200.png
## Source : http://tile.stamen.com/terrain/14/4772/6200.png
## Source : http://tile.stamen.com/terrain/14/4773/6200.png
## Source : http://tile.stamen.com/terrain/14/4774/6200.png
## Source : http://tile.stamen.com/terrain/14/4775/6200.png
## Source : http://tile.stamen.com/terrain/14/4776/6200.png
## Source : http://tile.stamen.com/terrain/14/4777/6200.png
## Source : http://tile.stamen.com/terrain/14/4778/6200.png
## Source : http://tile.stamen.com/terrain/14/4779/6200.png
## Source : http://tile.stamen.com/terrain/14/4780/6200.png
## Source : http://tile.stamen.com/terrain/14/4767/6201.png
## Source : http://tile.stamen.com/terrain/14/4768/6201.png
## Source : http://tile.stamen.com/terrain/14/4769/6201.png
## Source : http://tile.stamen.com/terrain/14/4770/6201.png
## Source : http://tile.stamen.com/terrain/14/4771/6201.png
## Source : http://tile.stamen.com/terrain/14/4772/6201.png
## Source : http://tile.stamen.com/terrain/14/4773/6201.png
## Source : http://tile.stamen.com/terrain/14/4774/6201.png
## Source : http://tile.stamen.com/terrain/14/4775/6201.png
## Source : http://tile.stamen.com/terrain/14/4776/6201.png
## Source : http://tile.stamen.com/terrain/14/4777/6201.png
## Source : http://tile.stamen.com/terrain/14/4778/6201.png
## Source : http://tile.stamen.com/terrain/14/4779/6201.png
## Source : http://tile.stamen.com/terrain/14/4780/6201.png
## Source : http://tile.stamen.com/terrain/14/4767/6202.png
## Source : http://tile.stamen.com/terrain/14/4768/6202.png
## Source : http://tile.stamen.com/terrain/14/4769/6202.png
## Source : http://tile.stamen.com/terrain/14/4770/6202.png
## Source : http://tile.stamen.com/terrain/14/4771/6202.png
## Source : http://tile.stamen.com/terrain/14/4772/6202.png
## Source : http://tile.stamen.com/terrain/14/4773/6202.png
## Source : http://tile.stamen.com/terrain/14/4774/6202.png
## Source : http://tile.stamen.com/terrain/14/4775/6202.png
## Source : http://tile.stamen.com/terrain/14/4776/6202.png
## Source : http://tile.stamen.com/terrain/14/4777/6202.png
## Source : http://tile.stamen.com/terrain/14/4778/6202.png
## Source : http://tile.stamen.com/terrain/14/4779/6202.png
## Source : http://tile.stamen.com/terrain/14/4780/6202.png
## Source : http://tile.stamen.com/terrain/14/4767/6203.png
## Source : http://tile.stamen.com/terrain/14/4768/6203.png
## Source : http://tile.stamen.com/terrain/14/4769/6203.png
## Source : http://tile.stamen.com/terrain/14/4770/6203.png
## Source : http://tile.stamen.com/terrain/14/4771/6203.png
## Source : http://tile.stamen.com/terrain/14/4772/6203.png
## Source : http://tile.stamen.com/terrain/14/4773/6203.png
## Source : http://tile.stamen.com/terrain/14/4774/6203.png
## Source : http://tile.stamen.com/terrain/14/4775/6203.png
## Source : http://tile.stamen.com/terrain/14/4776/6203.png
## Source : http://tile.stamen.com/terrain/14/4777/6203.png
## Source : http://tile.stamen.com/terrain/14/4778/6203.png
## Source : http://tile.stamen.com/terrain/14/4779/6203.png
## Source : http://tile.stamen.com/terrain/14/4780/6203.png
## Source : http://tile.stamen.com/terrain/14/4767/6204.png
## Source : http://tile.stamen.com/terrain/14/4768/6204.png
## Source : http://tile.stamen.com/terrain/14/4769/6204.png
## Source : http://tile.stamen.com/terrain/14/4770/6204.png
## Source : http://tile.stamen.com/terrain/14/4771/6204.png
## Source : http://tile.stamen.com/terrain/14/4772/6204.png
## Source : http://tile.stamen.com/terrain/14/4773/6204.png
## Source : http://tile.stamen.com/terrain/14/4774/6204.png
## Source : http://tile.stamen.com/terrain/14/4775/6204.png
## Source : http://tile.stamen.com/terrain/14/4776/6204.png
## Source : http://tile.stamen.com/terrain/14/4777/6204.png
## Source : http://tile.stamen.com/terrain/14/4778/6204.png
## Source : http://tile.stamen.com/terrain/14/4779/6204.png
## Source : http://tile.stamen.com/terrain/14/4780/6204.png
## Source : http://tile.stamen.com/terrain/14/4767/6205.png
## Source : http://tile.stamen.com/terrain/14/4768/6205.png
## Source : http://tile.stamen.com/terrain/14/4769/6205.png
## Source : http://tile.stamen.com/terrain/14/4770/6205.png
## Source : http://tile.stamen.com/terrain/14/4771/6205.png
## Source : http://tile.stamen.com/terrain/14/4772/6205.png
## Source : http://tile.stamen.com/terrain/14/4773/6205.png
## Source : http://tile.stamen.com/terrain/14/4774/6205.png
## Source : http://tile.stamen.com/terrain/14/4775/6205.png
## Source : http://tile.stamen.com/terrain/14/4776/6205.png
## Source : http://tile.stamen.com/terrain/14/4777/6205.png
## Source : http://tile.stamen.com/terrain/14/4778/6205.png
## Source : http://tile.stamen.com/terrain/14/4779/6205.png
## Source : http://tile.stamen.com/terrain/14/4780/6205.png
## Source : http://tile.stamen.com/terrain/14/4767/6206.png
## Source : http://tile.stamen.com/terrain/14/4768/6206.png
## Source : http://tile.stamen.com/terrain/14/4769/6206.png
## Source : http://tile.stamen.com/terrain/14/4770/6206.png
## Source : http://tile.stamen.com/terrain/14/4771/6206.png
## Source : http://tile.stamen.com/terrain/14/4772/6206.png
## Source : http://tile.stamen.com/terrain/14/4773/6206.png
## Source : http://tile.stamen.com/terrain/14/4774/6206.png
## Source : http://tile.stamen.com/terrain/14/4775/6206.png
## Source : http://tile.stamen.com/terrain/14/4776/6206.png
## Source : http://tile.stamen.com/terrain/14/4777/6206.png
## Source : http://tile.stamen.com/terrain/14/4778/6206.png
## Source : http://tile.stamen.com/terrain/14/4779/6206.png
## Source : http://tile.stamen.com/terrain/14/4780/6206.png
## Source : http://tile.stamen.com/terrain/14/4767/6207.png
## Source : http://tile.stamen.com/terrain/14/4768/6207.png
## Source : http://tile.stamen.com/terrain/14/4769/6207.png
## Source : http://tile.stamen.com/terrain/14/4770/6207.png
## Source : http://tile.stamen.com/terrain/14/4771/6207.png
## Source : http://tile.stamen.com/terrain/14/4772/6207.png
## Source : http://tile.stamen.com/terrain/14/4773/6207.png
## Source : http://tile.stamen.com/terrain/14/4774/6207.png
## Source : http://tile.stamen.com/terrain/14/4775/6207.png
## Source : http://tile.stamen.com/terrain/14/4776/6207.png
## Source : http://tile.stamen.com/terrain/14/4777/6207.png
## Source : http://tile.stamen.com/terrain/14/4778/6207.png
## Source : http://tile.stamen.com/terrain/14/4779/6207.png
## Source : http://tile.stamen.com/terrain/14/4780/6207.png

emer_dept=subset(data, emer_dept =="Y")
qmplot(x, y, data = emer_dept, legend = "none", colour= I('red'), mapcolor = "color", darken=0.1, extent = "panel", main = "Emergency Department Services", xlab = "Longitude", ylab = "Latitude", zoom = 6, maptype="watercolor")
## Source : http://tile.stamen.com/terrain/6/17/23.png
## Source : http://tile.stamen.com/terrain/6/18/23.png
## Source : http://tile.stamen.com/terrain/6/17/24.png
## Source : http://tile.stamen.com/terrain/6/18/24.png

hospice=subset(data, hospice =="Y")
qmplot(x, y, data = hospice, legend = "none", colour= I('red'), mapcolor = "color", darken=.3, main = "Hospice Services in Pennsylvania", zoom = 7,maptype = "watercolor")
## Source : http://tile.stamen.com/terrain/7/35/47.png
## Source : http://tile.stamen.com/terrain/7/36/47.png
## Source : http://tile.stamen.com/terrain/7/37/47.png
## Source : http://tile.stamen.com/terrain/7/35/48.png
## Source : http://tile.stamen.com/terrain/7/36/48.png
## Source : http://tile.stamen.com/terrain/7/37/48.png