Skip to content
Prev 369588 / 398503 Next

New var

As Bert says/implies, "some assembly is required".

as.Date() is your friend and you can basically just subtract those to get differences.  Also, it seems to me that you are really trying to convert differences to a factor, and then represent the factor using particular dummy variables for successive differences, for use in a linear model of sorts. A combination of cut() and a contrast matrix (see contrasts<-) might be a better structured approach.

-pd