I have some real time twitter data and I am using these data to find the sentiment analysis. I write a code for sentiment analysis and got the accurate result, like these:
senti_value Sentiment_type
1 0.00 Neutral
2 -0.75 Negative
3 0.00 Neutral
4 -0.25 Negative
5 -3.25 Negative
6 -0.35 Negative
7 0.35 Positve
8 1.75 Positve
9 -2.40 Negative
But when i am trying to plot sentiment_type column data as a percentage in pie chart i got an error. Here is my code:
p <- plot_ly(data, labels = ~Sentiment_type, values = ~as.character(Sentiment_type), type = 'pie') %>%
layout(title = 'Sentiment Analysis',
xaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE),
yaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE))
How can I plot sentiment_type
column as a percentage in pie chart using plotly
package in R, please suggest me.