WhatsApp Chat Sentiment Analysis in R

Analyse And Visualise Twitter Timelines

Objective: To retrieve a timeline from the Twitter Universe and Visualise the data.

Step 1: Install and Load required packages


Step 2: Set up twitter 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 Timeline

We will fetch Indian Prime Minister Narendra Modi's Timeline and work on 100 recent activities on his timeline. 

>ModiTimeline <- userTimeline('narendramodi', n = 100)

#convert it into a data frame
>df <- do.call("rbind", lapply(ModiTimeline, as.data.frame))



>qplot(x = df$favoriteCount, y = df$created, data = df, xlab = "Favorite count per tweet", ylab = "Date")+
  geom_point(col = "blue", na.rm = TRUE)


Write to us at info@planetanalytics.in