Skip to content
Back to formatted view

Raw Message

Message-ID: <971536df050413050135f24ca@mail.gmail.com>
Date: 2005-04-13T12:01:06Z
From: Gabor Grothendieck
Subject: Combine univariate time series
In-Reply-To: <s25cf0b3.099@du-gwpo.emp-eaw.ch>

On 4/13/05, Joerg Klausen <Joerg.Klausen at empa.ch> wrote:
> Hallo everyone
> 
> I have two univariate time series (class ts) describing the same variable. They have the same resolution, but span different periods in time with a big gap in between. I need to append one to the other such that they are one object, with the gap filled with NAs. The method ts.union produces a multivariate time series where the time axis is correct, but the individual time series are not combined into one.
> 

If ts1 and ts2 are two ts series:

both <- ts.union(ts1, ts2)
pmax(both[,1], both[,2], na.rm = TRUE)