Given two numeric columns in a dataframe following a sequence:
df = data.frame(year=c(2000,2000,2000,2001,2001,2001,2002,2002,2002,2003), peri