Edges from text
Get edges from data.frame of tweets.
gt_edges_from_text(data, id, source, tweets, ...) gt_edges_from_text_( data, id = "status_id", source = "screen_name", tweets = "text", ... )
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.An object of class graphTweets
.
The tl
arguments stands for tolower
and allows converting the #hashtags to lower case as these often duplicated, i.e.: #python #Python.
gt_edges
- Build networks of users.gt_co_edges
- Build networks of users to hashtags.# 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)