sentiment_analys {WeatherSentiment}R Documentation

Sentiment Analysis of a Tweet

Description

This function analyzes the sentiment of a tweet and returns the sentiment score and the text of the tweet.

Usage

sentiment_analys(tweet)

Arguments

tweet

A character string containing the text of the tweet

Value

A data.frame containing two columns: text: The text of the tweet ave_sentiment: The sentiment score of the tweet In addition, it presents a plot to effectively visualize the spectrum of human emotions.

Author(s)

Leila Marvian Mashhad and Andriette Bekker and Mohammad Arashi and Priyanka Nagar.

Examples

#Example 1
tweet_text <- "I love R!"
sentiment_result <- sentiment_analys(tweet_text)
print(sentiment_result)

#Example2
tweets <- c("I hate R!", "R is a great language!", "R is difficult to learn!")
sentiment_results <- sapply(tweets, sentiment_analys)
print(sentiment_results)

[Package WeatherSentiment version 1.0 Index]