addr<-read.csv(url("https://raw.githubusercontent.com/coreysparks/data/master/wic_west_side.csv"))
addr<-addr[c(6, 12:14)]
names(addr)<-c("street", "city", "st", "zip")
head(addr)
## street city st zip
## 1 1039 W Hildebrand Ave San Antonio TX 78201
## 2 1102 Delgado St San Antonio TX 78207
## 3 1115 W Martin St San Antonio TX 78207
## 4 1115 W Martin St San Antonio TX 78207
## 5 1115 W Martin St San Antonio TX 78207
## 6 1115 W Martin St San Antonio TX 78207
library(readxl)
satxgroc <- read_excel("/Users/rhl548/Desktop/Cosas/rmd/IPUMS International/satxgroc.xlsx")
## New names:
## * Source -> Source...1
## * Source -> Source...18
satxgroc<-satxgroc[c(6, 7:9)]
names(satxgroc)<-c("street", "city", "st", "zip")
head(satxgroc)
## # A tibble: 6 x 4
## street city st zip
## <chr> <chr> <chr> <dbl>
## 1 646 S Flores St San Antonio TX 78204
## 2 11122 Nacogdoches Rd San Antonio TX 78217
## 3 1314 Fredericksburg Rd San Antonio TX 78201
## 4 1545 S San Marcos San Antonio TX 78207
## 5 340 Enrique M Barrera Pkwy San Antonio TX 78237
## 6 1430 Austin Hwy San Antonio TX 78209
#install.packages("censusxy")
library(censusxy)
results1<-cxy_geocode(addr,
street = "street",
city = "city",
state ="st",
zip = "zip",
class="sf",
output = "simple")
## Loading required namespace: sf
## 35 rows removed to create an sf object. These were addresses that the geocoder could not match.
results2<-cxy_geocode(satxgroc,
street = "street",
city = "city",
state ="st",
zip = "zip",
class="sf",
output = "simple")
## 133 rows removed to create an sf object. These were addresses that the geocoder could not match.
78 of 100 (78 percent) addresses were found via geocoding for WIC services. 347 of 490 (71 percent) addresses were found via geocoding for grocery stores in San Antonio (Couldn’t filter for specific zip codes)