Hi, I have a tmp object which is stream of numbers of -1, 0, 1, 2.  I want
to make values from 2007-09-05 to 2007-09-13 to be 0, and from 2007-09-14 to
2007-09-27 to be 1, and 2007-09-28 to 2007-10-03 to be 0 again.  To logic is
that suppose t(i)=1, then t(i+n)=1 if t(i+n) already is {0 or 1}, but not
2.  However, if i(i) is already {0 or 2}, then t(i+n) = 0, where n represent
the next n days.  What is the best approach without loops?  Thank you.

> class(tmp)
[1] "xts" "zoo"
> tmp[40:60]
           Tmp
2007-09-05             2
2007-09-06             0
2007-09-07             2
2007-09-10             0
2007-09-11             0
2007-09-12             0
2007-09-13             0
2007-09-14             1
2007-09-17             0
2007-09-18             0
2007-09-19             0
2007-09-20             0
2007-09-21             0
2007-09-24             1
2007-09-25             0
2007-09-26             0
2007-09-27             0
2007-09-28             2
2007-10-01             0
2007-10-02             0
2007-10-03             2

	[[alternative HTML version deleted]]

