Skip to content
Prev 67566 / 398506 Next

Behavior of apply() when used with start()

Can someone explain why starts1 and starts2 are diffferent in the example below?

After running this program

a <- c(1:3)
b <- c(2:3)
tsa <- ts(a)
tsb <- ts(b, start = 2)
arr <- cbind(tsa, tsb)
starts1 <- cbind(start(tsa), start(tsb))
starts2 <- apply(arr, 2, start)

I get:
[,1] [,2]
[1,]    1    2
[2,]    1    1
tsa tsb
[1,]   1   1
[2,]   1   1

Thanks for the help.

FS