SlideShare a Scribd company logo
Requirements
 Library: twitteR
o Provides an interface to the Twitter web API.
 R is an open source programming language and
software environment for statistical computing and
graphics
 RStudio:RStudio is a free and open source
integrated development environment (IDE) for R
Steps
1. Signup in twitter
2. Go to apps.twitter.com and register Application
Program Interface(API) using twitter account
3. Get API Key, API Secret, Access Token, Access
Token Secret
1. API KEY:JfpQuWXgr9YVhi1TeYzGLagKy
2. API Secret:
Ao8afu033PQMslxsLvKMdgVhIFRMiV9Ie2ppXg3oB
eIvF0ZnZz
3. Access Token: 927320525285634049-
dOhOiQFH708QVJeslJfqVnYgKxxe5mu
4. Access Token Secret:
JYQKFhsMjlI8xid8ozVerRfHSq8KrpZFky5m9vFh3ox
4. Install Twitter Library
1. install. packages("twitteR") or
5. Set twitteR library
1. Load: library(twitteR)
2. setup_twitter_oauth(api_key,api_secret,access_toke
n,access_token_secret)
Demo1: Text Mining with WordCloud
 install. Packages(“tm”)
install. packages(“wordcloud”)
library(“twitteR”)
library(“tm”)
library(“ROAuth”)
library(“wordcloud”)
>ref<-searchTwitter(“Himalayas”, n=100,lang=“en”)
>ref_samp<-sapply(ref, function(x), x$getText())
ref_corpus(vectorsource(ref_samp))
 inspect(ref_corpus)
 ref_samp<-tm_map(ref_corpus,
removepunctuation)
 ref_samp<-tm_map(ref_samp,
content_transformer(tolower))
 ref_samp<-tm_map(ref_samp, removewords,
stopwards((“english”))
Demo2:Text Mining with R – an Analysis of Twitter Data
 >unstructured data
 >text categorization
text clustering
 entity extraction
Text Mining process
extract data from Twitter
clean extracted data and build a document-term matrix
find frequent words and associations
create a word cloud to visualize important words
text clustering
Retrieve Tweets
 searchTwitter("hello World", since='2017-11-01',
until='2017-11-8')
 jalandhar<-
searchTwitter("thursday",geocode='31.326,75.5762,5
mi')
 japan<-
searchTwitter("thursday",geocode='35.6895,139.691
7,5mi')
 a<-c(length(j),length(z))
Demo 3: Getting Trends
 Trends <- availableTrendLocations()
 head(trend)
 Trends
 World<-getTrends()
 length(intersect(World[[1]], l[[1]]))
 mat=matrix(nrow = 2 ,ncol = 2)
mat[[1,1]]=length(intersect(World[[1]], World[[1]]))
mat[[1,2]]=length(intersect(World[[1]], l[[1]]))
mat[[2,1]]=length(intersect(l[[1]], World[[1]]))
mat[[2,2]]=length(intersect(l[[1]], l[[1]]))
Thank You

More Related Content

Similar to R project(Analyze Twitter with R)

Why "Hello World" is a Massive Operation - From Python code to Stack Virtual ...
Why "Hello World" is a Massive Operation - From Python code to Stack Virtual ...Why "Hello World" is a Massive Operation - From Python code to Stack Virtual ...
Why "Hello World" is a Massive Operation - From Python code to Stack Virtual ...
Richard Rowland
 
Twitter analysis by Kaify Rais
Twitter analysis by Kaify RaisTwitter analysis by Kaify Rais
Twitter analysis by Kaify Rais
Ajay Ohri
 
Building TweetEngine
Building TweetEngineBuilding TweetEngine
Building TweetEngine
ikailan
 
api_slides.pptx
api_slides.pptxapi_slides.pptx
api_slides.pptx
adewad
 
Curiosity Bits Tutorial: Mining Twitter User Profile on Python V2
Curiosity Bits Tutorial: Mining Twitter User Profile on Python V2Curiosity Bits Tutorial: Mining Twitter User Profile on Python V2
Curiosity Bits Tutorial: Mining Twitter User Profile on Python V2
Weiai Wayne Xu
 
OpenWhisk by Example - Auto Retweeting Example in Python
OpenWhisk by Example - Auto Retweeting Example in PythonOpenWhisk by Example - Auto Retweeting Example in Python
OpenWhisk by Example - Auto Retweeting Example in Python
CodeOps Technologies LLP
 
Mining Social Web APIs with IPython Notebook (Data Day Texas 2015)
Mining Social Web APIs with IPython Notebook (Data Day Texas 2015)Mining Social Web APIs with IPython Notebook (Data Day Texas 2015)
Mining Social Web APIs with IPython Notebook (Data Day Texas 2015)
Matthew Russell
 
How to Get Twitter Data Using QGIS and Python
How to Get Twitter Data Using QGIS and PythonHow to Get Twitter Data Using QGIS and Python
How to Get Twitter Data Using QGIS and Python
NopphawanTamkuan
 
Twet
TwetTwet
ASFWS 2013 Rump Session - Abusing Twitter API One year later… Nicolas Seriot
ASFWS 2013 Rump Session - Abusing Twitter API One year later… Nicolas SeriotASFWS 2013 Rump Session - Abusing Twitter API One year later… Nicolas Seriot
ASFWS 2013 Rump Session - Abusing Twitter API One year later… Nicolas Seriot
Cyber Security Alliance
 
Mining Social Web APIs with IPython Notebook (PyCon 2014)
Mining Social Web APIs with IPython Notebook (PyCon 2014)Mining Social Web APIs with IPython Notebook (PyCon 2014)
Mining Social Web APIs with IPython Notebook (PyCon 2014)
Matthew Russell
 
Embedded Tweets, Timelines and Twitter Cards - Social Developers London 09 Ja...
Embedded Tweets, Timelines and Twitter Cards - Social Developers London 09 Ja...Embedded Tweets, Timelines and Twitter Cards - Social Developers London 09 Ja...
Embedded Tweets, Timelines and Twitter Cards - Social Developers London 09 Ja...
Angus Fox
 
Python a Pathway by Dr.M.Muruganandam
Python a Pathway by Dr.M.MuruganandamPython a Pathway by Dr.M.Muruganandam
Python a Pathway by Dr.M.Muruganandam
Dr M Muruganandam Masilamani
 
Build a Twitter Bot with Basic Python
Build a Twitter Bot with Basic PythonBuild a Twitter Bot with Basic Python
Build a Twitter Bot with Basic Python
Thinkful
 
From ZERO to REST in an hour
From ZERO to REST in an hour From ZERO to REST in an hour
From ZERO to REST in an hour
Cisco DevNet
 
API Documentation Workshop tcworld India 2015
API Documentation Workshop tcworld India 2015API Documentation Workshop tcworld India 2015
API Documentation Workshop tcworld India 2015
Tom Johnson
 
Collect twitter data using python
Collect twitter data using pythonCollect twitter data using python
Collect twitter data using python
Ke Jiang
 
ASFWS 2012 - Contourner les conditions d’utilisation et l’API du service Twit...
ASFWS 2012 - Contourner les conditions d’utilisation et l’API du service Twit...ASFWS 2012 - Contourner les conditions d’utilisation et l’API du service Twit...
ASFWS 2012 - Contourner les conditions d’utilisation et l’API du service Twit...
Cyber Security Alliance
 
Implementing security requirements for banking API system using Open Source ...
 Implementing security requirements for banking API system using Open Source ... Implementing security requirements for banking API system using Open Source ...
Implementing security requirements for banking API system using Open Source ...
Yuichi Nakamura
 
Collect twitter data using python
Collect twitter data using pythonCollect twitter data using python
Collect twitter data using python
Ke Jiang
 

Similar to R project(Analyze Twitter with R) (20)

Why "Hello World" is a Massive Operation - From Python code to Stack Virtual ...
Why "Hello World" is a Massive Operation - From Python code to Stack Virtual ...Why "Hello World" is a Massive Operation - From Python code to Stack Virtual ...
Why "Hello World" is a Massive Operation - From Python code to Stack Virtual ...
 
Twitter analysis by Kaify Rais
Twitter analysis by Kaify RaisTwitter analysis by Kaify Rais
Twitter analysis by Kaify Rais
 
Building TweetEngine
Building TweetEngineBuilding TweetEngine
Building TweetEngine
 
api_slides.pptx
api_slides.pptxapi_slides.pptx
api_slides.pptx
 
Curiosity Bits Tutorial: Mining Twitter User Profile on Python V2
Curiosity Bits Tutorial: Mining Twitter User Profile on Python V2Curiosity Bits Tutorial: Mining Twitter User Profile on Python V2
Curiosity Bits Tutorial: Mining Twitter User Profile on Python V2
 
OpenWhisk by Example - Auto Retweeting Example in Python
OpenWhisk by Example - Auto Retweeting Example in PythonOpenWhisk by Example - Auto Retweeting Example in Python
OpenWhisk by Example - Auto Retweeting Example in Python
 
Mining Social Web APIs with IPython Notebook (Data Day Texas 2015)
Mining Social Web APIs with IPython Notebook (Data Day Texas 2015)Mining Social Web APIs with IPython Notebook (Data Day Texas 2015)
Mining Social Web APIs with IPython Notebook (Data Day Texas 2015)
 
How to Get Twitter Data Using QGIS and Python
How to Get Twitter Data Using QGIS and PythonHow to Get Twitter Data Using QGIS and Python
How to Get Twitter Data Using QGIS and Python
 
Twet
TwetTwet
Twet
 
ASFWS 2013 Rump Session - Abusing Twitter API One year later… Nicolas Seriot
ASFWS 2013 Rump Session - Abusing Twitter API One year later… Nicolas SeriotASFWS 2013 Rump Session - Abusing Twitter API One year later… Nicolas Seriot
ASFWS 2013 Rump Session - Abusing Twitter API One year later… Nicolas Seriot
 
Mining Social Web APIs with IPython Notebook (PyCon 2014)
Mining Social Web APIs with IPython Notebook (PyCon 2014)Mining Social Web APIs with IPython Notebook (PyCon 2014)
Mining Social Web APIs with IPython Notebook (PyCon 2014)
 
Embedded Tweets, Timelines and Twitter Cards - Social Developers London 09 Ja...
Embedded Tweets, Timelines and Twitter Cards - Social Developers London 09 Ja...Embedded Tweets, Timelines and Twitter Cards - Social Developers London 09 Ja...
Embedded Tweets, Timelines and Twitter Cards - Social Developers London 09 Ja...
 
Python a Pathway by Dr.M.Muruganandam
Python a Pathway by Dr.M.MuruganandamPython a Pathway by Dr.M.Muruganandam
Python a Pathway by Dr.M.Muruganandam
 
Build a Twitter Bot with Basic Python
Build a Twitter Bot with Basic PythonBuild a Twitter Bot with Basic Python
Build a Twitter Bot with Basic Python
 
From ZERO to REST in an hour
From ZERO to REST in an hour From ZERO to REST in an hour
From ZERO to REST in an hour
 
API Documentation Workshop tcworld India 2015
API Documentation Workshop tcworld India 2015API Documentation Workshop tcworld India 2015
API Documentation Workshop tcworld India 2015
 
Collect twitter data using python
Collect twitter data using pythonCollect twitter data using python
Collect twitter data using python
 
ASFWS 2012 - Contourner les conditions d’utilisation et l’API du service Twit...
ASFWS 2012 - Contourner les conditions d’utilisation et l’API du service Twit...ASFWS 2012 - Contourner les conditions d’utilisation et l’API du service Twit...
ASFWS 2012 - Contourner les conditions d’utilisation et l’API du service Twit...
 
Implementing security requirements for banking API system using Open Source ...
 Implementing security requirements for banking API system using Open Source ... Implementing security requirements for banking API system using Open Source ...
Implementing security requirements for banking API system using Open Source ...
 
Collect twitter data using python
Collect twitter data using pythonCollect twitter data using python
Collect twitter data using python
 

Recently uploaded

Applications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdfApplications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdf
Atif Razi
 
ITSM Integration with MuleSoft.pptx
ITSM  Integration with MuleSoft.pptxITSM  Integration with MuleSoft.pptx
ITSM Integration with MuleSoft.pptx
VANDANAMOHANGOUDA
 
Sri Guru Hargobind Ji - Bandi Chor Guru.pdf
Sri Guru Hargobind Ji - Bandi Chor Guru.pdfSri Guru Hargobind Ji - Bandi Chor Guru.pdf
Sri Guru Hargobind Ji - Bandi Chor Guru.pdf
Balvir Singh
 
Call Girls Chennai +91-8824825030 Vip Call Girls Chennai
Call Girls Chennai +91-8824825030 Vip Call Girls ChennaiCall Girls Chennai +91-8824825030 Vip Call Girls Chennai
Call Girls Chennai +91-8824825030 Vip Call Girls Chennai
paraasingh12 #V08
 
This study Examines the Effectiveness of Talent Procurement through the Imple...
This study Examines the Effectiveness of Talent Procurement through the Imple...This study Examines the Effectiveness of Talent Procurement through the Imple...
This study Examines the Effectiveness of Talent Procurement through the Imple...
DharmaBanothu
 
Tools & Techniques for Commissioning and Maintaining PV Systems W-Animations ...
Tools & Techniques for Commissioning and Maintaining PV Systems W-Animations ...Tools & Techniques for Commissioning and Maintaining PV Systems W-Animations ...
Tools & Techniques for Commissioning and Maintaining PV Systems W-Animations ...
Transcat
 
Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...
Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...
Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...
PriyankaKilaniya
 
openshift technical overview - Flow of openshift containerisatoin
openshift technical overview - Flow of openshift containerisatoinopenshift technical overview - Flow of openshift containerisatoin
openshift technical overview - Flow of openshift containerisatoin
snaprevwdev
 
AN INTRODUCTION OF AI & SEARCHING TECHIQUES
AN INTRODUCTION OF AI & SEARCHING TECHIQUESAN INTRODUCTION OF AI & SEARCHING TECHIQUES
AN INTRODUCTION OF AI & SEARCHING TECHIQUES
drshikhapandey2022
 
Butterfly Valves Manufacturer (LBF Series).pdf
Butterfly Valves Manufacturer (LBF Series).pdfButterfly Valves Manufacturer (LBF Series).pdf
Butterfly Valves Manufacturer (LBF Series).pdf
Lubi Valves
 
309475979-Creativity-Innovation-notes-IV-Sem-2016-pdf.pdf
309475979-Creativity-Innovation-notes-IV-Sem-2016-pdf.pdf309475979-Creativity-Innovation-notes-IV-Sem-2016-pdf.pdf
309475979-Creativity-Innovation-notes-IV-Sem-2016-pdf.pdf
Sou Tibon
 
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
upoux
 
INTRODUCTION TO ARTIFICIAL INTELLIGENCE BASIC
INTRODUCTION TO ARTIFICIAL INTELLIGENCE BASICINTRODUCTION TO ARTIFICIAL INTELLIGENCE BASIC
INTRODUCTION TO ARTIFICIAL INTELLIGENCE BASIC
GOKULKANNANMMECLECTC
 
一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理
一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理
一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理
nedcocy
 
Impartiality as per ISO /IEC 17025:2017 Standard
Impartiality as per ISO /IEC 17025:2017 StandardImpartiality as per ISO /IEC 17025:2017 Standard
Impartiality as per ISO /IEC 17025:2017 Standard
MuhammadJazib15
 
FULL STACK PROGRAMMING - Both Front End and Back End
FULL STACK PROGRAMMING - Both Front End and Back EndFULL STACK PROGRAMMING - Both Front End and Back End
FULL STACK PROGRAMMING - Both Front End and Back End
PreethaV16
 
Asymmetrical Repulsion Magnet Motor Ratio 6-7.pdf
Asymmetrical Repulsion Magnet Motor Ratio 6-7.pdfAsymmetrical Repulsion Magnet Motor Ratio 6-7.pdf
Asymmetrical Repulsion Magnet Motor Ratio 6-7.pdf
felixwold
 
A high-Speed Communication System is based on the Design of a Bi-NoC Router, ...
A high-Speed Communication System is based on the Design of a Bi-NoC Router, ...A high-Speed Communication System is based on the Design of a Bi-NoC Router, ...
A high-Speed Communication System is based on the Design of a Bi-NoC Router, ...
DharmaBanothu
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
uqyfuc
 
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
upoux
 

Recently uploaded (20)

Applications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdfApplications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdf
 
ITSM Integration with MuleSoft.pptx
ITSM  Integration with MuleSoft.pptxITSM  Integration with MuleSoft.pptx
ITSM Integration with MuleSoft.pptx
 
Sri Guru Hargobind Ji - Bandi Chor Guru.pdf
Sri Guru Hargobind Ji - Bandi Chor Guru.pdfSri Guru Hargobind Ji - Bandi Chor Guru.pdf
Sri Guru Hargobind Ji - Bandi Chor Guru.pdf
 
Call Girls Chennai +91-8824825030 Vip Call Girls Chennai
Call Girls Chennai +91-8824825030 Vip Call Girls ChennaiCall Girls Chennai +91-8824825030 Vip Call Girls Chennai
Call Girls Chennai +91-8824825030 Vip Call Girls Chennai
 
This study Examines the Effectiveness of Talent Procurement through the Imple...
This study Examines the Effectiveness of Talent Procurement through the Imple...This study Examines the Effectiveness of Talent Procurement through the Imple...
This study Examines the Effectiveness of Talent Procurement through the Imple...
 
Tools & Techniques for Commissioning and Maintaining PV Systems W-Animations ...
Tools & Techniques for Commissioning and Maintaining PV Systems W-Animations ...Tools & Techniques for Commissioning and Maintaining PV Systems W-Animations ...
Tools & Techniques for Commissioning and Maintaining PV Systems W-Animations ...
 
Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...
Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...
Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...
 
openshift technical overview - Flow of openshift containerisatoin
openshift technical overview - Flow of openshift containerisatoinopenshift technical overview - Flow of openshift containerisatoin
openshift technical overview - Flow of openshift containerisatoin
 
AN INTRODUCTION OF AI & SEARCHING TECHIQUES
AN INTRODUCTION OF AI & SEARCHING TECHIQUESAN INTRODUCTION OF AI & SEARCHING TECHIQUES
AN INTRODUCTION OF AI & SEARCHING TECHIQUES
 
Butterfly Valves Manufacturer (LBF Series).pdf
Butterfly Valves Manufacturer (LBF Series).pdfButterfly Valves Manufacturer (LBF Series).pdf
Butterfly Valves Manufacturer (LBF Series).pdf
 
309475979-Creativity-Innovation-notes-IV-Sem-2016-pdf.pdf
309475979-Creativity-Innovation-notes-IV-Sem-2016-pdf.pdf309475979-Creativity-Innovation-notes-IV-Sem-2016-pdf.pdf
309475979-Creativity-Innovation-notes-IV-Sem-2016-pdf.pdf
 
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
 
INTRODUCTION TO ARTIFICIAL INTELLIGENCE BASIC
INTRODUCTION TO ARTIFICIAL INTELLIGENCE BASICINTRODUCTION TO ARTIFICIAL INTELLIGENCE BASIC
INTRODUCTION TO ARTIFICIAL INTELLIGENCE BASIC
 
一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理
一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理
一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理
 
Impartiality as per ISO /IEC 17025:2017 Standard
Impartiality as per ISO /IEC 17025:2017 StandardImpartiality as per ISO /IEC 17025:2017 Standard
Impartiality as per ISO /IEC 17025:2017 Standard
 
FULL STACK PROGRAMMING - Both Front End and Back End
FULL STACK PROGRAMMING - Both Front End and Back EndFULL STACK PROGRAMMING - Both Front End and Back End
FULL STACK PROGRAMMING - Both Front End and Back End
 
Asymmetrical Repulsion Magnet Motor Ratio 6-7.pdf
Asymmetrical Repulsion Magnet Motor Ratio 6-7.pdfAsymmetrical Repulsion Magnet Motor Ratio 6-7.pdf
Asymmetrical Repulsion Magnet Motor Ratio 6-7.pdf
 
A high-Speed Communication System is based on the Design of a Bi-NoC Router, ...
A high-Speed Communication System is based on the Design of a Bi-NoC Router, ...A high-Speed Communication System is based on the Design of a Bi-NoC Router, ...
A high-Speed Communication System is based on the Design of a Bi-NoC Router, ...
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
 
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
 

R project(Analyze Twitter with R)

  • 1.
  • 2. Requirements  Library: twitteR o Provides an interface to the Twitter web API.  R is an open source programming language and software environment for statistical computing and graphics  RStudio:RStudio is a free and open source integrated development environment (IDE) for R
  • 3. Steps 1. Signup in twitter 2. Go to apps.twitter.com and register Application Program Interface(API) using twitter account 3. Get API Key, API Secret, Access Token, Access Token Secret 1. API KEY:JfpQuWXgr9YVhi1TeYzGLagKy 2. API Secret: Ao8afu033PQMslxsLvKMdgVhIFRMiV9Ie2ppXg3oB eIvF0ZnZz 3. Access Token: 927320525285634049- dOhOiQFH708QVJeslJfqVnYgKxxe5mu 4. Access Token Secret: JYQKFhsMjlI8xid8ozVerRfHSq8KrpZFky5m9vFh3ox
  • 4. 4. Install Twitter Library 1. install. packages("twitteR") or 5. Set twitteR library 1. Load: library(twitteR) 2. setup_twitter_oauth(api_key,api_secret,access_toke n,access_token_secret)
  • 5. Demo1: Text Mining with WordCloud  install. Packages(“tm”) install. packages(“wordcloud”) library(“twitteR”) library(“tm”) library(“ROAuth”) library(“wordcloud”)
  • 6. >ref<-searchTwitter(“Himalayas”, n=100,lang=“en”) >ref_samp<-sapply(ref, function(x), x$getText()) ref_corpus(vectorsource(ref_samp))  inspect(ref_corpus)  ref_samp<-tm_map(ref_corpus, removepunctuation)  ref_samp<-tm_map(ref_samp, content_transformer(tolower))  ref_samp<-tm_map(ref_samp, removewords, stopwards((“english”))
  • 7.
  • 8. Demo2:Text Mining with R – an Analysis of Twitter Data  >unstructured data  >text categorization text clustering  entity extraction Text Mining process extract data from Twitter clean extracted data and build a document-term matrix find frequent words and associations create a word cloud to visualize important words text clustering
  • 9. Retrieve Tweets  searchTwitter("hello World", since='2017-11-01', until='2017-11-8')  jalandhar<- searchTwitter("thursday",geocode='31.326,75.5762,5 mi')  japan<- searchTwitter("thursday",geocode='35.6895,139.691 7,5mi')  a<-c(length(j),length(z))
  • 10.
  • 11.
  • 12. Demo 3: Getting Trends  Trends <- availableTrendLocations()  head(trend)  Trends  World<-getTrends()  length(intersect(World[[1]], l[[1]]))  mat=matrix(nrow = 2 ,ncol = 2) mat[[1,1]]=length(intersect(World[[1]], World[[1]])) mat[[1,2]]=length(intersect(World[[1]], l[[1]])) mat[[2,1]]=length(intersect(l[[1]], World[[1]])) mat[[2,2]]=length(intersect(l[[1]], l[[1]]))
  • 13.
  • 14.