library(censusxy)
addrWIC <- read.csv("~/Downloads/GIS-Dem7093/WIC.csv")
addrWIC<- addrWIC[c(6,12:14)]
names(addrWIC)<-c("street", "city", "st", "zip")
head(addrWIC)
## street city st zip
## 1 6700 W Interstate 10 San Antonio TX 78201
## 2 6800 W Interstate 10 Ste 200 San Antonio TX 78201
## 3 527 N Leona St San Antonio TX 78207
## 4 1410 Guadalupe St Ste 222 San Antonio TX 78207
## 5 3703 Fredericksburg Rd San Antonio TX 78201
## 6 800 Dolorosa San Antonio TX 78207
resultswic<- cxy_geocode(addrWIC,
street="street",
city = "city",
state= "st",
zip = "zip",
class = "sf",
output = "simple")
## Loading required namespace: sf
## 8 rows removed to create an sf object. These were addresses that the geocoder could not match.
mapview::mapview(resultswic,
layer.name="WIC Services",
col.regions="red",
col="red")
## Warning: replacing previous import 'terra::extend' by 'raster::extend' when
## loading 'satellite'
## Warning: replacing previous import 'terra::crop' by 'raster::crop' when loading
## 'satellite'
## Warning: multiple methods tables found for 'crop'
## Warning: multiple methods tables found for 'extend'
addrGroc <- read.csv("~/Downloads/GIS-Dem7093/Grocery.csv")
addrGroc<- addrGroc[c(6,12:14)]
names(addrGroc)<-c("street", "city", "st", "zip")
head(addrGroc)
## street city st zip
## 1 1314 Fredericksburg Rd San Antonio TX 78201
## 2 1545 S San Marcos San Antonio TX 78207
## 3 4522 Fredericksburg Rd San Antonio TX 78201
## 4 111 S Leona St San Antonio TX 78207
## 5 3485 Fredericksburg Rd San Antonio TX 78201
## 6 1502 W Hildebrand Ave San Antonio TX 78201
resultsgroc<- cxy_geocode(addrGroc,
street="street",
city = "city",
state= "st",
zip = "zip",
class = "sf",
output = "simple")
## 25 rows removed to create an sf object. These were addresses that the geocoder could not match.
mapview::mapview(resultsgroc,
layer.name="Grocery Stores",
col.regions="blue",
col="blue")
mapview::mapview(list(resultswic, resultsgroc),
layer.name = c("WIC Services", "Grocery Stores"),
col.regions=list("red", "blue"),
col=list("red", "blue"))
For WIC the percent geocoded correctly is 64% (16 out of 25). For grocery stores the percent geocded correctly is 52% (30 out of 58).