How Many Tweets I Have Tweeted in the Past?

This blog post is kinda lame, but I got so excited to get something worked in R. I have been wondering what I have been doing for the last years.

I’m sitting at my desk and thinking how can I know that. Then, yeah I can analyse my own tweets. So, I downloaded all my tweets from Twitter and started crushing some number.

I’m guessing you can use this code as the format of the csv file should be the same.

If you haven’t done this already.

1
2
install.packages("plyr")
install.packages("ggplot2")
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
library(plyr)
library(ggplot2)

#Load all your tweets
tweets<-read.delim("data/tweets.csv", sep=",")

#Convert timestamp to Date in R
tweets$timestamp<-as.POSIXlt(tweets$timestamp, format="%Y-%m-%d %H:%M:%S +0000")

#Get month in JAN-DEC format
tweets$month = strftime(tweets$timestamp, "%b")
#Get year in 2011-20xx format
tweets$year = strftime(tweets$timestamp, "%Y")

#Then start counting for each month compare to each year
timestamps_month = count(tweets, vars = c("month","year"))

#Then just plot the graph
ggplot(data = timestamps_month) + geom_bar(aes(x = month, y = freq, fill = year), stat="identity", position = "dodge")

This is what I have been tweets for the past years. Interestingly I tweeted a lot back in 2010, hmm I was wondering what did I tweet. Well I gotta go to bed will find out tomorrow. What’s yours?

My tweets

Aug 22nd, 2013
r

Comments