I have a dataset (test_data
) on civil conflicts between 1989-2016. The unit of analysis is _DyadID_
, which is the unique identifier for each pair of actors involved in civil conflict in this time period. The dataset also includes _SideA_
and _SideB_
which are the names of the actors in a specific dyad. Each row is an "event" of armed violence, in which there is a variable for the number of side A deaths (_deaths-a_
) and number of Side B deaths (_deaths-b_
). Lastly, there is a variable indicating the month-year of each event.
For my research, I need to know the number of _deaths-a_
and number of _deaths-b_
per month. Basically, I want to end up with a dataset that shows me monthly data on death counts for each _DyadID_
. I have managed to show total number of A/B deaths per month across all conflicts using the following code:
monthly_deaths_a <- aggregate(deaths_a ~ year_month, test_data, sum)
monthly_deaths_b <- aggregate(deaths_b ~ year_month, test_data, sum)
but don't know how to get this data disaggregated for each dyad.
If anyone could suggest a way of doing this I would be most grateful! Cheers