How To Get Twitter Authentication using R

Portal-Statistik | Hello brothers, today I will share about how to authentication Twitter Application using R. This authentication process is required to get access into Twitter Data . If you want to get data from twitter, you must be getting authentication from twitter.

Oke, Let’s Start
The first ones, you must be  got API key and access token
We must have the API key and access token from Twitter. It is very easy. We just need to make the application on Twitter.
  1. Visit APPS TWITTER and log in using your Twitter account
  2.  Click Create New Apps button.
  3. After that, Fill the form below correctly.
  4. Check "Yes, I agree" in the Developer Agreement
  5. Click Create your Twitter application
  6.  On the Keys tab and Access Tokens, we can see the consumer key (API key) and consumer secret (API secret)
  7. To get access tokens, click the Create my access token
  8.  Now that, we have obtained all the "secret code" that can be used for the authentication process, the consumer key (API key), consumer secret (API secret), an access token and access token secret.

Install twitteR Packages from GitHub

Install the latest version of R and the twitteR package from GitHub.
install.packages(c("devtools", "rjson", "bit64", "httr"))
library(devtools)
install_github("twitteR", username="geoffjentry")
library(twitteR)
User guide about how to install the R package can be seen in the article Installing R Package.

Twitter Authentication with R

The process of authentication performed using  setup_twitter_oauth() function with the format:
setup_twitter_oauth(api_key, api_secret, access_token, access_token_secret)
Use the key and token obtained in the previous step.
When a function is executed, R console will ask you: Use a local file to cache OAuth access credentials between R sessions?. Type 1 or 2.

Congratulations, the authentication process has been successful and then we can extract data from Twitter, for example searching for the latest tweets containing the word 'UII'.
searchTwitter("UII")
Twitter search ("UII") By the way for the record, we have to perform the above authentication process at each session of R.

Thank You for Visiting my blog.
Have Fun with How To Get Twitter Authentication using R Article
Tag : DataMining, R, Twitter
0 Komentar untuk "How To Get Twitter Authentication using R"

Silahkan tinggalkan komentar, kritik, maupun saran dari sobat blogger tentang apa yang sobat rasakan setelah mengunjungi blog ini.

Back To Top