Created
March 16, 2014 01:33
-
-
Save josep2/9577161 to your computer and use it in GitHub Desktop.
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
##Load data | |
Data<-read.csv('twitter_followers.csv') | |
##Load necessary packages | |
library(plotly) | |
##Plotly credentials | |
p <- plotly(username="USERNAME", key="KEY") | |
## Histogram of followers tweets | |
x <- Data$statuses_count | |
FollowersHistogram = list( | |
x = x, | |
type = 'histogramx' | |
) | |
p$plotly(FollowersHistogram) | |
##Get a list of top Locations | |
TopLocals<-as.data.frame(table(Data$location)) | |
TopLocals<-TopLocals[which(TopLocals$Freq>2),] | |
TopLocals<-TopLocals[order(-TopLocals$Freq),] | |
TopLocals = TopLocals[-1,] | |
#Make a bar chart | |
BarLabels<-list( | |
x=TopLocals$Var1, | |
y=TopLocals$Freq, | |
type='bar', | |
text=TopLocals$Var1, | |
marker=list( | |
color='rgb(236,145,9)' | |
) | |
) | |
p$plotly(BarLabels) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment