Skip to content

Instantly share code, notes, and snippets.

View jwinternheimer's full-sized avatar

Julian Winternheimer jwinternheimer

View GitHub Profile
@jwinternheimer
jwinternheimer / ui.R
Created May 29, 2015 01:46
diversity-app
shinyUI(fluidPage(
titlePanel("Buffer Diversity Dashboard"),
sidebarLayout(
sidebarPanel(
selectInput("dataset", "Choose a dataset:",
choices = c("buffer", "applicants"))),
mainPanel(
plotOutput("ethnicityPlot")
),
@jwinternheimer
jwinternheimer / server.R
Last active August 29, 2015 14:22
diversity-app
library("XML")
library("ggplot2")
library("downloader")
library('scales')
library('grid')
library('RColorBrewer')
function(input, output) {
@jwinternheimer
jwinternheimer / diversity.R
Last active August 29, 2015 14:22
Diversity Plots
library(data.table); library(dplyr); library(tidyr)
library(ggplot2); library(RColorBrewer)
## IMPORT AND TIDY DATA
demo_data <- read.csv(file.choose(),header=T)
names(demo_data) <- c("datetime","gender","ethnicity","region","age_range","department")
demo_data$ethnicity <- gsub("White","Caucasian",demo_data$ethnicity)
demo_data$ethnicity <- gsub("Southeast Asian","Asian",demo_data$ethnicity)
@jwinternheimer
jwinternheimer / churn_exploration.R
Last active August 29, 2015 14:21
churn_exploration.R
library(data.table); library(dplyr); library(tidyr)
library(ggplot2); library(scales); library(grid); library(RColorBrewer)
###############################################################
## MOST COMMON ACTIONS DURING FIRST TWO WEEKS
###############################################################
## IMPORT AND TIDY DATA
healthy_user_actions <- read.table("~/Downloads/small_user_actions.csv",header=T,sep=",")
churned_user_actions <- read.table("~/Downloads/churned_users_actions.csv",header=T,sep=",")
@jwinternheimer
jwinternheimer / hs_conversations.py
Created May 15, 2015 13:18
Grab Helpscout Conversations and Store in JSON File
import requests
import json
import io
from requests.auth import HTTPBasicAuth
api_key = 'daa5ba542ef9e029ec90316f21647d97d74c20f5'
pages=50
page=1
library(tm);library(SnowballC); library(wordcloud); library(RColorBrewer);library(RWeka)
## Read Text File of Conversations
hs <- read.table("~/PycharmProjects/helpscout-api/hs/hs_text.txt",header=F)
names(hs) <- c("text")
## Clean Text and Move to Data Frame
hs_text <- as.data.frame(clean.text(hs$text))
names(hs_text) <- c("text")
@jwinternheimer
jwinternheimer / growth_exploration.R
Created April 28, 2015 16:19
Growth Exploration
library(data.table); library(dplyr); library(tidyr); library(plyr)
library(ggplot2); library(scales); library(grid); library(RColorBrewer)
##################################################
## Number of Profiles for Awesome Users
##################################################
## Import and Tidy Data
awesome_active_profiles <- read.table("~/Downloads/awesome_active_profiles.csv",sep=",",header=T)
@jwinternheimer
jwinternheimer / churn_exploration.R
Last active August 29, 2015 14:18
Churn Rate Exploration
library(data.table)
library(dplyr)
library(tidyr)
library(ggplot2)
## Read CSV from Looker
churn <- read.table("~/Downloads/trailing_churn.csv",sep=",",header=T)
names(churn) <- c("date","awesome","business","overall")
library(data.table); library(dplyr); library(tidyr)
library(ggplot2); library(scales); library(grid); library(RColorBrewer)
## Import and Tidy Data
updates <- read.csv("~/Downloads/pst_updates.csv",header=T)
names(updates) <- c("update_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")