Create a web page using R Markdown that features a map created with Leaflet. Host your webpage on either GitHub Pages, RPubs, or NeoCities. Your webpage must contain the date that you created the document, and it must contain a map created with Leaflet. We would love to see you show off your creativity! Review criteria less The rubric contains the following two questions: 1. Does the web page feature a date and is this date less than two months before the date that you’re grading this assignment? 2. Does the web page feature an interactive map that appears to have been created with Leaflet?
library(leaflet)
library(dplyr)
library(RSocrata)
# List what data is avalible at the CDC open data
dfcdc <- ls.socrata("https://chronicdata.cdc.gov/500-Cities/500-Cities-Local-Data-for-Better-Health/6vp6-wxuq#Export")
# Review the list and make the selection based on interest
# Grab CDC data from the site
# Off line the exported file was converted to file 500CitiesCancer.csv.
# The issue is being leaflet map, is difficult to use FIPS data vs longitude and latitude data.
This is the complete dataset for the 500 Cities project. This dataset includes 2013, 2014 model-based small area estimates for 27 measures of chronic disease related to unhealthy behaviors (5), health outcomes (13), and use of preventive services (9). Data were provided by the Centers for Disease Control and Prevention (CDC), Division of Population Health, Epidemiology and Surveillance Branch. The project was funded by the Robert Wood Johnson Foundation (RWJF) in conjunction with the CDC Foundation. It represents a first-of-its kind effort to release information on a large scale for cities and for small areas within those cities. It includes estimates for the 500 largest US cities and approximately 28,000 census tracts within these cities. These estimates can be used to identify emerging health problems and to inform development and implementation of effective, targeted public health prevention activities. Because the small area model cannot detect effects due to local interventions, users are cautioned against using these estimates for program or policy evaluations. Data sources used to generate these measures include Behavioral Risk Factor Surveillance System (BRFSS) data (2013, 2014), Census Bureau 2010 census population data, and American Community Survey (ACS) 2009-2013, 2010-2014 estimates. More information about the methodology can be found at www.cdc.gov/500cities.
This work is to present a population map of top 500 USA cities in the United States and the cancer rate as determined by the CDC. The original data is downloaded from https://www.cdc.gov/500Cities/, 500 (474) Cities: Local data for better health. However, the data was pre-processes to limit to Cancer (except skin) data, vs the full set of ailments available at the site. The data was import to allow for faster pre-process: https://chronicdata.cdc.gov/500-Cities/500-Cities-Local-Data-for-Better-Health/6vp6-wxuq#Export
This map is displaying 494 USA cities, their population and cancer rate as a percentage of the cities population, (cancer occupancy/Population displayed as a percentage):
geodata <- read.csv(file = "500CitiesCancer.csv",
header = TRUE,
sep = "," )
data <- subset(geodata, select = c("cityName", "data_Value_cancer","cityFIPS_rough","populationCountTotal","state","precetnagePopulationCancer","geoLocationLat", "geoLocationLng"))
colnames(data) <- c("cityName", "data_Value_cancer","cityFIPS_rough","populationCountTotal","state","precetnagePopulationCancer","geoLocationLat", "geoLocationLng")
data$popsep <- format(data$populationCountTotal, scientific=FALSE)
data$metropop <- do.call(paste, c(data[c("cityName", "populationCountTotal","precetnagePopulationCancer")], sep = ", "))
my_map <- data %>%
leaflet() %>%
addTiles() %>%
setView(lng = -95.7129, lat = 37.0902, zoom = 4) %>%
addMarkers(clusterOptions = markerClusterOptions(),
popup = strwrap(data$metropop),
lng = (data$geoLocationLng),
lat = (data$geoLocationLat))%>%
addTiles()
my_map