Dear Colleagues, I have a data set that looks as below. I'd like to count the number of dates in a series of arbitrary ranges (breaks) i.e. not pre-defined breaks such as months, quarters or years. table(format()) produces ideally formatted output, but table() does not appear to accept arbitrary ranges. I also tried converting the dates to numeric and using histogram to try to get the data, but that doesn't work either. Cut appears to accept an arbitrary range, but I could only get it to produce NAs.
Any suggestions? Yours, Simon Kiss mydata<-list(x=seq(as.Date("2007-05-01"), as.Date("2009-09-10"),"days"), y=seq(as.Date("2007-06-16"), as.Date("2009-11-12"),"days")) table(format(mydata[[1]], "%Y")) t_1<-hist(as.numeric(mydata[[1]], breaks=c("14056", "14421")))$counts cut(mydata[[1]], breaks=c(as.Date("2008-06-26"), ("2009=06-26"))) ********************************* Simon J. Kiss, PhD Assistant Professor, Wilfrid Laurier University 73 George Street Brantford, Ontario, Canada N3T 2C9 Cell: +1 519 761 7606 ______________________________________________ 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.