如何总结数据列的实际值,而不仅仅是行数?
我有一个冲突记录,其中每个条目/行显示冲突事件。每个事件还显示死亡人数。该数据集涵盖2017-2022年和10个不同地区。因此,每年和地区显示出不同的条目。我现在想生成一个新的数据框架,向我显示每个地区每年一个条目,在该地区,该年度在该地区的所有死亡中都添加了&显示(每个地区每年一行)。因此,基本上,每个区域都有6个条目(每年一个)。
我知道此命令组合以获取显示的条目的总和:
data_mali%>%
dplyr::group_by(admin1, year)%>%
dplyr::summarise(dplyr::n())
“
但是,我现在需要所总结的实际值。我该怎么做?
I have a conflict record where each entry/row shows a conflict event. Each event also shows the number of deaths. The dataset covers the years 2017-2022 and 10 different regions. Thus, there are different numbers of entries shown for each year and region. I now want to generate a new data frame that shows me one entry per year for each region, in which all deaths of that year in that precise region are added & shown (one row per year per region). Basically, as a result, each region has 6 entries (one for each year).
I know this command combination to get the sum of the entries displayed:
data_mali%>%
dplyr::group_by(admin1, year)%>%
dplyr::summarise(dplyr::n())
"
However, I now need the actual values of the entries summed. How do I do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论