Created
April 21, 2014 02:35
-
-
Save jdavidson/11130754 to your computer and use it in GitHub Desktop.
Venture Funding Trends with Crunchbase Data
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(ggplot2) | |
library(ggthemes) | |
library(plyr) | |
library(dplyr) | |
library(lubridate) | |
library(scales) | |
library(data.table) | |
library(reshape2) | |
options(scipen=999) | |
options(stringsAsFactors = FALSE) | |
rounds <- read.csv("2014-04-01-crunchbase_monthly_export_rounds.csv") | |
# dedup | |
rounds <- data.table(rounds) | |
setkeyv(rounds, c("company_name", "funded_at", "funding_round_type")) | |
rounds <- unique(rounds) | |
rounds <- subset(rounds, funded_month != "1960-01") | |
# fix strange date data | |
rounds$funded_at <- floor_date(ymd_hms(paste(rounds$funded_month, "01 12:59:59 UTC", sep="-")), "day") | |
rounds <- filter(rounds, !is.na(raised_amount_usd), funding_round_type %in% c("angel", "series-a", "series-b", "series-c+")) | |
rounds_funnel <- rounds %.% group_by(funding_round_type, funded_quarter, funded_year) %.% summarise(companies=n(), raised_amount_usd=sum(raised_amount_usd)) | |
cplot <- ggplot(filter(rounds_funnel, funded_year > 2005, funded_year < 2015, funded_quarter < "2014-Q2"), aes(x= funded_quarter, y=companies, color=funding_round_type, group=funding_round_type)) + ggtitle("Companies Funded by Stage and Quarter") + xlab("") + ylab("Companies") + geom_point() + geom_smooth() + theme(axis.text.x = element_text(angle = 90)) + ylim(0, 1000) | |
ggsave("images/funding-trend.png", cplot, width=640 / 72, height=400 / 72, dpi=72) | |
aplot <- ggplot(filter(rounds_funnel, funded_year > 2005, funded_year < 2015, funded_quarter < "2014-Q2"), aes(x= funded_quarter, y=raised_amount_usd / 1e6, color=funding_round_type, group=funding_round_type)) + ggtitle("Amount Raised by Stage and Quarter") + xlab("") + ylab("Amount Raised Millions USD") + geom_point() + geom_smooth(aes(weight=companies), se=F) + theme(axis.text.x = element_text(angle = 90)) + scale_y_continuous(labels = dollar_format()) | |
ggsave("images/funding-amount-trend.png", aplot, width=640 / 72, height=400 / 72, dpi=72) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment