This file contains hidden or 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
# load libraries | |
library(dplyr) | |
library(buffer) | |
library(data.table) | |
# set working directory | |
setwd("/Users/julianwinternheimer/Downloads/subscriptions") | |
# list files | |
filenames <- list.files(pattern = "*country.csv") |
This file contains hidden or 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
September 2017 is set ot be a month of low growth for Buffer. We are expected to increase MRR by around 15K in the month of September, which is over 50% less than what was gained in the month of August. This growth will equate to a monthly percentage of less than 1%, which is lower than what we would expect. | |
In this exploration, I will try to identify factors leading to the decrease in net MRR gained. We will focus on Stripe MRR here, as it makes up the majority of our total MRR amount. It is worth noting that Apple has also experienced lower-than-expected growth (it has only gained a few hundred dollars in September as of September 25). We would still not expect growth this low from the Stripe gateway. | |
```{r include = FALSE, warning = FALSE, message = FALSE} | |
library(dplyr); library(ggplot2); library(tidyr); library(lubridate); library(buffer) | |
``` | |
### Gather data | |
We'll use the [new Stripe MRR breakdown script](https://github.com/bufferapp/buffer-analysis/blob/master/deliverables/mrr-breakdown.md) to analyz |
This file contains hidden or 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(jsonlite); library(buffer); library(DBI) | |
# Make the request | |
req <- GET("https://openexchangerates.org/api/latest.json?app_id=xxxxxxxxxxxxxxxxxx") | |
# Get the status | |
http_status(req) | |
# Get the content in the request | |
content <- content(req) |
This file contains hidden or 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(twitteR); library(wordcloud); library(tm); library(RColorBrewer); library(praise) | |
# Twitter Oauth | |
my_key <- "xxxxxxxxxxxxxxxxxxxxxxxxx" | |
my_secret <- "xxxxxxxxxxxxxxxxxxxxxxxxx" | |
access_token <- "xxxxxxxxxxxxxxxxxxxxxxxxx" | |
access_secret <- "xxxxxxxxxxxxxxxxxxxxxxxxx" | |
setup_twitter_oauth(my_key,my_secret) |
This file contains hidden or 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(data.table); library(dplyr); library(tidyr); library(ggplot2); library(xts) | |
## Import and Tidy | |
stripe <- read.table('~/Downloads/stripe.csv',sep=',',header=T) | |
stripe$start_date <- as.Date(as.POSIXlt(stripe$start, format="%Y-%m-%d %H:%M:%S")) | |
stripe$end_date <- as.Date(as.POSIXlt(stripe$ended_at, format="%Y-%m-%d %H:%M:%S")) | |
## Aggregate Awesome Start Dates and Count Users | |
awesome_start_date <- stripe %>% | |
filter(plan_id == 'pro-annual' | plan_id == 'pro-monthly' | plan_id == 'awesome') %>% |
This file contains hidden or 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
## 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) |
This file contains hidden or 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(data.table); library(dplyr); library(tidyr); library(ggplot2);library(NbClust) | |
## Read Data | |
data <- read.table("~/Downloads/business_users.csv",sep=",",header=T) | |
names(data) <- c("user_id","team_members","profiles","months_paying","plan_days","updates","updates_per_day_per_profile") | |
## Prep Data | |
data[is.na(data)] <- 0 | |
## Separate Variables We're Interested In |
This file contains hidden or 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(tm);library(SnowballC); library(wordcloud); library(RColorBrewer);library(RWeka) | |
library(ape) | |
## Read Text File of Conversations | |
get_text <- function(filename) { | |
txt <- read.table(filename, header=F) | |
names(txt) <- "text" | |
txt <- as.data.frame(clean.text(txt$text)) | |
names(txt) <- "text" |
This file contains hidden or 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(data.table); library(dplyr); library(tidyr) | |
library(ggplot2); library(scales); library(grid); library(RColorBrewer) | |
## Import Dataset | |
updates <- read.csv("~/Downloads/updates.csv",header=T) | |
names(updates) <- c("update_id","profile_id","num_chars","num_explanation","num_hashtags", | |
"hour_sent","num_followers","follower_tier","link","link_no_content", | |
"photo","text","interactions","retweets","favorites","mentions", | |
"clicks","avg_interaction_length") |
This file contains hidden or 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(data.table); | |
library(dplyr); | |
library(tidyr); | |
cleanGoogleTable <- function(dat, table=1, skip=0, ncols=NA, nrows=-1, header=TRUE, dropFirstCol=NA){ | |
if(!is.data.frame(dat)){ | |
dat <- dat[[table]] | |
} | |
if(is.na(dropFirstCol)) { |
NewerOlder