I have two data frames with panel data. The first contains data on companies on a yearly basis. The layout is as below:
ID Year x1 x2 x3
A1 2000 10 11 12
A2 2000 13 25 20
A1 2001 13 58 13
and so on. The second data set contains the same companies, but data that is split by state AND year.
ID Year State xx1 xx2 xx3
A1 2000 AL 581 135 1.22
A1 2000 FL 584 51 1.5
A2 2000 AL 5138 84 1.7
...
Now, I am wondering if and how I can merge these two? Economically, it makes sense to have these different data panels as some data is only available on an overall company level (total assets, debt, income) and some data can be split for example: revenue in state; customers in state and so on...
I am very grateful for any idea on this!
p.s. using R