Re: [R] tail.matrix returns matrix, while tail.mts return vector
Thanks Ista! Indeed this is the workaround I had found, but not very practical as it fails on univariate series, so you should know before which class is the object... I feel a head.mts would make sense, or did I misunderstand something? Thanks! Matthieu Le 04. 09. 10 16:09, Ista Zahn a écrit : Hi Mat, You might be able to use the matrix method to get what you want. head.matrix(EuStockMarkets) -Ista On Sat, Sep 4, 2010 at 1:15 PM, matmatthieu.stig...@gmail.com wrote: Hi I have a few problems with tail/head when applied to multiple time series. I'm not sure as whether I did not understand the function or whether it correspond to an unexpected behavior. When head(a,n) is applied on data.frame or matrix, it returns a data-frame or matrix with first n obs of *each* variable. When applied to a mts object, it returns first n obs of *first* variable only, not of all... The same for tail(). See: head(freeny) ###mts object head(EuStockMarkets) #is equivalent to: head(EuStockMarkets[,1]) I guess it comes from absence of a head method for mts. Does it seem reasonable to have also a head.mts or did I misunderstand something? Thanks __ R-help@r-project.org mailing list 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. __ R-help@r-project.org mailing list 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.
[R] tail.matrix returns matrix, while tail.mts return vector
Hi I have a few problems with tail/head when applied to multiple time series. I'm not sure as whether I did not understand the function or whether it correspond to an unexpected behavior. When head(a,n) is applied on data.frame or matrix, it returns a data-frame or matrix with first n obs of *each* variable. When applied to a mts object, it returns first n obs of *first* variable only, not of all... The same for tail(). See: head(freeny) ###mts object head(EuStockMarkets) #is equivalent to: head(EuStockMarkets[,1]) I guess it comes from absence of a head method for mts. Does it seem reasonable to have also a head.mts or did I misunderstand something? Thanks __ R-help@r-project.org mailing list 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.
Re: [R] tail.matrix returns matrix, while tail.mts return vector
Hi Mat, You might be able to use the matrix method to get what you want. head.matrix(EuStockMarkets) -Ista On Sat, Sep 4, 2010 at 1:15 PM, mat matthieu.stig...@gmail.com wrote: Hi I have a few problems with tail/head when applied to multiple time series. I'm not sure as whether I did not understand the function or whether it correspond to an unexpected behavior. When head(a,n) is applied on data.frame or matrix, it returns a data-frame or matrix with first n obs of *each* variable. When applied to a mts object, it returns first n obs of *first* variable only, not of all... The same for tail(). See: head(freeny) ###mts object head(EuStockMarkets) #is equivalent to: head(EuStockMarkets[,1]) I guess it comes from absence of a head method for mts. Does it seem reasonable to have also a head.mts or did I misunderstand something? Thanks __ R-help@r-project.org mailing list 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. -- Ista Zahn Graduate student University of Rochester Department of Clinical and Social Psychology http://yourpsyche.org __ R-help@r-project.org mailing list 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.