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)
## Warning: package 'foreign' was built under R version 3.4.4
library(ggplot2)
library(ggmap)
## Warning: package 'ggmap' was built under R version 3.4.4
## Google's Terms of Service: https://cloud.google.com/maps-platform/terms/.
## Please cite ggmap if you use it! See citation("ggmap") for details.
dat <- read.dbf("/Users/Ning/Documents/HU/ANLY 512 Data Visualization/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"
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 the Moodle assignment.
Philadelphia<-subset(dat, city == "Philadelphia")
qmplot(x, y, data = Philadelphia, color = "red", size = 3, darken = .3, extent = "panel", main = "Hospitals in Philadelphia", 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
Phila2<-subset(dat, city == "Pittsburgh"&dental == "Y")
qmplot(x, y, data = Phila2, color = "red", size = 3, darken = .3, extent = "panel", main = "Hospitals in Philadelphia with Dental Services", xlab = "Longitude", ylab = "Latitude")
## Using zoom = 15...
## Source : http://tile.stamen.com/terrain/15/9101/12350.png
## Source : http://tile.stamen.com/terrain/15/9102/12350.png
## Source : http://tile.stamen.com/terrain/15/9103/12350.png
## Source : http://tile.stamen.com/terrain/15/9104/12350.png
## Source : http://tile.stamen.com/terrain/15/9105/12350.png
## Source : http://tile.stamen.com/terrain/15/9106/12350.png
## Source : http://tile.stamen.com/terrain/15/9101/12351.png
## Source : http://tile.stamen.com/terrain/15/9102/12351.png
## Source : http://tile.stamen.com/terrain/15/9103/12351.png
## Source : http://tile.stamen.com/terrain/15/9104/12351.png
## Source : http://tile.stamen.com/terrain/15/9105/12351.png
## Source : http://tile.stamen.com/terrain/15/9106/12351.png
## Source : http://tile.stamen.com/terrain/15/9101/12352.png
## Source : http://tile.stamen.com/terrain/15/9102/12352.png
## Source : http://tile.stamen.com/terrain/15/9103/12352.png
## Source : http://tile.stamen.com/terrain/15/9104/12352.png
## Source : http://tile.stamen.com/terrain/15/9105/12352.png
## Source : http://tile.stamen.com/terrain/15/9106/12352.png
Pitz<-subset(dat, city == "Pittsburgh")
qmplot(x, y, data = Pitz, color = "red", size = 3, darken = .3, extent = "panel", main = "Hospitals in Pittsburgh", xlab = "Longitude", ylab = "Latitude")
## Using zoom = 12...
## Source : http://tile.stamen.com/terrain/12/1136/1541.png
## Source : http://tile.stamen.com/terrain/12/1137/1541.png
## Source : http://tile.stamen.com/terrain/12/1138/1541.png
## Source : http://tile.stamen.com/terrain/12/1139/1541.png
## Source : http://tile.stamen.com/terrain/12/1136/1542.png
## Source : http://tile.stamen.com/terrain/12/1137/1542.png
## Source : http://tile.stamen.com/terrain/12/1138/1542.png
## Source : http://tile.stamen.com/terrain/12/1139/1542.png
## Source : http://tile.stamen.com/terrain/12/1136/1543.png
## Source : http://tile.stamen.com/terrain/12/1137/1543.png
## Source : http://tile.stamen.com/terrain/12/1138/1543.png
## Source : http://tile.stamen.com/terrain/12/1139/1543.png
## Source : http://tile.stamen.com/terrain/12/1136/1544.png
## Source : http://tile.stamen.com/terrain/12/1137/1544.png
## Source : http://tile.stamen.com/terrain/12/1138/1544.png
## Source : http://tile.stamen.com/terrain/12/1139/1544.png
## Source : http://tile.stamen.com/terrain/12/1136/1545.png
## Source : http://tile.stamen.com/terrain/12/1137/1545.png
## Source : http://tile.stamen.com/terrain/12/1138/1545.png
## Source : http://tile.stamen.com/terrain/12/1139/1545.png
## Source : http://tile.stamen.com/terrain/12/1136/1546.png
## Source : http://tile.stamen.com/terrain/12/1137/1546.png
## Source : http://tile.stamen.com/terrain/12/1138/1546.png
## Source : http://tile.stamen.com/terrain/12/1139/1546.png
Pitz2<-subset(dat, city == "Pittsburgh"&chemo == "Y")
qmplot(x, y, data = Pitz2, color = "red", size = 3, darken = .3, extent = "panel", main = "Hospitals in Pittsburgh with Chemotherapy Services", xlab = "Longitude", ylab = "Latitude")
## Using zoom = 12...
mri<-subset(dat, mri == "Y" )
qmplot(x, y, data = mri, color = "red", size = 3, darken = .3, extent = "panel", main = "Hospitals with MRI Services", 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