I have a set of panel data, df1, that take the following form:
df1:
year state eligibility coverage
1990 AL .87 .70
1991 AL .78 .61
1992 AL .82 .63
1993 AL .79 .69
1994 AL .82 .73
1990 AK .91 .88
1991 AK .83 .79
1992 AK .82 .71
1993 AK .77 .69
1994 AK .82 .73
I need to add a variable "professionalism" from a different set of data, df2, but the problem is that df2 only has observations measured on even years. df2 thus takes the following form:
df2:
year state professionalism
1990 AL 1.33
1992 AL 1.40
1994 AL 1.42
1990 AK -0.92
1992 AK -0.98
1994 AK -1.02
Is there a function R that will add the odd years into df2, copying the value of the year +1, producing the following output:
df2':
year state professionalism
1990 AL 1.33
1991 AL 1.40
1992 AL 1.40
1993 AL 1.42
1994 AL 1.42
1990 AK -0.92
1991 AK -0.98
1992 AK -0.98
1993 AK -1.02
1994 AK -1.02
I can then merge the professionalism variable from the new df2' to df1... is this possible?