my current data structure is as follows:
DATA | CompanyID | 2011 | 2012 | 2013 | … | 2019 |
VarOfInterest | i1 | stub1 | stub2 | stub3 | … | stubn |
AnnualReportDate | i1 | j1 | j2 | j3 | … | jn |
VarOfInterest | i2 | stub1 | stub2 | stub3 | … | stubn |
AnnualReportDate | i2 | j1 | j2 | j3 | … | jn |
Essentially, I have two Data: VarOfInterest and AnnualReportDate (both varying over the years for each company) for several companies (identified with CompanyID that is unique for each company and constant over the years)
I aim to reshape my dataset into a different structure, such as this one.
CompanyID | AnnualReportDate | VarOfInterest |
i1 | j1 | stub1 |
i1 | j2 | stub2 |
i1 | j3 | stub3 |
… | … | … |
i1 | jn | stubn |
i2 | j1 | stub1 |
i2 | j2 | stub2 |
i2 | j3 | stub3 |
… | … | … |
i2 | jn | stubn |
0 Response to Reshape multiple years observations from wide to long
Post a Comment