TweetAnalysis: R6 class of tweet analyzing process

Description Details Public fields Methods

Description

R6 class of tweet analyzing process

R6 class of tweet analyzing process

Details

R6 object to encapsulate the reading/cleaning/export of tweets

Public fields

data

Pulled tweets in tibble. This is subject to change, every time a set of tweets are pulled.

lexicons

A list of tibbles containing lexicons. It is NULL by default, but is given the list at initialization

adjust_negation

If "yes", do adjust bi-gram adjustment.

negation_words

Negation words used for bi-gram adjustments.

stop_words

A tibble of stop words that are irrelevant from analysis. Dataset from tidytext is passed, during initialize.

analysis_result

A list of two tibbles and a ggplot plot, that contain the result of text analysis, performed by self$analyze()

Methods

Public methods


Method add_negation_word()

Add word to negation_words (lower case). Throw a warning if the word already exists.

Usage
TweetAnalysis$add_negation_word(word)
Arguments
word

Negation word


Method remove_negation_word()

Remove word from negation_words (lower case). Throw a warning if the word doesn't exists.

Usage
TweetAnalysis$remove_negation_word(word)
Arguments
word

Negation word


Method add_stop_word()

Add word from stop_words (lower case). Throw a warning if the word already exists.

Usage
TweetAnalysis$add_stop_word(word)
Arguments
word

Stop word


Method remove_stop_word()

Remove word from stop_words (lower case). Throw a warning if the word doesn't exists.

Usage
TweetAnalysis$remove_stop_word(word)
Arguments
word

Stop word


Method analyze()

Conduct sentiment analysis. It calls conduct_analysis using arguments:

Which returns a list of tibbles. This list is fed to produce_analysis_output to produce final outputs, and are saved into self$analysis_result

Usage
TweetAnalysis$analyze()

Method print_analysis()

Prints out key information about the analysis, as a vector of characters including html br tag.

Usage
TweetAnalysis$print_analysis()

Method new()

Generate a new class. It requires the stop_words internal data.

Usage
TweetAnalysis$new(stop_words)
Arguments
stop_words

stop_words internal data.


Method clone()

The objects of this class are cloneable with this method.

Usage
TweetAnalysis$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


jiwanheo/senTWEETment documentation built on Jan. 20, 2022, 3:20 a.m.