SlideShare a Scribd company logo
Social Media
Analysis using
twitteR
Mohd Shadab Alam
Lead Assistant Manager,
Inductis
What will be covered?
• Introduction to twitter APIs
• How to use twitter APIs in R
• Capturing twitter data
• Google map API
• Tweets Distribution
• Sentiment analysis using twitter data
• Followers accession diagram
Introduction to twitter APIs
• API stands for application interface
“a set of functions and procedures that allow the
creation of applications which access the
features or data of an operating system,
application, or other service”
• Two of the most commonly used
APIs are:
(a) Stream API
(b) REST API
GENERAL INTRODUCTION
Introduction to twitter APIs
TWO APIs: DEFINITION
(a) Stream API
To listen to the live tweets of a user, or
listen to tweets having a particular keyword
we use Stream API
(b) REST API
If we want to retrieve archival data then we
use REST API
Introduction to twitter APIs
API input/output structure
INPUT OUTPUT
User name tweet
Key word Time
Date range Lat long (geo coding)
Lat long range followers
Language retweets
and so on… and so on..
How to use twitter API in R
AUTHENTICATION
We need to log into the twitter
developer account to set up an
authentication channel
dev.twitter.com
Secure authentication key and
password are needed before we
can start using the APIs
How to use twitter API in R
AUTHENTICATION
How to use twitter API in R
AUTHENTICATION
NOTE: Do not forget to register the mobile number
How to use twitter API in R
REGISTERATION PROCESS
Required Libraries
install_github("twitteR",username="geo
ffjentry")
require(twitteR)
setup_twitter_oauth(“f5GhnjWoR17clm
d85PMQfjhHO",
"QUZlAyj9w9O50TbyYdlNBkV7zILLs4
zjhhQFJ2sbBIxhp4Alm2")
Capturing twitter data
API CALL
Sample API calls:
userTimeline('MaxLifeIns', n=3200)
user$getFollowers()
t(sapply(getUser('MaxLifeIns')
$getFollowers(), function(x) c(x$name,
x$location, x$statusesCount)))
Capturing twitter data
HOW DATA LOOKS LIKE
C:Usersshadab
Desktoptwitterfollowers
Google map API
API CALL
Sample API calls:
require(ggmap)
map <- get_map(location = 'India',
zoom = 4)
points <- data.frame(x =
as.numeric(loci$lon), y =
as.numeric(loci$lat))
ggmap(map) + geom_point(data =
points, aes(x = x, y = y), size = 3,
alpha = 1/3, color = "darkblue")
Tweets distribution
MAP
Sentiment analysis
WORD CLOUD
Positive Negative
win poor
appreciable worst
performer decrease
increase loose
nice not
and so on… and so on..
Corpus is created and word is replaced with the stem word like
running is replaced with “run” etc. Frequency of positive and
negative words are counted to mark a sentence as positive or negative.
Followers accession diagram
The DIAGRAM
THOUGHTS!
QUESTIONS?
THANK YOU!!!
THANK YOU SLIDE!!!

More Related Content

DOCX
Twitter analysis by Kaify Rais
PPTX
R project(Analyze Twitter with R)
PDF
Data Wrangle and Visualization
PDF
Real time sentiment analysis of twitter feeds with the NASDAQ index
PDF
Warningbird
PPTX
#tmeetup BirdHackers API 101
PPTX
WARNINGBIRD: A NEAR REAL-TIME DETECTION SYSTEM FOR SUSPICIOUS URLS IN TWITTER...
PDF
Text Mining with R -- an Analysis of Twitter Data
Twitter analysis by Kaify Rais
R project(Analyze Twitter with R)
Data Wrangle and Visualization
Real time sentiment analysis of twitter feeds with the NASDAQ index
Warningbird
#tmeetup BirdHackers API 101
WARNINGBIRD: A NEAR REAL-TIME DETECTION SYSTEM FOR SUSPICIOUS URLS IN TWITTER...
Text Mining with R -- an Analysis of Twitter Data

Similar to Social media analysis in R using twitter API (20)

PPTX
Harvesting Data from Twitter Workshop: Hands-on Experience
PDF
CSE5656 Complex Networks - Gathering Data from Twitter
PPTX
Twitter api
PPTX
R Class: Set up Social Media API
PDF
Mining Georeferenced Data
PDF
Twitter data analysis using r (part 2)
PDF
Unleashing Twitter Data for Fun and Insight
PDF
Unleashing twitter data for fun and insight
PPT
Twitter API Trends (Pubcon 2009)
 
ODP
Twitter
PPTX
Twitter_Sentiment_analysis.pptx
KEY
Twitter API 2.0
PDF
Social Media Mining using R
PDF
FInal Project Intelligent Social Media Analytics
PPTX
Text Mining of Twitter in Data Mining
PPTX
Twitter sentiment analysis ppt
PPT
John Conroy
PDF
RDataMining slides-text-mining-with-r
PDF
20130504 - FeWeb - Twitter API
PDF
Querying open data with R - Talk at April SheffieldR Users Gp
Harvesting Data from Twitter Workshop: Hands-on Experience
CSE5656 Complex Networks - Gathering Data from Twitter
Twitter api
R Class: Set up Social Media API
Mining Georeferenced Data
Twitter data analysis using r (part 2)
Unleashing Twitter Data for Fun and Insight
Unleashing twitter data for fun and insight
Twitter API Trends (Pubcon 2009)
 
Twitter
Twitter_Sentiment_analysis.pptx
Twitter API 2.0
Social Media Mining using R
FInal Project Intelligent Social Media Analytics
Text Mining of Twitter in Data Mining
Twitter sentiment analysis ppt
John Conroy
RDataMining slides-text-mining-with-r
20130504 - FeWeb - Twitter API
Querying open data with R - Talk at April SheffieldR Users Gp
Ad

Recently uploaded (20)

PDF
The Fastest Way to Look Popular Buy Reactions Today
PDF
Presence That Pays Off Activate My Social Growth
PDF
Customer Churn Prediction in Digital Banking: A Comparative Study of Xai Tech...
PPTX
Result-Driven Social Media Marketing Services | Boost ROI
PDF
Instagram Reels Growth Guide 2025.......
PDF
Instant Audience, Long-Term Impact Buy Real Telegram Members
PPT
memimpindegra1uejehejehdksnsjsbdkdndgggwksj
PDF
25K Btc Enabled Cash App Accounts – Safe, Fast, Verified.pdf
PDF
Live Echo Boost on TikTok_ Double Devices, Higher Ranks
PDF
The Edge You’ve Been Missing Get the Sociocosmos Edge
PDF
Transform Your Social Media, Grow Your Brand
DOCX
Buy Goethe A1 ,B2 ,C1 certificate online without writing
PDF
Subscribe This Channel Subscribe Back You
PPTX
Strategies for Social Media App Enhancement
PPTX
Developing lesson plan gejegkavbw gagsgf
PPTX
Types of Social Media Marketing for Business Success
PDF
How can India improve its Public Diplomacy - Social Media.pdf
PDF
FINAL-Content-Marketing-Made-Easy-Workbook-Guied-Editable.pdf
PDF
Why Digital Marketing Matters in Today’s World Ask ChatGPT
PPTX
How Social Media Influencers Repurpose Content (1).pptx
The Fastest Way to Look Popular Buy Reactions Today
Presence That Pays Off Activate My Social Growth
Customer Churn Prediction in Digital Banking: A Comparative Study of Xai Tech...
Result-Driven Social Media Marketing Services | Boost ROI
Instagram Reels Growth Guide 2025.......
Instant Audience, Long-Term Impact Buy Real Telegram Members
memimpindegra1uejehejehdksnsjsbdkdndgggwksj
25K Btc Enabled Cash App Accounts – Safe, Fast, Verified.pdf
Live Echo Boost on TikTok_ Double Devices, Higher Ranks
The Edge You’ve Been Missing Get the Sociocosmos Edge
Transform Your Social Media, Grow Your Brand
Buy Goethe A1 ,B2 ,C1 certificate online without writing
Subscribe This Channel Subscribe Back You
Strategies for Social Media App Enhancement
Developing lesson plan gejegkavbw gagsgf
Types of Social Media Marketing for Business Success
How can India improve its Public Diplomacy - Social Media.pdf
FINAL-Content-Marketing-Made-Easy-Workbook-Guied-Editable.pdf
Why Digital Marketing Matters in Today’s World Ask ChatGPT
How Social Media Influencers Repurpose Content (1).pptx
Ad

Social media analysis in R using twitter API

  • 1. Social Media Analysis using twitteR Mohd Shadab Alam Lead Assistant Manager, Inductis
  • 2. What will be covered? • Introduction to twitter APIs • How to use twitter APIs in R • Capturing twitter data • Google map API • Tweets Distribution • Sentiment analysis using twitter data • Followers accession diagram
  • 3. Introduction to twitter APIs • API stands for application interface “a set of functions and procedures that allow the creation of applications which access the features or data of an operating system, application, or other service” • Two of the most commonly used APIs are: (a) Stream API (b) REST API GENERAL INTRODUCTION
  • 4. Introduction to twitter APIs TWO APIs: DEFINITION (a) Stream API To listen to the live tweets of a user, or listen to tweets having a particular keyword we use Stream API (b) REST API If we want to retrieve archival data then we use REST API
  • 5. Introduction to twitter APIs API input/output structure INPUT OUTPUT User name tweet Key word Time Date range Lat long (geo coding) Lat long range followers Language retweets and so on… and so on..
  • 6. How to use twitter API in R AUTHENTICATION We need to log into the twitter developer account to set up an authentication channel dev.twitter.com Secure authentication key and password are needed before we can start using the APIs
  • 7. How to use twitter API in R AUTHENTICATION
  • 8. How to use twitter API in R AUTHENTICATION NOTE: Do not forget to register the mobile number
  • 9. How to use twitter API in R REGISTERATION PROCESS Required Libraries install_github("twitteR",username="geo ffjentry") require(twitteR) setup_twitter_oauth(“f5GhnjWoR17clm d85PMQfjhHO", "QUZlAyj9w9O50TbyYdlNBkV7zILLs4 zjhhQFJ2sbBIxhp4Alm2")
  • 10. Capturing twitter data API CALL Sample API calls: userTimeline('MaxLifeIns', n=3200) user$getFollowers() t(sapply(getUser('MaxLifeIns') $getFollowers(), function(x) c(x$name, x$location, x$statusesCount)))
  • 11. Capturing twitter data HOW DATA LOOKS LIKE C:Usersshadab Desktoptwitterfollowers
  • 12. Google map API API CALL Sample API calls: require(ggmap) map <- get_map(location = 'India', zoom = 4) points <- data.frame(x = as.numeric(loci$lon), y = as.numeric(loci$lat)) ggmap(map) + geom_point(data = points, aes(x = x, y = y), size = 3, alpha = 1/3, color = "darkblue")
  • 14. Sentiment analysis WORD CLOUD Positive Negative win poor appreciable worst performer decrease increase loose nice not and so on… and so on.. Corpus is created and word is replaced with the stem word like running is replaced with “run” etc. Frequency of positive and negative words are counted to mark a sentence as positive or negative.