Skip to content
Prev 350294 / 398506 Next

How numerical data is stored inside ts time series objects

William Dunlap <wdunlap <at> tibco.com> writes:
I used what I learned from the responses to this thread, I looked at
the code for stl.  As they say in Microsoft, "this is expected
behaviour" according to the code.  And it doesn't look like an
inadvertent coding oversight.
-----------------------------------------------
Martin Maechler <maechler <at> lynne.stat.math.ethz.ch> writes:
The distinction in math is new me, with academic training in
engineering, even at the post grad level.  I haven't seen the
distinction in the math for Comp. Sci., either, and that's in the meat
grinder of Canada.  Admittedly, it's not quite as geeky as some meat
grinders in other countries.  And admittedly, I only took C.S. courses
that were geared to applications.  So I had always considered such a
distinction to a practicality in coding implementation of
vector/matrix classes, e.g., in C, a vector being a single pointer to
a number, while in a 2D array is a pointer to a vector and hence a
different type.
No need to apologize.  To clarify, being new to R, I was referring to
the general use of the term "list".  Specifically, I was referring to
an ordered collection without orientation, so it is consistent with
what you say above about distinguishing between length N vectors vs.
2D matrices of size Nx1 or 1xN.
Matlab pretty well only deals with 2D arrays, some of which have size
Nx1 or 1xN.  I haven't seen an example of a 1-D data structure that
doesn't have an orientation, implied or otherwise.  Though of course,
if someone proves me wrong, then I stand corrected (and smarter
because of it).
Big fan of python's readability, though I've only dabbled.  And
I won't start bitchering about R & S cuz I'm a newcomer and it's all
an eye popping wonderland.
-----------------------------------------------
David R Forrest <drf <at> vims.edu> writes:
I'm assuming that you meant utils.str.default() above.  I can follow
the rest of your post makes sense if I make that assumption.

I snipped the majority of your response because I'm not responding to
anything specific.  However, it was an extremely educational post.
Thank you for that.
I'm assuming that you mean stl(), since str() already works on both?
Maybe it's the version I have, however, but I find that the R code for
stl() doesn't have have a section for is.ts().  Instead, it seems to
run through a series of checks for pathological input, with the check
for matrix data consisting of is.matrix(na.action(as.ts(x))), where x
is the time series.  Somehow, the fact that the na.action(time series
argument) returns a matrix implies that the time series data is a
matrix rather than a vector.  In attempting to get insight, I found
that the ts class has no na.action method, and that the default method
for the generic na.action is not visible using getAnywhere (nor is it
visible by entering it at the command line without brackets).

Anyway, pretty educational.  Thanks again.