Suppose I have a univariate zoo series:
v <- read.zoo(data.frame(dt=c(as.Date('2019-01-01')+1:10), vals=1:10))
v
2019-01-02 2019-01-03 2019-01-04 2019-01-05 2019-01-06 2019-01-07 2019-01-08 2019-01-09 2019-01-10 2019-01-11
1 2 3 4 5 6 7 8 9 10
I would like to turn this into a regular zoo series with an additional column val2
which has let's say "test":
val val2
2019-01-02 1 test
2019-01-03 2 test
...
I tried the following. It logically shouldn't work (since the zoo object is univariate) but I figured since this works for a data.frame
it might work or I'd get an error or warning to guide me towards the right path which surprisingly didn't happen but it did something REALLY BAD...:
cbind(v, val2="test")
v val2
1970-01-02 <NA> test
2019-01-02 1 <NA>
2019-01-03 2 <NA>
2019-01-04 3 <NA>
2019-01-05 4 <NA>
2019-01-06 5 <NA>
2019-01-07 6 <NA>
2019-01-08 7 <NA>
2019-01-09 8 <NA>
2019-01-10 9 <NA>
2019-01-11 10 <NA>
I would have expected it to fill val2
with the value: "test" or give me some warnings/errors.