[R] Unexpected behavior with cbind.ts
John Kane
jrkrideau at inbox.com
Thu Aug 11 02:17:56 CEST 2016
It would help if you showed us the code you have been using so far plus some sample data (use dput() to produce it) can really help.
See ttp://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
http://adv-r.had.co.nz/Reproducibility.html
John Kane
Kingston ON Canada
> -----Original Message-----
> From: apoema.asa at gmail.com
> Sent: Wed, 10 Aug 2016 14:54:38 -0300
> To: r-help at r-project.org
> Subject: [R] Unexpected behavior with cbind.ts
>
> I got two ts variables (w and y) that I want to cbind into a mts matrix
> variable.
>
> w is a simple ts object with some random data, length=40, start = 2005,
> end
> = 2014.75, frequency = 4, class = "ts".
>
> y is a collection of 2 ts, nrow = 40, ncol=2, start = 2005, end =
> 2014.75,
> frequency = 4, class = "mts", "ts", "matrix"
>
> I was expecting that the result of cbind(w,y) to be a mts matrix with 3
> columns, 40 rows, same start and frequency as the originals, and finally
> to
> be of class "mts", "ts", "matrix.
>
> What I get is a single ts variable with length = 120, start = 2005 but
> end
> = 2034,75, frequency = 4, class = "ts". This behavior is what i would
> expect from ts.union, but not from cbind.
>
> I, unsuccessfully, tried to replicated this result with different
> variables. For example, cbind(ts(c(0,1), ts(matrix(c(2,3,4,5), 2,2))),
> returns exactly what I was expecting a ts matrix, with 2 rows and 3
> columns.
>
> Anyone has any idea of what is happening? What kind of attribute my
> variables could have to imply this behavior? I have the felling that I am
> simply calling two different function, but don't know why.
>
> Thank you in advance
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
____________________________________________________________
Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.
More information about the R-help
mailing list