I have created a simple barplot from sentiment analysis in R, I was studying high charter and was trying to create the same barplot in the high charter. The dataset is simple as below
anger anticipation disgust fear joy sadness surprise trust negative positive
1 0 2 0 0 2 0 1 2 0 3
2 0 0 0 0 1 0 0 1 0 1
3 0 0 0 0 0 0 0 0 0 1
4 0 2 0 0 2 0 1 2 0 2
5 0 0 0 0 1 0 0 0 0 2
6 0 3 0 0 2 0 1 2 0 2
7 0 0 0 0 0 0 0 0 0 0
barplot(colSums(s),
las = 3,
col = rainbow(10),
ylab = 'Count',
main = 'Sentiment Scores')
With the output below
Any suggestions how I might be able to make the same reactive graph in highcharter? Thanks
It might help if you create a simple summary data.frame including the sentiments and scores from your data.
df <- data.frame(sentiment = names(s), score = colSums(s))
Then you can reference this in hchart
to create your barplot.
library(highcharter)
hchart(df, 'column', hcaes(x = sentiment, y = score, color = rainbow(10)))