This leaflet hopes to show the dairy production across various states and union territories in India. The dataset available does not indicate units so I assume they are in millions of liters. The data includes dairy production from cows, buffaloes and goats.
The data was obtained from: https://data.gov.in/catalog/stateut-wise-estimates-milk-production
I added the latitude and longitude data for each state to get the map to show correctly.
library(leaflet)
## Warning: package 'leaflet' was built under R version 3.5.3
library(dplyr)
## Warning: package 'dplyr' was built under R version 3.5.2
setwd("C:/Users/Siddharth/Documents/Careers/Siddharth/DataScienceSpecialization/Developing Data Products/Week 2")
ah = read.csv("./Animal_Husbandry_TABLE6_2011-12.csv")
df <- data.frame(lat = ah$Latitude, lng = ah$Longitude)
library(leaflet)
library(dplyr)
df %>% leaflet() %>% addTiles() %>% addMarkers(popup = paste("State:", ah$States.UTs, "<br>", "Cow Milk:", ah$Cow.Milk...Total, "<br>", "Buffalo Milk:", ah$Buffalo.Milk, "<br>", "Goat Milk:", ah$Goat.Milk, "<br>"))
## Warning in validateCoords(lng, lat, funcName): Data contains 1 rows with
## either missing or invalid lat/lon values and will be ignored