SocialMediaLab is an R package that provides a suite of tools for collecting and constructing networks from social media data. It provides easy-to-use functions for collecting data across popular platforms (Facebook, Twitter, and YouTube) and generating different types of networks for analysis.
SocialMediaLab was created by Tim Graham (who is also the maintainer of the package) and Robert Ackland. A major contribution was also made by Chung-hong Chan from the Journalism and Media Studies Centre at the University of Hong Kong.
Note that due to Instagram API changes effective 1 June 2016, SocialMediaLab can no longer provide access to Instagram data.
The present page provides some R scripts to help get you started using SocialMediaLab and also information on associated training workshops and obtaining API access (Facebook, Twitter, YouTube). This page has the following sections:
- R helper scripts/tutorials
- Training workshops using SocialMediaLab
- Obtaining API access (Facebook, Twitter, YouTube)
The following are archived web pages for previous training workshops on network and text analysis involving the use of SocialMediaLab and other R packages. We are providing these workshop pages in the hope that they will be useful, but please note that we cannot provide assistance with the content of the workshops. Also note that the SocialMediaLab package has changed over time so it is best to look at the most recently-held workshops.
- ACSPRI Summer Program 2017 - Big Data Analysis for Social Scientists course (6-10 February 2017)
- 2016 ACSPRI Conference - Collecting and Analysing Social Media Data Using SocialMediaLab Workshop (19 July 2016)
- ACSPRI Winter Program 2016 - Big Data Analysis for Social Scientists course (4-8 July 2016)
- SocialMediaLab workshop at Northwestern University (10 May 2016)
- SocialMediaLab workshop at Northeastern University (26 April 2016)
- SocialMediaLab workshop at Indiana University (15 April 2016)
- SocialMediaLab workshop at Sunbelt 2016 (5 April 2016)
- ACSPRI Winter Program 2015 - Big Data Analysis for Social Scientists course (29 June - 3 July 2015)
- ANU College of Arts and Social Sciences Big Data Analysis in R Training (14-17 July 2015)
With SocialMediaLab, you can collect network and text data from Facebook, Twitter, YouTube and Facebook. However for these data sources you will require access to the respective application programming interfaces (APIs). This section provides some information on how to get these API credentials (note: the APIs associated web pages do change periodically, so the information below may not be up-to-date).
To access the Twitter API, you need to have a Twitter account. When logged into Twitter, then go to the Twitter Apps site, and press the "Create a new app" button. You need to fill in some information including the name of the app e.g. "BigDataCourse", description (whatever you want), website (again, you can put anything here). You do not need to supply the "Callback URL". After agreeing to terms and conditions and (if you haven't already done so) supplying a valid phone number in your Twitter profile, your app will be created. Go to the "Keys and Access Tokens" tab. The "API Key" and "API Secret" will need to be supplied to SocialMediaLab. You should also generate the Access Token and Token Secret - by supplying these to SocialMediaLab, you will avoid having to authenticate via a browser. For more on Twitter apps, see the Twitter Developers Site.
To access the YouTube API, you need to have a Google account. When logged into Google, then go to the Google APIs Console and create a project (if you already don't have one). Then go to the APIs&auth->APIs link on the LHS and on the API Library tab, select and enable YouTube Data API. This API should then appear in the Enabled APIs tab. Then go to APIs&auth->Credentials and generate a Public API access key. The API key then needs to be supplied to SocialMediaLab.
To access the Facebook API, you need to have a Facebook account and you also need a Facebook developer account. When logged into Facebook then go to the Facebook Developers Site and go to the "MyApps" page. There, click on the "Add a New App" button. You are then asked to select a platform to get started (iOS, Android, Facebook Canvas, WWW), and you select "Website". In the "Site URL" field enter "http://localhost:1410/" and save the changes (if you can't find this, it is located in the Settings for your newly created App). Then you get to a page where you are asked to supply a display name - e.g. "BigDataCourse" and choose a category (this is for commercial applications...you can select whatever) and then you press "create App ID". After getting through the CAPTCHA, you should see a page with your newly-created App. The App ID and the App Secret are what you need to supply to SocialMediaLab.
- Instagram [no longer available]
Note that due to Instagram API changes effective 1 June 2016, SocialMediaLab can no longer provide access to Instagram data. The following notes are provided as a record, and we hope to regain access to the Instagram API in the future.
To access the Instagram API, you need an Instagram account. Go to the Instagram Developers Page and click "Register Your Application". Choose some app name (e.g. "myInstagramApp"), write a small description, and a website (it doesn't have to be your own). You now have to enter an OAuth redirect URI. You need to enter "http://localhost:1410/". After you click register you will be taken to the Manage Clients page. If not, click this Manage Clients link in the top menu. Your app will have (among other things) a "client ID" and "client secret". This is what you will need to supply to SocialMediaLab.