I am trying to categorize shifts based on the end time of a shift in R. In order to this I am using constraints for different time intervals, but I don't know how to specify them in a constraint. I already tried "" and as.POSIXct, but both did not work.
This is the code I am using:
> for (i in 1:length(SHIFTS2)){
if (SHIFTS2$ENDTIME > 10:00:00 && SHIFTS2$ENDTIME <= 18:00:00){
SHIFTS2$ENDCAT[i] <- 1
}else if (SHIFTS2$ENDTIME > 18:00:00 && SHIFTS2$ENDTIME <= 02:00:00){
SHIFTS2$ENDCAT[i] <- 2
}else{
SHIFTS2$ENDCAT[i] <- 3
}
}
Hope someone can help me out!