Takes a dataframe which includes valence scores and compares the levels of a specified factor.

valence_compare(
  valence_df,
  compare_factor,
  ordered = TRUE
)

Arguments

valence_df

A dataframe with a valence score variable called 'ave_sentiment', e.g. output of ParseR::valence_overview().

compare_factor

The factor whose levels should be compared

ordered

Logical argument indicating whether to order plots by mean sentiment.

Value

A list containing a summary table, a bar chart, and a ridgeplot.

Examples

comparisons <- valence_compare(valence_df, message_type)
#> Joining, by = "message_type"

#Summary table
comparisons$summary
#> # A tibble: 2 × 4
#>   message_type     mean lower_ci upper_ci
#>   <fct>           <dbl>    <dbl>    <dbl>
#> 1 Twitter Update  0.169    0.162    0.176
#> 2 Twitter Mention 0.181    0.172    0.190

#Visualise distributions in Ridgeplots
comparisons$distributions
#> Picking joint bandwidth of 0.0336