The code below also tabulates the total number of tweets by username, and plots the 40 most prolific. Interestingly several of the folks in this list weren't even at the meeting.
I'll update the plots above at the conclusion of the meeting.
I'll update the plots above at the conclusion of the meeting.
Here's the code below. There's a limitation with this code - you can only retrieve a maximum of 1500 tweets per query without authenticating via OAuth before you receive a 403 error. The twitteR package had a good vignette about how to use the ROAuth package to do this, but I was never able to get it to work properly. The version on CRAN (0.9.1) has known issues, but even when rolling back to 0.9.0 or upgrading to 0.9.2 from the author's homepage, I still received the 403 signal. So my hackjob workaround was to write a loop to fetch all the tweets one day at a time and then flatten this into a single list before converting to a data frame. You still run into the limitation of only being able to retrieve the first 1500 for each day, but #ISMB never had more than 1500 any one day. If you can solve my ROAuth problem, please leave a comment or fork the code on GitHub.
Very useful post, thanks. So far I have the exact same issue as you using ROAuth 0.9.2. Also, I think the "until" parameter for searchTwitter() is very confusing. It seems to mean "up to but not including", whereas my brain would interpret it as "up to but not later".
ReplyDeleteA week ago, I was using the twitteR package as well and the ROAuth problem seems to be rampant.
ReplyDeleteI stumbled on the maintainer of the library's post, and it stated that he and Hadley are working to fix it
I'm glad to see I'm not the only one having problems with ROAuth. Glad Jeff and Hadley are working on it.
ReplyDeleteI'm getting this message:
ReplyDelete- "Rate limited .... blocking for a minute ..."
Any ideas?
This is working well for me: https://github.com/sferik/t
ReplyDeletePlease I have an error at that line:
ReplyDeleteggplot(data=tweets, aes(x=created)) +
geom_bar(aes(fill=..count..), binwidth=60*minutes) +
scale_x_datetime("Date") +
scale_y_continuous("Frequency") +
opts(title="#ISMB Tweet Frequency July 11-17", legend.position='none')
ggsave(file='ismb-frequency.png', width=7, height=7, dpi=100)
>> the error is:Error: Use 'theme' instead. (Defunct; last used in version 0.9.1)
Hello
ReplyDeleteI am trying to use this code but the geom_bar() function no longer accepts the binwidth argument so it will not work. Can you suggest an alternative argument?
Thanks
Ciara
I believe ggplot2 tells you what to do...
ReplyDeleteWarning message:
`geom_bar()` no longer has a `binwidth` parameter. Please use `geom_histogram()` instead.