[R] Looping through a dataframe
e-mail ma015k3113
m@015k3113 @end|ng |rom b|ueyonder@co@uk
Tue Jul 21 19:20:54 CEST 2020
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]]
More information about the R-help
mailing list