Skip to content

Instantly share code, notes, and snippets.

@jkaupp
Created February 9, 2015 14:53
Show Gist options
  • Save jkaupp/0b8a58e790b602d92833 to your computer and use it in GitHub Desktop.
Save jkaupp/0b8a58e790b602d92833 to your computer and use it in GitHub Desktop.
#IVMOOC Assignment 3 Code
library(plyr)
library(gdata)
library(ggmap)
library(ggplot2)
setwd("/Users/Jake/Documents/MOOCs/IVMOOC")
data <- read.csv("NSF Master LandL.csv")
data.state <-ddply(data, .(state, Latitude, Longitude), summarize, expected_total_amount=sum(expected_total_amount))
usa <- get_map(location = 'united states', zoom = 4, color="color", maptype='road')
g <- guide_legend("Amount of Funding (USD)")
ggmap(usa) +
geom_point(aes(x=Longitude, y=Latitude, show_guide = TRUE, size=expected_total_amount, color=expected_total_amount),data = data.state) +
scale_colour_gradient(low="#e7e1ef", high="#dd1c77") +
guides(colour = g, size = g) +
theme(legend.position = "bottom") +
ggtitle("Geocoding of NSF Funding of Engineering Education Research") +
xlab("Longitude") +
ylab("Latitude")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment