Dear All, I have a dataframe which has a few thousand companies with unique company numbers and names and each company has data for several years and each year is stored in a separate row.
I want to get a total for the number of years of data for each company. When I loop through the data with the following command I get a value of ‘1’ rather than a total of the rows for each company All_companies$count <-0 while All_companies$COMPANY_NAME == All_companies$COMPANY_NAME + 1 + {All_companies$count=All_companies$count+1} Can you kindly help me on this? Ahson [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.