plot_group_sentiment: Quickly plot group sentiment distributions as a perentage

View source: R/plot_group_sentiment.R

plot_group_sentimentR Documentation

Quickly plot group sentiment distributions as a perentage

Description

Quickly plot group sentiment distributions as a perentage

Usage

plot_group_sentiment(
  df,
  group_var = topic,
  sentiment_var = sentiment,
  type = c("percent", "volume"),
  title = "Grouped Sentiment Chart",
  bar_labels = c("none", "percent", "volume")
)

Arguments

df

data frame

group_var

Grouping variable, e.g. country, topic, cluster

sentiment_var

Sentiment variable (categorical)

type

Whether the plot should be of volume or py percentage. Accepts "percent" or "volume"

title

The title of the plot, entered as a string.

bar_labels

Whether to add the raw volume, percentage or neither to the bars

Value

Ggplot stacked bar chart with x and y coords flipped

Examples

## Not run: 
# Example 1:
plot_group_sentiment(df, group_var = platform, sentiment_var = sentiment, type = "percent")

# Example 2:
plot_group_sentiment(df, group_var = topic, sentiment_var = sentiment, type = "volume")

## End(Not run)

jpcompartir/JPackage documentation built on March 20, 2023, 4 a.m.