Create 'actor' networks from social media data
a data frame of class
This function creates a unimodal 'actor' network from social media data
(i.e. from data frames of class
dataSource, or for Twitter data it is
also possible to provide a *list* of data frames). In this actor network,
edges represent relationships between actors of the same type (e.g.
interactions between Twitter users). For example, with Twitter data an
interaction is defined as a 'mention' or 'reply' or 'retweet' from user i to
user j, given 'tweet' m. With YouTube comments, an interaction is defined as
a 'reply' or 'mention' from user i to user j, given 'comment' m.
This function creates a (weighted and directed) unimodal 'actor' network
from a data frame of class
dataSource (which are created using the
'CollectData' family of functions in the SocialMediaLab package), or a
*list* of Twitter data frames collected using
The resulting network is an igraph graph object. This graph object is unimodal because edges represent relationships between vertices of the same type (read: 'actors'), such as replies/retweets/mentions between Twitter users. Edges are directed and weighted (e.g. if user i has replied n times to user j, then the weight of this directed edge equals n).
An igraph graph object, with directed and weighted edges.
Not all data sources in SocialMediaLab can be used for creating actor networks.
Currently supported data sources are:
- YouTube - Twitter
Other data sources (e.g. Facebook) will be implemented in the future. The user is notified if they try to create actor networks for incompatible data sources.
For Twitter data, actor networks can be created from multiple data frames
(i.e. datasets collected individually using CollectDataTwitter). Simply
create a list of the data frames that you wish to create a network from. For
myList <- list(myTwitterData1, myTwitterData2,
Timothy Graham <firstname.lastname@example.org> & Robert Ackland <email@example.com>
collect data sources for creating actor networks in SocialMediaLab.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
## Not run: ## This example shows how to collect YouTube comments data and create an actor network # Use your own Google Developer API Key here: myApiKey <- "1234567890" # Authenticate with the Google API apiKeyYoutube <- AuthenticateWithYoutubeAPI(apiKeyYoutube=myApiKey) # Generate a vector of YouTube video IDs to collect data from # (or use the function `GetYoutubeVideoIDs` to automatically # generate from a plain text file of video URLs) videoIDs <- c("W2GZFeYGU3s","mL27TAJGlWc") # Collect the data using function `CollectDataYoutube` myYoutubeData <- CollectDataYoutube(videoIDs,apiKeyYoutube,writeToFile=FALSE) # Create an 'actor' network using the function `CreateActorNetwork` g_actor_youtube <- CreateActorNetwork(myYoutubeData) # Description of actor network g_actor_youtube ## End(Not run)