0

I'd like to convert the frequency of words to the percentage of words. This in my code:

text %>%
inner_join(get_sentiments("bing")) %>%
group_by(index = file, file, sentiment) %>%
summarize(n = n()) %>%
ggplot(aes(x = index, y = n, fill = file)) + 
geom_bar(stat = "identity", alpha = 0.8) + 
facet_wrap(~ sentiment, ncol = 5) `

I've tried adding scale_y_countinous, but I can't seem to make any meaningful graph.

Thanks!

Eray Balkanli
  • 7,752
  • 11
  • 48
  • 82
Andreja
  • 1
  • 1
  • 6
    Why don't you cut your question in half - stopping at `summarise()`. Post a short sample of that data in your question. – Stephen Henderson Mar 01 '18 at 09:01
  • Also do you need the percentages per file? so file 1 80% pos + 20% neg or percentages over the total words etc. etc. – phiver Mar 02 '18 at 11:59
  • Welcome to Stack Overflow! To help us help you, please post some example data, and ideally a fully reproducible example: https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example Unfortunately, with just the code you have here, we can't quite tell what it is you are trying to do. – Julia Silge Mar 03 '18 at 03:54

0 Answers0