sentimentr icon indicating copy to clipboard operation
sentimentr copied to clipboard

plot.sentiment_by ordered fix?

Open edmundseto opened this issue 1 year ago • 0 comments

Great package! I appreciate your work on this.

When plotting a sentiment_by result, I noticed that it always orders groups by the median sentiment regardless of if I set the ordered parameter TRUE or FALSE.

I looked at the code for the plotting plot.sentiment_by on github and it doesn't seem like the ordered parameter is used.

I'm not sure, but I suggest this as potential fix in that function:

    if (ordered==TRUE) {
      x[, grouping.vars := factor(grouping.vars, levels = rev(grouping.vars))]
    } else {
      x[, grouping.vars := factor(grouping.vars)]
    }

Best, Edmund

edmundseto avatar Feb 12 '23 23:02 edmundseto