twtr_get_words: Extract and analyze words from tweets

Description Usage Arguments Value Examples

View source: R/twitter.R

Description

Get a word from a vector of tweets, together with summaries about the usage of this word; frequency, occurrences, percentages, and more

Usage

1
twtr_get_words(x, words, exact = TRUE)

Arguments

x

a vector of tweets

words

a character vector of one or more words

exact

logical, defaults to TRUE, do you want the words to be exactly matched as complete words or do you want anny occurence of this sequence of characters?

Value

a list of data frames about the word

  1. words: a matrix of occurences of the word, each row corresponding to a tweet.

  2. top_words a data frame of the most frequently used words, sorted

  3. word_count: a data.frame with one column, where each row shows the number of times the word was used in the corresponding tweet.

  4. word_freq: a data.frame showing the number of tweets where the word was used once, where the word was used twice, etc

  5. word_summary: a summary data.frame shwoing the number of tweets, total word count, unique words, and words per tweet

Examples

1
2
3
4
tweets <- c("this is my first #tweet with #two hashtags and one @mention",
"my second tweet has no hashtags and no mentions",
"my third #tweet #has #the most hashtags and @mentions @mention")
twtr_get_words(tweets, word = "hashtags", exact = TRUE)

eliasdabbas/radvertools documentation built on May 7, 2019, 1:30 p.m.