library(dplyr)
library(leaflet)
dt <- read.csv("zip_codes_states.csv")
dt$state <- as.character(dt$state)
Data Analysis and Plotting the zipcodes for the state of New York
dt_ny <- dt %>% filter(state == "NY")
dt_ny <- dt_ny[-which(is.na(dt_ny))]
##random uniform data is created for Population exploration & Visualization
dt_ny$`Pop(in millions)` <- runif(2233, max = 2.5, min = .5)
latitude <- dt_ny$latitude
longitude <- dt_ny$longitude
county <- dt_ny$county
zip_code <- dt_ny$zip_code
pop <- round(dt_ny$`Pop(in millions)`,2)
map <- dt_ny %>% leaflet() %>% addTiles() %>%
addCircles(weight = 4, radius = dt_ny$`Pop(in millions)` * 500) %>%
addMarkers(lat = latitude, lng = longitude,
popup = toupper(paste(county, paste("ZIP: ", as.character(zip_code)),
paste("Population (in Millions): ",as.character(pop)), sep = "<br/>")),
clusterOptions = markerClusterOptions())
map