I am trying to find out the max no of attacks done by gname in each region_text in each year.
iyear region_text gname nkill
1970 asia xyz 1
1970 asia xyz 1
1970 asia abc 1
1970 africa bbb 1
1970 africa bbb 1
1971 asia nnn 2
1971 asia mmm 2
1971 asia nnn 2
1971 africa kkk 0
Solution needed
iyear region_text gname nkill nattacks(new column)
1970 asia xyz 2 2
1970 africa bbb 2 2
1971 asia nnn 2 2
1971 africa kkk 0 1
I have data for 45 years(1970-2015) divided into 12 regions(asia, africa...)
I have tried aggregate function but it could not tell me the no of attacks grouped by each year instead for all 45 years.
I am a newbie to R, need to know which direction I need to go.
Thanks!