Re: [R] Creating categories from a date-time object

2012-02-15 Thread Jose Bustos Melo
De: jim holtman CC: "r-help@r-project.org" Enviado: Martes 14 de febrero de 2012 20:56 Asunto: Re: [R] Creating categories from a date-time object Will this do it for you: > tmp <- seq(as.POSIXct('2011-08-01 13:00&#

Re: [R] Creating categories from a date-time object

2012-02-14 Thread jim holtman
Will this do it for you: > tmp <- seq(as.POSIXct('2011-08-01 13:00'), as.POSIXct('2011-09-02 03:00'), > by='45 min') > # get just the hours > hours <- format(tmp, "%H") > weekdays <- format(tmp, "%w") %in% c('1', '2', '3', '4','5') > office <- (hours >= '08') & (hours < '18') & weekdays > result

[R] Creating categories from a date-time object

2012-02-14 Thread Jose Bustos Melo
Hello R-List, I have a question about recoding from a date time object.  I have tried using as.POSIXct objects and Chron Objects, but I can get the what I want. I need to create a new variable from a date-time object, adding "Office Time" for those events that happens between 08:00:00 to 18:00: