My evaluation of twitteR Package

Published by chengjun on July 24th, 2011
# @author Chengjun WANG
# @date July 22, 2011
#~~~~~~~~~~~~~~~~~~Mining twitter with R~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
sessionInfo() # See the information of packages in use.
# update.packages() # press enter to skip, and press 'y' to choose twitteR
# Only twitteR_0.99.9 can run it.
#~~~~~~~~~~~~~~~~~~~~~~~~~~twitter search~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
tweets = searchTwitter("#rstats", n=1500)
# The n=1500 specifies the maximum number of tweets supported by the Search API
# head(tweets) # return first 6 tweets searched
# class(tweets[[1]])
#~~~~~~~~~~~~~~~~~~~~~~~~~~~use plyr~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
tweets.df = ldply(tweets, function(t) t$toDataFrame())
# ldply: plit list, apply function, and return results in a data frame.
# str(tweets.df)
tweets.text = laply(tweets, function(t) t$getText())
tweets.name1 = laply(tweets, function(t) t$getScreenName())
# compare ldply with laply
tweets.name2 = ldply(tweets, function(t) t$getScreenName())
head(tweets.name1, 2)
head(tweets.name2, 10)
publicTweets <- publicTimeline()
publicTweets[[1]]$getScreenName()   # isS4(publicTweets[[1]])
#~~~~~~~~~~~~~~~~~~~~~~control the period, place~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
searchTwitter('charlie sheen', since='2011-03-01', until='2011-07-12', n=100)
searchTwitter('charlie sheen', since='2011-03-01',n=10)
searchTwitter('patriots', geocode='42.375,-71.1061111,10mi')
searchTwitter("#beer", n=100)
#~~~~~~~~~~~~~~~~~~~~~~~~~Authentication with OAuth~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
cred <- OAuthFactory$new(consumerKey ='1tEqlc1UzY7rzwtgrqbuCQ',
consumerSecret = 'mxHyBeb6qHIv8YvARlV4B0wPVJclnpCjUNWFA2XxBxw',
requestURL= '',
accessURL= '',
authURL= '')
# cred$handshake()
# The OAuth object, once the handshake is complete, can be saved and reused.
# You should not ever have to redo the handshake.
# This example is run, but likely not how you want to do things
us <- userFactory$new(screenName="test", name="Joe Smith")
curTrends <- getTrends("current")
yesterdayTrends <- getTrends("daily", date = as.character(Sys.Date()-1))
lastWeekTrends <- getTrends("weekly", date = as.character(Sys.Date()-7))
#~~~~~~~~~~~~~~~~get the information source of tweets~~~~~~~~~~~~~~~~~~~~~~~~~~~#
sources <- sapply(publicTweets, function(x) x$getStatusSource())
sources_1 <- gsub("", "", sources)
sources_2 <- strsplit(sources_1, ">")
sources_3 <- sapply(sources_2, function(x) ifelse(length(x) > 1,x[2], x[1]))
df <-"rbind", lapply(publicTweets,
crantastic <- getUser("crantastic")
# a particular user's timeline
cranTweetsLarge <- userTimeline("cranatic", n = 100)
cjwTweets<- userTimeline("ChengjunWANG", n = 100)
# Error in .self$twFromJSON(out) : Error: Not authorized

Jeff Gentry has done quite good job with this package,  which make great progress in the edition 0.99.9, however, there seems to be a long way to go. The potential is great, and I will pay more attention to the future improvement of it.

You can find the full evaluation by the following link here.


7 Responses

  1. e-ticaret says:

    Wonderful site. A lot of helpful info here. I¡¦m sending it to several friends ans also sharing in delicious. And obviously, thanks for your sweat!

  2. tanie obuwie says:

    hello!,I like your writing so much! share we communicate more about your post on AOL? I require an expert on this area to solve my problem. Maybe that’s you! Looking forward to see you.

  3. An interesting dialogue is price comment. I feel that it is best to write extra on this topic, it may not be a taboo topic but typically individuals are not sufficient to speak on such topics. To the next. Cheers

  4. www says:

    Hello there, You’ve done an excellent job. I will certainly digg it and personally recommend to my friends. I’m confident they will be benefited from this website.

  5. I do agree with all the ideas you have presented in your post. They’re really convincing and will certainly work. Still, the posts are very short for starters. Could you please extend them a bit from next time? Thanks for the post!!

  6. Good post. I learn something very complicated on different blogs every day. It will always be stimulating to learn to read content from other writers and practice a little from their store. I’d prefer to use some with all the content on my blog whether you don’t mind. Natually I’ll give which you link on your web blog. Thanks for sharing.

  7. hello there and thank you for your info – I have certainly picked up anything new from right here. I did however expertise several technical issues using this site, since I experienced to reload the website a lot of times previous to I could get it to load properly. I had been wondering if your web hosting is OK? Not that I am complaining, but slow loading instances times will sometimes affect your placement in google and could damage your quality score if advertising and marketing with Adwords. Anyway I am adding this RSS to my email and can look out for much more of your respective exciting content. Make sure you update this again very soon..

Leave a Reply

Your email address will not be published. Required fields are marked *



0 visitors online now
0 guests, 0 bots, 0 members