library(ggmap)
## Loading required package: ggplot2
library(sf)
## Linking to GEOS 3.6.1, GDAL 2.2.0, proj.4 4.9.3
library(leaflet)
library(sp)
library(rgdal)
## rgdal: version: 1.2-11, (SVN revision 676)
##  Geospatial Data Abstraction Library extensions to R successfully loaded
##  Loaded GDAL runtime: GDAL 2.2.0, released 2017/04/28
##  Path to GDAL shared files: C:/Users/gigar/Documents/R/win-library/3.4/rgdal/gdal
##  Loaded PROJ.4 runtime: Rel. 4.9.3, 15 August 2016, [PJ_VERSION: 493]
##  Path to PROJ.4 shared files: C:/Users/gigar/Documents/R/win-library/3.4/rgdal/proj
##  Linking to sp version: 1.2-5
head(dogs <- read.csv("https://data.austintexas.gov/api/views/ykw4-j3aj/rows.csv?accessType=DOWNLOAD"))
##   First.Name Last.Name                Address Zip.Code
## 1     Lorena    Zuniga      3415 Sweetgum Trc    78713
## 2      Maria    Davila     4420 Dovemeadow Dr    78744
## 3   Matthew     Rafacz     7400 Espira Drive     78739
## 4       Jeff  Crawford       9321 Bavaria Ln.    78749
## 5 Katherine    Maloney        11504 Murcia Dr    78759
## 6       Jack   Barnett 13101 Winding Creek Rd    78736
##                                                 Description.of.Dog
## 1               “Mulligan,” neutered male, Brindle Bullmastiff
## 2                        “Tiny,” male, tan and white Boxer mix
## 3 "Charlie" neutered male, black and white Labrador Retriever mix 
## 4       "Nala" spayed female, white and brown brindle Pit Bull mix
## 5                  “Lexie,” female, white and black Pit Bull  
## 6                "Holly" Spayed female, white Labrador/Pitbull mix
##                                                    Location
## 1                             3415 Sweetgum Trc\nTX 78713\n
## 2     4420 Dovemeadow Dr\nTX 78744\n(30.188962, -97.750896)
## 3      7400 Espira Drive\nTX 78739\n(30.184748, -97.917591)
## 4       9321 Bavaria Ln.\nTX 78749\n(30.202255, -97.874029)
## 5        11504 Murcia Dr\nTX 78759\n(30.409891, -97.738812)
## 6 13101 Winding Creek Rd\nTX 78736\n(30.240521, -97.992054)
# concatenate the address
dogs_adr <- paste(dogs$Address, "Austin,TX", dogs$Zip.Code)
# geocode - check for warnings
dogs_coords <- geocode(dogs_adr)
## Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=3415%20Sweetgum%20Trc%20Austin,TX%2078713&sensor=false
## Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=4420%20Dovemeadow%20Dr%20Austin,TX%2078744&sensor=false
## Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=7400%20Espira%20Drive%20%20Austin,TX%2078739&sensor=false
## Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=9321%20Bavaria%20Ln.%20Austin,TX%2078749&sensor=false
## Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=11504%20Murcia%20Dr%20Austin,TX%2078759&sensor=false
## Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=13101%20Winding%20Creek%20Rd%20Austin,TX%2078736&sensor=false
## Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=7128%20Mumruffin%20Ln%20Austin,TX%2078754&sensor=false
## Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=2815%20Oak%20Ridge%20Dr%20Austin,TX%2078669&sensor=false
## Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=903%20Vincent%20Place%20%20Austin,TX%2078660&sensor=false
## Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=4704%20Sunridge%20Ct%20Austin,TX%2078741&sensor=false
## .Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=5931%20Cape%20Coral%20Dr%20Austin,TX%2078746&sensor=false
## .Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=2815%20Oak%20Ridge%20Dr%20Austin,TX%2078669&sensor=false
## .Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=8701%20Bluffstone%20Cv.%20#2202%20Austin,TX%2078759&sensor=false
## .Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=20608%20Ed%20Acklin%20Rd%20Austin,TX%2078653&sensor=false
## .Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=11824%20Morning%20View%20Dr%20Austin,TX%2078617&sensor=false
## .Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=7600%20Bloomfield%20Ave%20Austin,TX%2078745&sensor=false
## Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=14329%20Teacup%20Ln%20Austin,TX%2078660&sensor=false
## Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=4809%20Clear%20View%20Dr%20Austin,TX%2078725&sensor=false
## Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=11511%20Catalonia%20Dr%20Austin,TX%2078759&sensor=false
## Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=18300%20Belfry%20Pass%20Austin,TX%2078653&sensor=false
## .Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=705%20Texas%20St%20Austin,TX%2078705&sensor=false
## .Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=12904%20Schleicher%20Trl%20Austin,TX%2078732&sensor=false
## Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=11929%20Rosethorn%20Dr%20Austin,TX%2078758&sensor=false
## .Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=2520%20East%203rd%20St%20Austin,TX%2078702&sensor=false
## .Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=11305%20Cezanne%20St%20%20Austin,TX%2078726&sensor=false
## .Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=5336%20Magdelena%20Dr%20Austin,TX%2078704&sensor=false
## Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=2401%20Cecil%20Dr%20Austin,TX%2078744&sensor=false
## Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=5205%20Bantom%20Woods%20Bnd.%20Austin,TX%2078721&sensor=false
## Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=2401%20Cecil%20Dr%20Austin,TX%2078744&sensor=false
## .Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=2718%20Jorwoods%20Dr%20Austin,TX%2078745&sensor=false
## Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=7200%20Reaburn%20St.%20Austin,TX%2078749&sensor=false
## .Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=6204%20Skahan%20Ln.%20Austin,TX%2078739&sensor=false
## Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=905%20Tudor%20House%20Road%20%20Austin,TX%2078660&sensor=false
## .Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=1205%20Quail%20Park%20Dr%20Austin,TX%2078758&sensor=false
## .Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=6204%20Skahan%20Ln.%20Austin,TX%2078739&sensor=false
## .Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=7002%20Montana%20St%20Austin,TX%2078741&sensor=false
## .Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=3703%20Grayson%20Ln%20Austin,TX%2078722&sensor=false
## Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=1302%20Canyon%20Edge%20Dr%20Austin,TX%2078733&sensor=false
## Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=11824%20Morning%20View%20Dr%20Austin,TX%2078617&sensor=false
## Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=4707%20Carsonhill%20Dr%20Austin,TX%2078723&sensor=false
## .Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=1411%20Justin%20Ln%20Austin,TX%2078757&sensor=false
## Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=6319%20Parliament%20Dr.%20#A%20Austin,TX%2078724&sensor=false
## Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=5205%20Bantom%20Woods%20Bnd.%20Austin,TX%2078721&sensor=false
## .Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=1304%20Neans%20Dr.%20Austin,TX%2078758&sensor=false
## .Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=7701%20Callbram%20Ln%20Austin,TX%2078736&sensor=false
## .Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=14329%20Teacup%20Ln%20Austin,TX%2078660&sensor=false
## .Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=14028%20Lakeview%20Dr%20Austin,TX%2078732&sensor=false
## .Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=5107%20Saddle%20Cir.%20Austin,TX%2078727&sensor=false
## Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=1302%20Lipan%20Trl%20Austin,TX%2078733&sensor=false
## Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=11511%20Catalonia%20Dr%20Austin,TX%2078759&sensor=false
## .Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=14707%20Reynero%20Ln.%20#E%20Austin,TX%2078617&sensor=false
## Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=3705%20Robinson%20Ave.%20Austin,TX%2078722&sensor=false
## Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=412%20Summer%20Alcove%20Way%20Austin,TX%2078732&sensor=false
## .Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=7200%20Reaburn%20St.%20Austin,TX%2078749&sensor=false
## .Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=7201%20Levander%20Loop%20Austin,TX%2078702&sensor=false
## .Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=2401%20Emmett%20Pkwy%20Austin,TX%2078728&sensor=false
## .Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=6319%20Parliament%20Dr.%20#A%20Austin,TX%2078724&sensor=false
## .Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=1910%20Haskell%20St.%20Austin,TX%2078722&sensor=false
## Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=2813%20Tradewind%20Dr.%20Austin,TX%2078669&sensor=false
## .Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=7916%20Adelaide%20Dr%20%20Austin,TX%2078739&sensor=false
## Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=903%20Vincent%20Place%20%20Austin,TX%2078660&sensor=false
## .Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=4812%20Candletree%20Ln%20Austin,TX%2078744&sensor=false
## Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=6604%20Jamaica%20Ct%20Austin,TX%2078757&sensor=false
head(dogs <- data.frame(cbind(dogs, dogs_coords)))
write.table(dogs)

Cargando la data

readOGR(".", layer = "dangerous_dogs")
# If we were to use the `sf` package we would do:
#dogs_sf <- st_as_sf(dogs, c("lon", "lat"), crs = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs")
#st_write(dogs_sf, "dangerous_dogs.shp")
#writeOGR(dogs, ".", "dangerous_dogs", driver="ESRI Shapefile")
#Usar data para mostrar leaflets

leaflet(dogs) %>%  
  addTiles() %>% 
  addCircleMarkers(dogs$lon, dogs$lat, popup=dogs$Description.of.Dog) 

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.