I have a list of data as part of big data frame, it is sorted by time so I can not change the order of the list :
ID <- c("p","fxman27","duncane" ,"duncane" ,"dday1026" ,"duncane","dday1026","dday1026" ,"dday1026" ,"dday1026","cesandjoel","pali777","ranger_2","marymom6" , "deaglekl")
Now I need a function to produce this counts of those IDs:
s<-c(1 , 2 ,3 , 3 , 4, 4 ,4 , 4 , 4 ,4 , 5, 6, 7, 8 , 9)
as you can see, the function count number of distinct ID's and remain constant if the ID is the same in previous row. I don't want to use "for" loops, and prefer BASE functions.
the "s" is not simple frequency table, for that I know I can use aggregate. This is not a grouping question, but number of "current Id's" is auctions Thanks