[R] Behavior of apply() when used with start()

Fernando Saldanha fsaldan1 at gmail.com
Wed Apr 13 16:31:43 CEST 2005


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:

> starts1
     [,1] [,2]
[1,]    1    2
[2,]    1    1

> starts2
     tsa tsb
[1,]   1   1
[2,]   1   1

Thanks for the help.

FS




More information about the R-help mailing list