Grab Twitter search data using R and export to a tab delimited file


In this blog-post, we would see how you can grab Twitter search data using R and then export it to tab delimited file. Here are the steps:

1) First up, if we do not have R – you can install it by following the tutorial: Let’s install R Studio and R on windows machine

2) Instal Package: TwitteR if you haven’t

3) Look at the following code, modify the path in line #4 for write.table:

> require(twitteR)

> tweets <- searchTwitter(“#excel”,n=1500)

> tweetdataframe <-“rbind”,lapply(tweets,

> write.table(tweetdataframe,”c:/users/paras/desktop/tweetsaboutexcel.txt”,sep=”t”)

4) so now you have tab delimited file having about 1500 tweets!

1500 tweets R excel tab delimited RStudio code

You can also export the tweets to Excel spreadsheet, SPSS and SAS. Check this out: quick R Exporting Data


In this blog-post, we saw how you can grab 1500 tweets using R and then export it to a tab delimited file.

Addressing few Q’s a reader had about Google’s BigData offering BigQuery:


After reading First Impression: Google’s BigData offering called BigQuery , a reader (Shadab Shah) had few questions about it and in this blog-post, I am going to address those questions:

Q1. Any browser based Tool’s to Query data in BigQuery?

A1: They have a Browser Based Tool which they call “BigQuery Browser Tool” using which you can Query Data.

Apart from browser based, there are other tools too:

1) a command line tool called “BQ command-line tool. You can find more information here:

2) API. one can “include” big data analytic capabilities into a web app via RESTFul API. (Point #2 content credit: Michael Manoochehri’s comment)

Q2) Where is the Data Stored? 

If i just say “Google Cloud” that would not be a complete answer. There’s a complementary service called “Google CLOUD SQL” and so I do not want you to confuse data stored for BigQuery with “Google cloud SQL”.Theres’ a difference between BigQuery and Google cloud SQL, you can read that here:

Having said that, it’s stored on Google’s cloud and if you wish to use BigQuery – you’ll have to upload your data-set in a CSV format and if you do so, it’s stored in Google cloud and is ready to be analyzed via BigQuery.

Q3) Where do I find lots of data to play with BigQuery?

Google has few sample data-sets that you can play with:

bigquery sample data

That’s about it for this post. Thanks Shadab Shah for the questions, I hope this post is useful.