-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
25 lines (17 loc) · 1.24 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# DevDatProd_wk4
This is the github repo for Arnold Cross's week 4 project in the Johns Hopkins coursera class, Developing Data Products. The project has two parts. The first part is a shiny app published at https://arnoldcross.shinyapps.io/DevDatProd_wk4/. The second part is a slideshow created in Rstudio Presentation.
The project is based on population data from the U.S. Census Bureau. The data is explained at https://www.census.gov/data/developers/data-sets/popest-popproj/popest.html.
The following code downloads one population dataset but does not do anything with it.
```{r}
library(jsonlite)
library(magrittr)
library(leaflet)
censDat <- fromJSON("https://api.census.gov/data/2016/pep/population?get=POP,DATE,DATE_DESC&for=state:*")
```
Below is a download and mapping of the population centers.
The source link is at https://www.census.gov/geo/reference/centersofpop.html under [Data Files], click [Centers of Population by State: 2010].
```{r}
popCen <- read.csv("http://www2.census.gov/geo/docs/reference/cenpop2010/CenPop2010_Mean_ST.txt", stringsAsFactors=F)
stDF <- data.frame(lat=popCen$LATITUDE, lng=popCen$LONGITUDE)
stDF %>% leaflet() %>% addProviderTiles(providers$OpenStreetMap) %>% addCircleMarkers()
```