This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rgdal) | |
library(rgeos) | |
library(maptools) | |
library(mapproj) | |
us <- readOGR("http://bl.ocks.org/mbostock/raw/4090846/us.json", "states") | |
proj4string(us) <- CRS("+proj=merc") | |
map <- fortify(us) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rvest) | |
# example of using phantomjs for scraping sites that use a twisty maze | |
# of javascript to render HTML tables or other tags | |
# grab phantomjs binaries from here: http://phantomjs.org/ | |
# and stick it somehere PATH will find it | |
# this example scrapes the user table from: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(dplyr) | |
library(scales) | |
library(ggplot2) | |
library(RColorBrewer) | |
dat_sum <- dat %>% | |
mutate(A=factor(A), | |
B=factor(B)) %>% | |
group_by(B, A, Outcome) %>% | |
summarise(outcome_total=n()) %>% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rgdal) | |
library(magrittr) | |
# save this locally for realz | |
world <- readOGR("https://raw.githubusercontent.com/AshKyd/geojson-regions/master/data/source/ne_50m_admin_0_countries.geo.json", "OGRGeoJSON") | |
# assumes 'places' is a data.frame with at least lat/lon columns | |
places %>% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Gender Grade Age Race Urban/Rural School Goals Grades Sports Looks Money | |
boy 5 11 White Rural Elm Sports 1 2 4 3 | |
boy 5 10 White Rural Elm Popular 2 1 4 3 | |
girl 5 11 White Rural Elm Popular 4 3 1 2 | |
girl 5 11 White Rural Elm Popular 2 3 4 1 | |
girl 5 10 White Rural Elm Popular 4 2 1 3 | |
girl 5 11 White Rural Elm Popular 4 2 1 3 | |
girl 5 10 White Rural Elm Popular 3 4 1 2 | |
girl 5 10 White Rural Elm Grades 3 4 2 1 | |
girl 5 10 White Rural Elm Sports 3 2 1 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rgeos) | |
library(rgdal) | |
library(httr) | |
library(dplyr) | |
geo_init <- function() { | |
try({ | |
GET("http://www.mapcruzin.com/fcc-wireless-shapefiles/cities-towns.zip", | |
write_disk("cities.zip")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Data sources: | |
CDC data on vaccine coverage: http://www.cdc.gov/flu/professionals/vaccination/reporti1112/reporti/index.htm | |
CDC data on current influenza situation: http://gis.cdc.gov/grasp/fluview/fluportaldashboard.html | |
Historical flu data: http://www.cdc.gov/flu/weekly/pastreports.htm | |
Locations of hospitals in Boston: https://data.cityofboston.gov/Public-Health/Hospital-Locations/46f7-2snz | |
NetLogo, a simple agent based model: http://ccl.northwestern.edu/netlogo/ | |
Nemsis, emergency medical services API (haven't used this one myself): http://www.nemsis.org/v3/downloads/v3Archive.html | |
Written for R, but useful for epi basics in any language: cran.r-project.org/doc/contrib/Epicalc_Book.pdf | |
"Provides access to health statistics and information on hospital inpatient and emergency department utilization": http://hcupnet.ahrq.gov/ | |
Healthcare Research and Quality data directory: http://www.ahrq.gov/data/dataresources.htm |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(httr) | |
library(magrittr) | |
library(dplyr) | |
library(ggplot2) | |
# data retrieval ---------------------------------------------------------- | |
pg <- GET("http://data.giss.nasa.gov/gistemp/tabledata_v3/GLB.Ts+dSST.txt", | |
user_agent("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/7046A194A")) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.