Objective: To extract location wise trending topics on Twitter
Step 1: Install and Load required packages
>intsall.packages('twitteR')
>library(twitteR)
Step 2: Set up and validate OAuth
Click here for a step wise guide to generate API key, API Secret, Access Token and Secret
>api_key <- "YOUR API KEY"
>api_secret <- "YOUR API SECRET"
>access_token <- "YOUR ACCESS TOKEN"
>access_token_secret <- "YOUR ACCESS TOKEN SECRET"
>setup_twitter_oauth(consumer_key = api_key, consumer_secret = api_secret, access_token = access_token, access_secret = access_token_secret)
Step 3: Fetch trends based on WoeID
Get any location's Woeid from here
>woeid <- 23424848 #woeid for India
>India_Trends <- getTrends(woeid)
>view(India_Trends)
Output
For any query write to us at info@planetanalytics.in




















