Skip to content
Prev 202003 / 398503 Next

column of dates into time series

On Nov 29, 2009, at 7:52 AM, Linlin Yan wrote:

            
library(chron)
?cut.dates

The argument breaks has several options including one of  c("days",  
"weeks", "months", "year")

 > dts <- Sys.Date() - 1:20

 > cut(dts, breaks="weeks")
  [1] 2009-11-23 2009-11-23 2009-11-23 2009-11-23 2009-11-23  
2009-11-23 2009-11-16 2009-11-16 2009-11-16 2009-11-16
[11] 2009-11-16 2009-11-16 2009-11-16 2009-11-09 2009-11-09 2009-11-09  
2009-11-09 2009-11-09 2009-11-09 2009-11-09
Levels: 2009-11-09 2009-11-16 2009-11-23

I was a bit puzzled when I tried cut.dates as the function which  
throws a function not found error.
David Winsemius, MD
Heritage Laboratories
West Hartford, CT