Your verification ID is: guDlT7MCuIOFFHSbB3jPFN5QLaQ Big Computing: Setting up the Twitter R package for text analytics

Tuesday, February 23, 2016

Setting up the Twitter R package for text analytics

The Twitter R package by Jeff Gentry is a great way to get started in Text Analytics. This tutorial is about how to get setup to pull twitter data into R so that you can do some text analytics with it. Basically it is only the first step of getting data in a text analytics Workflow. I should also give a shout out here to Ted Kawartler for getting me interested in learning more about text analytics.

The first thing you need to do is downloadd the twitteR package and make it available in your R session.


Now on the Twitter side you need to do a few things to get setup if you have not done them already. I will go through this step by step so no one gets lost. It drives me crazy when people go too fast on the setup so I can't use the tool.

You need to have a twitter account. if you do not have one go to and set one up. Also you need to have a modile number as part of this account.

Now that you have created a twitter account you need to go to and sign on with your twitter account.

Once you have signed in you should see the following screen, and simply click on the button that says "Create New App".

Once you click on the "Create New App" button you will go to the Create an Application screen. There are three fields, a click box and a button you need to click on this page. The three fields are Name, Description and Website. The name of the application must be unique so this may take a few tries. The description needs to be at least 10 character long, and put in a website. If you do not have one you can use Now click the "Yes, I agree" box for the license agreement and click the "Create your Twitter application".

Once you successfully create an appplication you will be taken to the application page. Once there click on the "key and access token" tab. From that page you are going to need four things.

1. Consumer Key (API Key)
2. Consumer Secret (API Secret)

click the "Create my access token" button.

3. Access Token
4. Access Token Secret

Now re-open your R session and enter the following code using those four pieces of information.

consumer_key <- "your_consumer_key"
consumer_secret <- "your_consumer_secret"
access_token <- "your_access_token"
access_secret <- "your_access_secret"

setup_twitter_oauth(consumer_key, consumer_secret, access_token, access_secret)

Now you are set up on the Twitter side and the R side you should be ready to go. I will cover doing some basic data pulls from Twitter in my next post



  1. Thanks a lot for this post. I had given up trying to set up the Twitter OAuth thingy, but your explanation was brief and effective. I am most grateful and I'm looking forward to the next post so I can dig into Twitter and learn a lot more about text analytics.

    1. No Problem. Often setting up everything is the hard part, and doing the actual work is fairly easy.

  2. Great piece with so much insight on this subject. It's worth giving a try though am not yet routed on R

  3. Sending you my thanks as well, for this post and your whole blog! I'm also just begun learning R for my student research and so am looking forward to more of your posts. :)

  4. Twitter verification is an interesting phenomenon on the service. twitter verification

  5. Hi fellas,
    Thank you so much for this wonderful article really!
    If someone want to read more about that Twitter Analytics I think this is the right place for you!

  6. Hi. Terribly sorry to bother you, but I can't see to do the final step:
    setup_twitter_oauth(consumer_key, consumer_secret, access_token, access_secret)

    It keeps telling me there's an unexpected symbol. Any idea why this might be? Thanks.

  7. This comment has been removed by the author.

  8. Is there a continuation for this post? I don't seem to find it.


  10. The specialized group of Yahoo is available in these exchanges and aides you with any issues over the visit. However, yippee has its toll free line number four Yahoo Helpline Number it is accessible at all the hours and you can address the specialized group of where Yahoo whenever you longing and resolve your issues.

  11. The blog or and best that is extremely useful to keep I can share the ideas. Age Of War 2
    Big Farm | Slitherio | Tank Trouble
    Of the future as this is really what I was looking for, I am very comfortable and pleased to come here. Thank you very much.
    Happy Wheels | Goodgeme Empire |

  12. You go to our Web page you can play online games for free.
    Our Web page selection is the biggest collection so you can play entirely for free
    gun mayhem | age of war
    learn to fly | happy wheels game
    tank trouble

  13. And money. Thank God for instant loans! It is usually fast loans difficult to approach
    fireboy and watergirl
    Geometry Dash

  14. And money. Thank God for instant loans! It is usually fast loans difficult to approach
    Subway Surfers
    Subway Surf
    Subway Surfers download

  15. Thanks for the share loved reading the article, please do share more like this wiht us .
    happy wheels
    return man 3

  16. Such a very useful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article.

    Discover our website bounty of free online games now!
    Our website has the biggest collection of free online games. Totally new games are added every day!

    age of war 2| gold Miner 2| unfair Mario 2 | cubefield 2 |tanki Online 2

  17. تعتبر العاب تلبيس من اشهر الانواع في هذا المجال وهي بدورها تتضمن عدة اصناف جميلة ويعشقها الكتير وخاصة البنات منها العاب تلبيس ومكياج التي تمزج بين التلبيس وكذلك الميك اب في آن واحد هذا الامر الدي يزيد من جمالها وتجعل كل من يلعبها يستمتع بذلك زد على ذلك العاب تلبيس باربي التي تعرف شعبية كبيرة لانها شخصية مشهورة ويعرفها الصغير والكبير ولهم ذكريات جميلة معها لانها اشتهرت في عالم الكارتون والان اصبح الامر كذلك في مجال الالعاب وغير هذا هناك كذلك نوع آخر مميز ايضا وهو العاب تلبيس عرائس فالجميع يحلم ان يقوم بتلبيسهما لانها تذكرهم بهذه المناسبة الجميلة الا وهي الزواج التي تعتبر اهم مرحلة في حياة الانسان وهناك انواع مغايرة لها جمهور كبير في كل انحاء العالم وهي العاب قص الشعر ليس هي فقط بل توجد ايضا العاب طبخ جديدة التي يمكن للجميع لعبها سواء كانوا اولادا او بناتا وهي الاكتر طلبا في النت ويحبها الجميع ومعها ايضا العاب باربي التي تكلمنا عليها بكل انواعها

  18. how to deal with this error?:
    [1] "Using direct authentication"
    Error in check_twitter_oauth() : OAuth authentication error:
    This most likely means that you have incorrectly called setup_twitter_oauth()'

    I encountered that after executing code:

    setup_twitter_oauth(consumer_key, consumer_secret, access_token, access_secret)


  19. I would like to thank you for your nicely written post

    atari breakout |  free mahjong | cooking fever |  traffic rider | mario

  20. This comment has been removed by the author.

  21. Thank you for sharing such a nice and interesting blog with us. I have seen that all will say the same thing repeatedly. But in your blog, I had a chance to get some useful and unique information. I would like to suggest your blog in my dude circle.
    Isoft Innovations Company Address
    Isoft Innovations Adyar
    Isoft Innovations Reviews
    Isoft Innovation Chennai
    Isoft Innovation

  22. Thank you for taking the time to provide us with your valuable information. We strive to provide our candidates with excellent care and we take your comments to heart.As always, we appreciate your confidence and trust in us
    SEO Company in India

  23. This is an awesome post.Really very informative and creative contents. These concept is a good way to enhance the knowledge.I like it and help me to development very well.Thank you for this brief explanation and very nice information.Well, got a good knowledge.
    Fresher Jobs
    Fresher Openings

  24. Very Awesome post !! i read it very informative and good content. I will keep your blog and again visit after some time

  25. Thank you for the details, I can't wait until your next post, have figured it out and analyzed Trump's latest tweets

  26. Your blog posts are more interesting and impressive. I think there are many people like and visit it regularly, including me.I actually appreciate your own position and I will be sure to come back here.
    hotmail login l login hotmai l hotmail log in l hotmail sign in l hotmail sign up

  27. Nice! thank you so much! Thank you for sharing. Your blog posts are more interesting and impressive. I think there are many people like and visit it regularly, including me.I actually appreciate your own position and I will be sure to come back here.
    facebook baixar l baixar facebook l baixar facebook gratis l facebook movel l facebook movel baixar