Henry Schein Customer Map
Building a leaflet map and statistical summaries for Henry Schein customers using R, geocoding, and a shiny app during an internship project.
Henry Schein Map
Henry Schein Leaflet Map
In order to see the map that we built for Henry Schein, click here:
https://jjfitz.shinyapps.io/hs_leaflet/
I had the great opportunity to do an internshipwith Henry Schein the previous summer and was able to build a connection with the lead Data Scientist there. They donated some of the data for this project to our society, where I was then appointed as team lead.
The data has been changed from the original for privacy, but this is what we where able to provide for Henry Schein. They told us that they wanted to be able to see their customers on a map, and have statistical summaries for those customers. We where given free reign to put anything that seemed useful to provide about the customers. I will go through the process of what we learned and what we had to do in order to get this map working.
Geocoding
The biggest part of this project was converting the customers addresses into lat/lng’s so that we could plot those onto the map. We at first didn’t know how big the dataset was going to be, so we where trying to find different methods of geocoding without using the Google Maps API. We learned a lot of what Bing, OpenStreet Maps, and OpenSci had to offer as far as geocoding goes. When we got the data set, We tried the other methods we had researched, but they weren’t able to get all of the addresses correct. We saw that it was small enough that it wouldn’t go over the Google Maps Geocoding API, so we decided to use that instead.
It is pretty straight forward to geocode after that. We first pasted the different parts of the address together:
And then we fed it into the API:
We could now finally plot the customers on the map! We then had to learn a little bit more about shiny. We found a package that gave a little bit of style to shiny apps called shinydashboard. We started to learn how to make our plots reactive, and changing our graphs to where the map boundaries where. We built more tabs so that Henry Schein would be able to look at their customers that where within the app.
This was a really fun project to be a part of. I learned more about geocoding and learned a lot of what it takes to make a shiny app.
</div> </div>