[R] How to count number of year per firm in panel data?
johannes.habel at gmx.de
Wed Feb 11 17:43:05 CET 2009
I have an unbalanced panel dataset and would like to exclude all objects
that don't appear at least x times.
Therefore, I would like to include a column indicating for every line how
many periods are available, e.g.
id, year, number
1, 2000, 3
1, 2001, 3
1, 2002, 3
2, 2001, 1
3, ..., ...
This would allow me to exclude companies by setting "subset=number>=x".
However, I don't know how to create this column, i.e. how to count the years
for each object and include the numbers into the dataset.
Could anybody help me, please?
Alternatively, is there an easier way to achieve my goal?
Thank you very much.
View this message in context: http://www.nabble.com/How-to-count-number-of-year-per-firm-in-panel-data--tp21958252p21958252.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help