I\'ve been trying to do this with my data by looking at other posts, but I keep getting an error. My data new looks like this:
new
id year name
ave works here yet again, and will account for a circumstance with multiple rows for the maximum year.
ave
new[with(new, year == ave(year,id,FUN=max) ),] # id year name gdp #3 1 1982 Jamie 70 #6 2 1992 Kate 67 #9 3 1996 Joe 90