Summing accross individuals

Dear R community,

Having performed a sentiment analysis on some papers, I got this dataframe, with sentiment scores at the sentence unit. I would like to sum these sentences to get article scores (accross element_ids).
Thank you very much in advance.
Etienne

sentiment_scores
element_id sentence_id word_count sentiment
1: 1 1 4 -0.25000000
2: 1 2 9 0.00000000
3: 1 3 37 -0.12329924
4: 1 4 48 0.04330127
5: 1 5 21 0.44734667


731: 28 9 18 0.16499158
732: 28 10 8 0.00000000
733: 28 11 7 0.09449112
734: 28 12 3 0.00000000
735: 28 13 16 0.12500000

Hi!

To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

Specifically in your case take a look at group_by + summarize functions in dplyr.

Hi, thank you very much, I found by myself !
But next time I'll provide a reprex for sure.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.