Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm studying R, and am very impressed by the simplicity of some commands and in the way R handles temporal data. For example, in R, if you have some one-dimensional temporal data, you can easily transform it into a data series using:


In Mathematica, we have the new TemporalData function, but to do the same as in R, the code is a little clumsy due to the lack of frequency option or an equivalent. See the code:


The part {{1958,1},DatePlus[{1958,1},{Length[CBE],"Month"}]} is very inelegant and DateListPlot does not directly recognize the object (and you need to convert it to a number, which look likes a bug).

Does anyone have a clue for a more elegant way to handle this using TemporalData?

share|improve this question
up vote 13 down vote accepted

The following seems a little more elegant.

data = Import[""];

ts = TemporalData[data[[2 ;; -1, 1]], {"1958", Automatic, "Month"}];


enter image description here

TemporalData can also store multiple paths.

ts2= TemporalData[Transpose[data[[2 ;; -1]]], {"1958", Automatic, "Month"}];


enter image description here

share|improve this answer
much better. Tks! – Murta Dec 20 '12 at 10:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.