Skip to content

Instantly share code, notes, and snippets.

Created Dec 15, 2012
What would you like to do?
# Read in data
timeSeriesElectionData <- read.table("twitterElectionTimeline_tsvWithHeader.txt",header=TRUE)
# Attach columns of data as variables in R environment
# open a pdf file for writing
# plot the sum of tweets about obama and romney, as a line, with no x-axis ticks, bla bla...
plot(obama+romney, type='l',xaxt='n',xlab='Date',ylab="Number of Obama and Romney Tweets")
# create a sequence of dates, from Mar. 1 to Dec. 1, by month
d <- seq.Date(from=as.Date('2012-3-01'), to=as.Date('2012-12-01'),by='month')
# find the number of data points:
# output: [1] 1068
# write the dates as axis ticks
#close the pdf file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment