SocialMediaLab CRAN_Status_Badge Downloads Downloads Rdoc

Please note that the SocialMediaLab package has been renamed vosonSML. The SocialMediaLab package is no longer in active development. Please see vosonSML on CRAN, and vosonSML on github.

What does this package do?

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 (Instagram, Facebook, Twitter, and YouTube) and generating different types of networks for analysis.

SocialMediaLab was created by Timothy Graham (who is also the maintainer of the package) and Robert Ackland.

Contributors:

The latest 'official' version of the package can also be found on CRAN.

Current known issues

If you are getting the error Error in check_twitter_oauth( ), please find a solution here.

If you are having trouble getting data from Facebook, it is probably due to a known issue with authentication for the Rfacebook package, which has a solution.

Instagram API access is severely limited if you do not have an authorised app, which is significantly harder to obtain nowadays.

Special thanks

This package would not be possible without key packages by other authors in the R community, particularly: igraph, Rfacebook, instaR, twitteR, data.table, tm, and httr.

Getting started

For detailed information and examples, please refer to the SocialMediaLab documentation.

The SocialMediaLab page on the VOSON website also has several "how to" guides, including an "Absolute Beginners Guide to SocialMediaLab" tutorial aimed at people with little or no programming experience.

Using Magrittr's pipe interface

The process of authentication, data collection and creating social network can be expressed with the 3 verb functions: Authenticate, Collect and Create. The following are some of the examples from the package documentation expressed with the pipe interface.

require(magrittr)
# Authenticate with youtube, Collect data from youtube and Create an actor network
Authenticate("youtube", apiKey= apiKey) %>% Collect(videoIDs = videoIDs) %>% Create("Actor")

# Authenticate with facebook, archive the API credential, Collect data about Starwars Page and Create a bimodal network
# You can use facebook, FaCebooK or Facebook in the datasource field
Authenticate("Facebook", appID = appID, appSecret = appSecret) %>% SaveCredential("FBCredential.RDS") %>% Collect(pageName="StarWars", rangeFrom="2015-05-01",rangeTo="2015-06-03") %>% Create("Bimodal")

# Authenticate with Twitter, Collect data about #auspol and Create a semantic network
Authenticate("twitter", apiKey=myapikey, apiSecret=myapisecret,accessToken=myaccesstoken, accessTokenSecret=myaccesstokensecret) %>% Collect(searchTerm="#auspol", numTweets=150) %>% Create("Semantic")

# Create Instagram Ego Network
myUsernames <- 
Authenticate("instagram", appID = myAppId, appSecret = myAppSecret) %>% Collect(ego = TRUE, username = c("adam_kinzinger","senatorreid")) %>% Create

Example networks

The following networks were created in SocialMediaLab and visualised using the Gephi software.

Facebook bimodal network (Star Wars page)

This network visualises two weeks of activity on the Star Wars Facebook page. Nodes (vertices) represent either users or posts, and node ties (edges) represent either 'likes' or comments. Nodes are sized by out-degree and coloured by modularity cluster.

Facebook bimodal network created with SocialMediaLab

Instagram ego network

This network visualises the social network of one user (the 'ego' node) on Instagram. The degree of the network is "2", meaning that it shows ego + alters ("followers of ego") and ego + alters + alters of alters of ego "followers of followers of ego". 'Follows' data are also collected, so this network also shows "users who ego follows" and "users who followers of ego follow".

Facebook bimodal network created with SocialMediaLab