Hello, 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. Johannes Habel -- 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. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.