Hi, these are pretty basic questions. You might want to pick up an introductory manual.
Lets assume you have a time stamp that already indicates the hours. Assume you have 300 observations, each of which falls in one of 24 hours of observation. You easily get the number of obs in each hour with the table command. x=sample(1:24,300,replace=T) table(x) Let's now assume you don't have the observations binned yet. Then you can 'cut' the time stamp vector at intervals of your liking, and tabulate the resulting occurrences of the factors. Assume as an example that you wanted irregular intervals. You want to know how many occurrences there are between midnight and 0900, 0900 and noon, noon and 1500, 1500 and 1800, and 1800 and midnight. nx=cut(x,c(0,9,12,15,18,24)) table(nx) for the second question: ?as.ts() HTH, Daniel -- View this message in context: http://r.789695.n4.nabble.com/Counting-things-in-a-time-series-tp3052148p3052306.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.