I'm trying to merge two datasets in R. I normally use dplyr to merge two country-year based data sets. But in this case:
dataset1 is country-year:

dataset2 is event-based: imagine something like big terror attacks. The events don't happen every year. In some years, there is more than one event.

Ideal outcome: integrate dataset2 into the country-year format and have a count for the total number of events that year. How would this work?
 
     
    