Collecting Social Media Data and Generating Networks for Analysis

A suite of tools for collecting and constructing networks from social media data. Provides easy-to-use functions for collecting data across popular platforms (Twitter, YouTube and Reddit) and generating different types of networks for analysis.

Github Release Last Commit CRAN_Status_Badge Downloads

vosonSML 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 and generating different types of networks for analysis.

vosonSML is the SocialMediaLab package, renamed. We decided that SocialMediaLab was a bit too generic and also we wanted to indicate the connection to the Virtual Observatory for the Study of Online Networks Lab, where this package was conceived and created.

vosonSML was created by Timothy Graham and Robert Ackland, with major contributions by Chung-hong Chan and Bryan Gertzel.

Supported Social Media

vosonSML currently features the collection of data and generation of networks from twitter, youtube and reddit.

Unfortunately we are no longer able to maintain facebook and instagram collection, however these features will still be available in releases prior to version 0.25.0.


Install the current version from Github:

# requires the 'devtools' package (or alternatively 'remotes')
# optionally add the parameter 'dependencies = TRUE' to install package dependencies

Install vosonSML from CRAN:

install.packages("vosonSML", dependencies = TRUE)

Note about previous releases: The vosonSML package was previously in a subdirectory, so if you wish to install versions prior to 0.26 please remember to include the subdir parameter.

devtools::install_github("vosonlab/[email protected]", subdir = "vosonSML")

Getting started

The following usage examples will provide a great introduction to using vosonSML. There are also several "how to" guides, including an "Absolute Beginners Guide to vosonSML" tutorial aimed at people with little or no programming experience on the vosonSML page of the VOSON website.


The process of authentication, data collection and creating social network in vosonSML is expressed with the three verb functions: Authenticate, Collect and Create. The following are some examples:

# Twitter Example
# Authenticate with twitter, Collect 100 tweets for the '#auspol' hashtag and Create an actor and 
# semantic network
myKeys <- list(appName = "vosonSML", apiKey = "xxxxxxxxxxxx", apiSecret = "xxxxxxxxxxxx", 
               accessToken = "xxxxxxxxxxxx", accessTokenSecret = "xxxxxxxxxxxx")
twitterAuth <- Authenticate("twitter", appName = myKeys$appName, apiKey = myKeys$apiKey, 
                            apiSecret = myKeys$apiSecret, accessToken = myKeys$accessToken,
                            accessTokenSecret = myKeys$accessTokenSecret, useCachedToken = TRUE)
twitterData <- twitterAuth %>%
               Collect(searchTerm = "#auspol", searchType = "recent", numTweets = 100, 
                       includeRetweets = FALSE, retryOnRateLimit = TRUE, writeToFile = TRUE, 
                       verbose = TRUE)
actorNetwork <- twitterData %>% Create("actor", writeToFile = TRUE, verbose = TRUE)
actorGraph <- actorNetwork$graph # igraph network graph
# Optional step to add additional twitter user info to actor network graph as node attributes 
actorNetWithUserAttr <- AddUserData.twitter(twitterData, actorNetwork,
                                            lookupUsers = TRUE, 
                                            twitterAuth = twitterAuth, writeToFile = TRUE)
actorGraphWithUserAttr <- actorNetWithUserAttr$graph # igraph network graph
semanticNetwork <- twitterData %>% Create("semantic", writeToFile = TRUE)
# Youtube Example
# Authenticate with youtube, Collect comment data from videos and then Create an actor network
myYoutubeAPIKey = "xxxxxxxxxxxxxx"
myYoutubeVideoIds <- GetYoutubeVideoIDs(c("",
actorNetwork <- Authenticate("youtube", apiKey = myYoutubeAPIKey) %>%
                Collect(videoIDs = myYoutubeVideoIds) %>%
                Create("actor", writeToFile = TRUE)
# Reddit Example
## Collect reddit comment threads and Create an actor network with comment text as edge attribute
myThreadUrls <- c("")
actorNetwork <- Authenticate("reddit") %>%
                Collect(threadUrls = myThreadUrls, waitTime = 5) %>%
                Create("actor", includeTextData = TRUE, writeToFile = TRUE)

For more detailed information and examples, please refer to the function Reference page.

Special thanks

This package would not be possible without key packages by other authors in the R community, particularly: igraph, rtweet, RedditExtractoR, data.table, tm, magrittr, httr and dplyr.


vosonSML 0.26.3

Bug Fixes

  • Fixed bugs in that were incorrectly creating edges between top-level commentors and thread authors from different threads. These bugs were only observable in when collecting multiple reddit threads.

Minor Changes

  • Improved output for reddit collection. Removed the progress bar and added a table of results summarising the number of comments collected for each thread.
  • Added to twitter collection output the users twitter API reset time.

vosonSML 0.26.2

Bug Fixes

  • Fixed a bug in and Create.bimodal.twitter in which the vertices dataframe provided to the graph_from_data_frame function as a contained duplicate names raising an error.

Major Changes

  • Revised and updated roxygen documentation and examples for all package functions.
  • Updated all Authenticate, Collect and Create S3 methods to implement function routing based on object class names.

Minor Changes

  • Created a pkgdown web site for github hosted package documentation.
  • Created a new hex sticker logo.

vosonSML 0.25.0

Major Changes

  • Replaced the twitteR twitter collection implementation with the rtweet package.
  • A users twitter authentication token can now be cached in the .twitter_oauth_token file and used for subsequent twitter API requests without re-authentication. A new authentication token can be cached by deleting this file and using the re-using the parameter useCachedToken = TRUE.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.29.13 by Bryan Gertzel, a year ago

Report a bug at

Browse source code at

Authors: Timothy Graham , Robert Ackland , Chung-hong Chan , Bryan Gertzel

Documentation:   PDF Manual  

GPL (>= 3) license

Imports data.table, dplyr, Hmisc, httpuv, httr, igraph, jsonlite, lubridate, magrittr, methods, purrr, RCurl, rlang, rtweet, stats, stringr, textutils, tibble, utils

Suggests knitr, rmarkdown, stopwords, testthat, tictoc, tidyr, tidytext

Imported by VOSONDash.

See at CRAN