gt_edges_from_text {graphTweets}R Documentation

Edges from text

Description

Get edges from data.frame of tweets.

Usage

gt_edges_from_text(data, id, source, tweets, ...)

gt_edges_from_text_(
  data,
  id = "status_id",
  source = "screen_name",
  tweets = "text",
  ...
)

Arguments

data

Data.frame of tweets, usually returned by the rtweet package.

id

tweets unique id.

source

Author of tweets.

tweets

Column containing tweets.

...

any other column name.

Details

The tl arguments stands for tolower and allows converting the #hashtags to lower case as these often duplicated, i.e.: #python #Python.

Value

An object of class graphTweets.

Functions

Examples

# simulate dataset
tweets <- data.frame(
  text = c("I tweet @you about @him and @her", 
           "I tweet @me about @you"),
  screen_name = c("me", "him"),
  retweet_count = c(19, 5),
  status_id = c(1, 2),
  hashtags = c("rstats", "Python"),
  stringsAsFactors = FALSE
)

tweets %>% 
  gt_edges_from_text(status_id, screen_name, text)
    

[Package graphTweets version 0.5.3 Index]