Very rudimentary tidyverse solution using the slice_ functions in conjunction with groups. The example data above was saved to a data.frame called 'df' in my code below.
The max_year column is just a helper column to make the logic a little clearer; get the max year for each key so that you can get the previous year as max_year - 1, then use a filter to only keep rows showing the previous year for that key.
Assuming your actual data is sorted in a meaningful order (newest dates at the top, oldest at bottom), then slice_head will return the most recent row from the prev year and the at along with it.
df %>%
group_by(GVKEYNEW) %>%
mutate(max_year = max(YEARNEW)) %>%
filter(YEARNEW == max_year-1) %>%
slice_head(n=1)