Learn R Programming

vosonSML (version 0.26.3)

Create.actor.reddit: Create reddit actor network

Description

Creates a reddit actor network from thread comments on subreddits. Users who have commented on a thread are actor nodes and comment replies to each other are represented as directed edges. Optionally a graph with edge weights (weight) or edge text attributes (vosonTxt_comment) can be created.

Usage

# S3 method for actor.reddit
Create(datasource, type, weightEdges = FALSE,
  textData = FALSE, cleanText = TRUE, writeToFile = FALSE, ...)

Arguments

datasource

Collected social media data with "datasource" and "reddit" class names.

type

Character string. Type of network to be created, set to "actor".

weightEdges

Logical. Combine and weight directed network edges. Default is FALSE.

textData

Logical. Include comment text as an edge attributes of returned igraph network. Is set to FALSE if the weightEdges parameter is TRUE as text merging is not supported. Default is FALSE.

cleanText

Logical. Simple removal of non-alphanumeric, non-punctuation, and non-space characters from the comment text data applied as graph edge attribute. Not suitable in some cases requiring capture of utf or emoji characters. Implemented to support basic text analysis and to prevent reddit specific XML control character errors in the graphml files created by this function. Alternatively custom cleaning of text data can be performed on the datasource dataframe before being passed to this function. Default is TRUE.

writeToFile

Logical. Save network data to a file in the current working directory. Default is FALSE.

...

Additional parameters passed to function. Not used in this method.

Value

Named list containing generated network as igraph object $graph.

Examples

Run this code
# NOT RUN {
# create a reddit actor network graph with comment text as edge attributes
actorNetwork <- redditData %>% 
  Create("actor", includeTextData = TRUE, writeToFile = TRUE)

# igraph object
# actorNetwork$graph
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab