SlideShare ist ein Scribd-Unternehmen logo
1 von 31
Set up R and API authorization
Download and install R:
https://cran.r-project.org/mirrors.html
Download and install RStudio:
https://www.rstudio.com/
1
Source: view/edit your R script
Console: show progress in data
processing and output
Environment: a list of things from
running R scripts
2
Set up R and API authorization
Use [COMMAND]+[ENTER] key on Mac, and
[CONTROL]+[ENTER] key on PC to run a R script one line
at a time.
To run multiple lines, just select them
3
Install R libraries
install.packages(”enter the name of a R library")
4
Load installed R libraries
library(”enter the name of a R library")
5
Set up Facebook API in R
Go to https://developers.facebook.com/docs/graph-api and log
in your Facebook.
6
Set up Facebook API in R
Go to Settings. You will need the App ID and App Secret in authentication
7
Set up Facebook API in R
8
Set up Facebook API in R
App ID App Secret
9
Download your first bath of Facebook data
You are all set to mine Facebook data!
By executing the above code, we ask R to download 100 posts sent between
07/05/2016 and 09/11/2016 by the Facebook page UMassAmherst. We set
reactions to TRUE so that R will get the total count of Facebook reactions: love,
haha, wow, sad, angry. The output is named Umass_post.
10
The code creates a data frame named UMass_post. A
data frame is a spreadsheet-list R object.
Download your first bath of Facebook data
11
Download your first bath of Facebook data
12
Download your first bath of Facebook data
Run the following code and see what you get.
13
Download your first bath of Facebook data
Save the data as a CSV file.
14
Download your first bath of Facebook data
The CSV file is saved in the current working directory. Use getwd() to find the
file path pointing to the directory
15
Set up Twitter API in R
Go to https://apps.twitter.com/
16
Set up Twitter API in R
17
Set up Twitter API in R
18
API Key
API Secret
Download your first bath of tweets
19
Download your first bath of tweets
20
Download your first bath of tweets
21
• What is the keyword used in the search?
• How many tweets are we asking R to retrieve from Twitter API?
• If we want to retrieve only English tweets, how should we change the code?
• If we want to retrieve tweets sent between 9/1/2016 and 9/11/2016, how would you tweak
the code?
Download your first bath of tweets
22
• Use ncol() to find out how many columns does hashtagtweets.df have.
• Use nrow() to find out how many rows does hashtagtweets.df have.
• Use colnames() to find a list of column names in hashtagtweets.df.
Download your first bath of tweets
23
Can you save the Twitter data as CSV?
Set up YouTube API
24
Go to Google API Console: https://console.developers.google.com
Set up YouTube API
25
Enable ALL YouTube APIs
Set up YouTube API
26
Set up YouTube API
27
Set up YouTube API
28
Set up YouTube API
29
Set up YouTube API
30
Set up YouTube API
31

Weitere ähnliche Inhalte

Was ist angesagt?

Openpicus Flyport interfaces the cloud services
Openpicus Flyport interfaces the cloud servicesOpenpicus Flyport interfaces the cloud services
Openpicus Flyport interfaces the cloud servicesIonela
 
Android Presentation
Android Presentation Android Presentation
Android Presentation Nik Sharma
 
Installing Python on Windows OS
Installing Python on Windows OSInstalling Python on Windows OS
Installing Python on Windows OSWei-Wen Hsu
 
Dangerous Google searching for secrets
Dangerous Google searching for secretsDangerous Google searching for secrets
Dangerous Google searching for secretsPim Piepers
 
How to Integrate Internet of Things with Webserver with
How to Integrate Internet of Things with Webserver with How to Integrate Internet of Things with Webserver with
How to Integrate Internet of Things with Webserver with Ionela
 
Corporate Secret Challenge - CyberDefenders.org by Azad
Corporate Secret Challenge - CyberDefenders.org by AzadCorporate Secret Challenge - CyberDefenders.org by Azad
Corporate Secret Challenge - CyberDefenders.org by AzadAzad Mzuri
 
Introduction to Web Scraping with Python
Introduction to Web Scraping with PythonIntroduction to Web Scraping with Python
Introduction to Web Scraping with PythonOlga Scrivner
 
Cis336 week 7 i lab 7
Cis336 week 7 i lab 7Cis336 week 7 i lab 7
Cis336 week 7 i lab 7CIS339
 
Rozalia alik task2 math3 (new)
Rozalia alik task2 math3 (new)Rozalia alik task2 math3 (new)
Rozalia alik task2 math3 (new)Rozalia Alik
 

Was ist angesagt? (12)

Openpicus Flyport interfaces the cloud services
Openpicus Flyport interfaces the cloud servicesOpenpicus Flyport interfaces the cloud services
Openpicus Flyport interfaces the cloud services
 
Android Presentation
Android Presentation Android Presentation
Android Presentation
 
R project(Analyze Twitter with R)
R project(Analyze Twitter with R)R project(Analyze Twitter with R)
R project(Analyze Twitter with R)
 
Installing Python on Windows OS
Installing Python on Windows OSInstalling Python on Windows OS
Installing Python on Windows OS
 
Dangerous Google searching for secrets
Dangerous Google searching for secretsDangerous Google searching for secrets
Dangerous Google searching for secrets
 
How to Integrate Internet of Things with Webserver with
How to Integrate Internet of Things with Webserver with How to Integrate Internet of Things with Webserver with
How to Integrate Internet of Things with Webserver with
 
Corporate Secret Challenge - CyberDefenders.org by Azad
Corporate Secret Challenge - CyberDefenders.org by AzadCorporate Secret Challenge - CyberDefenders.org by Azad
Corporate Secret Challenge - CyberDefenders.org by Azad
 
Ppm design
Ppm designPpm design
Ppm design
 
Introduction to Web Scraping with Python
Introduction to Web Scraping with PythonIntroduction to Web Scraping with Python
Introduction to Web Scraping with Python
 
manual
manualmanual
manual
 
Cis336 week 7 i lab 7
Cis336 week 7 i lab 7Cis336 week 7 i lab 7
Cis336 week 7 i lab 7
 
Rozalia alik task2 math3 (new)
Rozalia alik task2 math3 (new)Rozalia alik task2 math3 (new)
Rozalia alik task2 math3 (new)
 

Ähnlich wie R Class: Set up Social Media API

Application Programming Interfaces
Application Programming InterfacesApplication Programming Interfaces
Application Programming InterfacesCindy Royal
 
Creating a mule project with raml and api
Creating a mule project with raml and apiCreating a mule project with raml and api
Creating a mule project with raml and apiBhargav Ranjit
 
Twitter API 2.0
Twitter API 2.0Twitter API 2.0
Twitter API 2.0Alex Payne
 
Using ap is to gather data
Using ap is to gather data Using ap is to gather data
Using ap is to gather data Ke Jiang
 
The 7 Deadly Sins of API Design
The 7 Deadly Sins of API DesignThe 7 Deadly Sins of API Design
The 7 Deadly Sins of API Designluisw19
 
Developing Mash up applications with Adobe AIR
Developing Mash up applications with Adobe AIRDeveloping Mash up applications with Adobe AIR
Developing Mash up applications with Adobe AIRmarcocasario
 
Building Beautiful REST APIs with ASP.NET Core
Building Beautiful REST APIs with ASP.NET CoreBuilding Beautiful REST APIs with ASP.NET Core
Building Beautiful REST APIs with ASP.NET CoreStormpath
 
WordCamp Birmingham 2016 - WP API, What is it good for? Absolutely Everything!
WordCamp Birmingham 2016 - WP API, What is it good for? Absolutely Everything!WordCamp Birmingham 2016 - WP API, What is it good for? Absolutely Everything!
WordCamp Birmingham 2016 - WP API, What is it good for? Absolutely Everything!Evan Mullins
 
Getting to Grips with RESTful APIs
Getting to Grips with RESTful APIsGetting to Grips with RESTful APIs
Getting to Grips with RESTful APIsPetko Mikhailov
 
C programming Training Institute in Ambala ! Batra Computer Centre
C programming Training Institute in Ambala ! Batra Computer CentreC programming Training Institute in Ambala ! Batra Computer Centre
C programming Training Institute in Ambala ! Batra Computer Centrejatin batra
 
#CNX14 - Dive Deep into the ExactTarget Fuel APIs
#CNX14 - Dive Deep into the ExactTarget Fuel APIs#CNX14 - Dive Deep into the ExactTarget Fuel APIs
#CNX14 - Dive Deep into the ExactTarget Fuel APIsSalesforce Marketing Cloud
 
MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...
MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...
MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...MongoDB
 
Facebook 3rd Party Api
Facebook 3rd Party ApiFacebook 3rd Party Api
Facebook 3rd Party ApiYoss Cohen
 
Devry cis-170-c-i lab-5-of-7-arrays-and-strings
Devry cis-170-c-i lab-5-of-7-arrays-and-stringsDevry cis-170-c-i lab-5-of-7-arrays-and-strings
Devry cis-170-c-i lab-5-of-7-arrays-and-stringsnoahjamessss
 
Devry cis-170-c-i lab-5-of-7-arrays-and-strings
Devry cis-170-c-i lab-5-of-7-arrays-and-stringsDevry cis-170-c-i lab-5-of-7-arrays-and-strings
Devry cis-170-c-i lab-5-of-7-arrays-and-stringscskvsmi44
 
Rapid miner r extension 5
Rapid miner r extension 5Rapid miner r extension 5
Rapid miner r extension 5raz3366
 
Architecting the Future: Abstractions and Metadata - BSidesKC
Architecting the Future: Abstractions and Metadata - BSidesKCArchitecting the Future: Abstractions and Metadata - BSidesKC
Architecting the Future: Abstractions and Metadata - BSidesKCDaniel Barker
 

Ähnlich wie R Class: Set up Social Media API (20)

Application Programming Interfaces
Application Programming InterfacesApplication Programming Interfaces
Application Programming Interfaces
 
Creating a mule project with raml and api
Creating a mule project with raml and apiCreating a mule project with raml and api
Creating a mule project with raml and api
 
Twitter API 2.0
Twitter API 2.0Twitter API 2.0
Twitter API 2.0
 
Using ap is to gather data
Using ap is to gather data Using ap is to gather data
Using ap is to gather data
 
The 7 Deadly Sins of API Design
The 7 Deadly Sins of API DesignThe 7 Deadly Sins of API Design
The 7 Deadly Sins of API Design
 
R ext world/ useR! Kiev
R ext world/ useR!  KievR ext world/ useR!  Kiev
R ext world/ useR! Kiev
 
Developing Mash up applications with Adobe AIR
Developing Mash up applications with Adobe AIRDeveloping Mash up applications with Adobe AIR
Developing Mash up applications with Adobe AIR
 
Building Beautiful REST APIs with ASP.NET Core
Building Beautiful REST APIs with ASP.NET CoreBuilding Beautiful REST APIs with ASP.NET Core
Building Beautiful REST APIs with ASP.NET Core
 
WordCamp Birmingham 2016 - WP API, What is it good for? Absolutely Everything!
WordCamp Birmingham 2016 - WP API, What is it good for? Absolutely Everything!WordCamp Birmingham 2016 - WP API, What is it good for? Absolutely Everything!
WordCamp Birmingham 2016 - WP API, What is it good for? Absolutely Everything!
 
Getting to Grips with RESTful APIs
Getting to Grips with RESTful APIsGetting to Grips with RESTful APIs
Getting to Grips with RESTful APIs
 
C programming Training Institute in Ambala ! Batra Computer Centre
C programming Training Institute in Ambala ! Batra Computer CentreC programming Training Institute in Ambala ! Batra Computer Centre
C programming Training Institute in Ambala ! Batra Computer Centre
 
#CNX14 - Dive Deep into the ExactTarget Fuel APIs
#CNX14 - Dive Deep into the ExactTarget Fuel APIs#CNX14 - Dive Deep into the ExactTarget Fuel APIs
#CNX14 - Dive Deep into the ExactTarget Fuel APIs
 
MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...
MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...
MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...
 
Facebook 3rd Party Api
Facebook 3rd Party ApiFacebook 3rd Party Api
Facebook 3rd Party Api
 
Bapi jco
Bapi jcoBapi jco
Bapi jco
 
Devry cis-170-c-i lab-5-of-7-arrays-and-strings
Devry cis-170-c-i lab-5-of-7-arrays-and-stringsDevry cis-170-c-i lab-5-of-7-arrays-and-strings
Devry cis-170-c-i lab-5-of-7-arrays-and-strings
 
Devry cis-170-c-i lab-5-of-7-arrays-and-strings
Devry cis-170-c-i lab-5-of-7-arrays-and-stringsDevry cis-170-c-i lab-5-of-7-arrays-and-strings
Devry cis-170-c-i lab-5-of-7-arrays-and-strings
 
Rcpp
RcppRcpp
Rcpp
 
Rapid miner r extension 5
Rapid miner r extension 5Rapid miner r extension 5
Rapid miner r extension 5
 
Architecting the Future: Abstractions and Metadata - BSidesKC
Architecting the Future: Abstractions and Metadata - BSidesKCArchitecting the Future: Abstractions and Metadata - BSidesKC
Architecting the Future: Abstractions and Metadata - BSidesKC
 

Mehr von Weiai Wayne Xu

Big data, small data and everything in between
Big data, small data and everything in betweenBig data, small data and everything in between
Big data, small data and everything in betweenWeiai Wayne Xu
 
Say search and sales e-cigar and big data
Say search and sales   e-cigar and big data Say search and sales   e-cigar and big data
Say search and sales e-cigar and big data Weiai Wayne Xu
 
Predicting Social Capital in Nonprofits’ Stakeholder Engagement on Social Media
Predicting Social Capital in Nonprofits’ Stakeholder Engagement on Social MediaPredicting Social Capital in Nonprofits’ Stakeholder Engagement on Social Media
Predicting Social Capital in Nonprofits’ Stakeholder Engagement on Social MediaWeiai Wayne Xu
 
The Networked Creativity in the Censored Web 2.0
The Networked Creativity in the Censored Web 2.0The Networked Creativity in the Censored Web 2.0
The Networked Creativity in the Censored Web 2.0Weiai Wayne Xu
 
The Networked Cultural Diffusion of Kpop on YouTube
The Networked Cultural Diffusion of Kpop on YouTubeThe Networked Cultural Diffusion of Kpop on YouTube
The Networked Cultural Diffusion of Kpop on YouTubeWeiai Wayne Xu
 
Network Structures For A Better Twitter Community
Network Structures For A Better Twitter CommunityNetwork Structures For A Better Twitter Community
Network Structures For A Better Twitter CommunityWeiai Wayne Xu
 
How Do We Fight Email Phishing? (ICA2015 - San Juan, PR)
How Do We Fight Email Phishing? (ICA2015 - San Juan, PR) How Do We Fight Email Phishing? (ICA2015 - San Juan, PR)
How Do We Fight Email Phishing? (ICA2015 - San Juan, PR) Weiai Wayne Xu
 
What makes an image worth a thousand words NCA2014
What makes an image worth a thousand words   NCA2014What makes an image worth a thousand words   NCA2014
What makes an image worth a thousand words NCA2014Weiai Wayne Xu
 
Predicting opinion leadership on twitter
Predicting opinion leadership on twitter   Predicting opinion leadership on twitter
Predicting opinion leadership on twitter Weiai Wayne Xu
 

Mehr von Weiai Wayne Xu (10)

Big data, small data and everything in between
Big data, small data and everything in betweenBig data, small data and everything in between
Big data, small data and everything in between
 
Say search and sales e-cigar and big data
Say search and sales   e-cigar and big data Say search and sales   e-cigar and big data
Say search and sales e-cigar and big data
 
Predicting Social Capital in Nonprofits’ Stakeholder Engagement on Social Media
Predicting Social Capital in Nonprofits’ Stakeholder Engagement on Social MediaPredicting Social Capital in Nonprofits’ Stakeholder Engagement on Social Media
Predicting Social Capital in Nonprofits’ Stakeholder Engagement on Social Media
 
Xu talk 3-17-2015
Xu talk 3-17-2015Xu talk 3-17-2015
Xu talk 3-17-2015
 
The Networked Creativity in the Censored Web 2.0
The Networked Creativity in the Censored Web 2.0The Networked Creativity in the Censored Web 2.0
The Networked Creativity in the Censored Web 2.0
 
The Networked Cultural Diffusion of Kpop on YouTube
The Networked Cultural Diffusion of Kpop on YouTubeThe Networked Cultural Diffusion of Kpop on YouTube
The Networked Cultural Diffusion of Kpop on YouTube
 
Network Structures For A Better Twitter Community
Network Structures For A Better Twitter CommunityNetwork Structures For A Better Twitter Community
Network Structures For A Better Twitter Community
 
How Do We Fight Email Phishing? (ICA2015 - San Juan, PR)
How Do We Fight Email Phishing? (ICA2015 - San Juan, PR) How Do We Fight Email Phishing? (ICA2015 - San Juan, PR)
How Do We Fight Email Phishing? (ICA2015 - San Juan, PR)
 
What makes an image worth a thousand words NCA2014
What makes an image worth a thousand words   NCA2014What makes an image worth a thousand words   NCA2014
What makes an image worth a thousand words NCA2014
 
Predicting opinion leadership on twitter
Predicting opinion leadership on twitter   Predicting opinion leadership on twitter
Predicting opinion leadership on twitter
 

Kürzlich hochgeladen

“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 

Kürzlich hochgeladen (20)

“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 

R Class: Set up Social Media API

  • 1. Set up R and API authorization Download and install R: https://cran.r-project.org/mirrors.html Download and install RStudio: https://www.rstudio.com/ 1
  • 2. Source: view/edit your R script Console: show progress in data processing and output Environment: a list of things from running R scripts 2
  • 3. Set up R and API authorization Use [COMMAND]+[ENTER] key on Mac, and [CONTROL]+[ENTER] key on PC to run a R script one line at a time. To run multiple lines, just select them 3
  • 4. Install R libraries install.packages(”enter the name of a R library") 4
  • 5. Load installed R libraries library(”enter the name of a R library") 5
  • 6. Set up Facebook API in R Go to https://developers.facebook.com/docs/graph-api and log in your Facebook. 6
  • 7. Set up Facebook API in R Go to Settings. You will need the App ID and App Secret in authentication 7
  • 8. Set up Facebook API in R 8
  • 9. Set up Facebook API in R App ID App Secret 9
  • 10. Download your first bath of Facebook data You are all set to mine Facebook data! By executing the above code, we ask R to download 100 posts sent between 07/05/2016 and 09/11/2016 by the Facebook page UMassAmherst. We set reactions to TRUE so that R will get the total count of Facebook reactions: love, haha, wow, sad, angry. The output is named Umass_post. 10
  • 11. The code creates a data frame named UMass_post. A data frame is a spreadsheet-list R object. Download your first bath of Facebook data 11
  • 12. Download your first bath of Facebook data 12
  • 13. Download your first bath of Facebook data Run the following code and see what you get. 13
  • 14. Download your first bath of Facebook data Save the data as a CSV file. 14
  • 15. Download your first bath of Facebook data The CSV file is saved in the current working directory. Use getwd() to find the file path pointing to the directory 15
  • 16. Set up Twitter API in R Go to https://apps.twitter.com/ 16
  • 17. Set up Twitter API in R 17
  • 18. Set up Twitter API in R 18 API Key API Secret
  • 19. Download your first bath of tweets 19
  • 20. Download your first bath of tweets 20
  • 21. Download your first bath of tweets 21 • What is the keyword used in the search? • How many tweets are we asking R to retrieve from Twitter API? • If we want to retrieve only English tweets, how should we change the code? • If we want to retrieve tweets sent between 9/1/2016 and 9/11/2016, how would you tweak the code?
  • 22. Download your first bath of tweets 22 • Use ncol() to find out how many columns does hashtagtweets.df have. • Use nrow() to find out how many rows does hashtagtweets.df have. • Use colnames() to find a list of column names in hashtagtweets.df.
  • 23. Download your first bath of tweets 23 Can you save the Twitter data as CSV?
  • 24. Set up YouTube API 24 Go to Google API Console: https://console.developers.google.com
  • 25. Set up YouTube API 25 Enable ALL YouTube APIs
  • 26. Set up YouTube API 26
  • 27. Set up YouTube API 27
  • 28. Set up YouTube API 28
  • 29. Set up YouTube API 29
  • 30. Set up YouTube API 30
  • 31. Set up YouTube API 31