Skip to content

Instantly share code, notes, and snippets.

@jwinternheimer
Created October 4, 2015 19:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwinternheimer/fe4d3a6a32b24a931f7f to your computer and use it in GitHub Desktop.
Save jwinternheimer/fe4d3a6a32b24a931f7f to your computer and use it in GitHub Desktop.
## Import Data into Data Frame
awesome <- read.csv('~/Downloads/awesome.csv',header=T)
## Rename columns of data frame
names(awesome) <- c('user_id','plan_date','join_date','activated','used_extension_first_day',
'used_extension_first_week','used_extension_first_month',
'prompts_seen')
## Change data to 'date' type
awesome$join_date <- as.Date(awesome$join_date)
awesome$plan_date <- as.Date(awesome$plan_date)
## Replace NA values with 0
awesome[is.na(awesome)] <- 0
## Create new column that is the difference, in days, between joining Buffer and upgrading
awesome <- awesome %>%
mutate(time_to_upgrade = as.numeric(plan_date - join_date))
## Plot Prompts Seen Prior to Upgrade
ggplot(awesome, aes(x=prompts_seen)) +
geom_density(alpha=0.2) +
coord_cartesian(xlim=c(0,20)) +
scale_x_continuous(breaks = seq(0,20,1)) +
labs(x='Prompts Seen',y='Percent of Users') +
theme_minimal()
ggplot(awesome, aes(x=prompts_seen,color=used_extension_first_day)) +
stat_ecdf() +
coord_cartesian(xlim=c(0,50)) +
scale_x_continuous(breaks = seq(0,50,10)) +
labs(x='Days From Join to Upgrade',y='Percent of Users') +
theme_minimal()
## Time to Upgrade and Extension Use
ggplot(upgrade_time, aes(x=time_to_upgrade,fill=used_extension_first_day)) +
geom_density(alpha=0.2) +
coord_cartesian(xlim=c(0,500)) +
scale_x_continuous(breaks = seq(0,500,30)) +
labs(x='Days From Join to Upgrade',y='Percent of Users') +
theme_minimal()
ggplot(upgrade_time, aes(x=time_to_upgrade,fill=used_extension_first_week)) +
geom_density(alpha=0.2) +
coord_cartesian(xlim=c(0,500)) +
scale_x_continuous(breaks = seq(0,500,30)) +
labs(x='Days From Join to Upgrade',y='Percent of Users') +
theme_minimal()
ggplot(upgrade_time, aes(x=time_to_upgrade,fill=used_extension_first_month)) +
geom_density(alpha=0.2) +
coord_cartesian(xlim=c(0,500)) +
scale_x_continuous(breaks = seq(0,500,30)) +
labs(x='Days From Join to Upgrade',y='Percent of Users') +
theme_minimal()
ggplot(upgrade_time, aes(x=time_to_upgrade,color=used_extension_first_day)) +
stat_ecdf() +
coord_cartesian(xlim=c(0,500)) +
scale_x_continuous(breaks = seq(0,500,30)) +
labs(x='Days From Join to Upgrade',y='Percent of Users') +
theme_minimal()
## Time to Upgrade and Activation
ggplot(upgrade_time, aes(x=time_to_upgrade,fill=activated)) +
geom_density(alpha=0.2) +
coord_cartesian(xlim=c(0,500)) +
scale_x_continuous(breaks = seq(0,500,30)) +
labs(x='Days From Join to Upgrade',y='Percent of Users') +
theme_minimal()
ggplot(upgrade_time, aes(x=time_to_upgrade,color=used_extension_first_day)) +
stat_ecdf() +
coord_cartesian(xlim=c(0,500)) +
scale_x_continuous(breaks = seq(0,500,30)) +
labs(x='Days From Join to Upgrade',y='Percent of Users') +
theme_minimal()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment