Learn R Programming

WeatherSentiment (version 1.0)

sentiment_polarity: Analyze Sentiment Polarity of a Tweet

Description

This function takes a tweet text as input and performs sentiment analysis to visualize its overall sentiment polarity.

Usage

sentiment_polarity(tweet)

Value

A ggplot object displaying a bar chart with sentiment polarity (positive/negative) on the x-axis and sentiment score on the y-axis.

Arguments

tweet

A character vector containing the tweet text.

Author

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

Examples

Run this code
e <- c("The rain is ruining my outdoor plans today.", 
"I love the sunny weather today!")

s1 <- sentiment_polarity(e)
print(s1)

Run the code above in your browser using DataLab