[R-SIG-Finance] Aligning time series

Chirag Anand anand.chirag at gmail.com
Wed Apr 16 08:12:41 CEST 2014


Hi Mikhail,

As Ilya said, xts takes care of it. You can use "merge.zoo" (if using
zoo) or "merge.xts" to merge two series. The missing timestamps are
taken care of by the "all" argument. You can use it to specify whether
to take missing timestamps from both the series, an individual series,
or not at all. The details are available in the respective man pages
of the functions.

On 16 April 2014 00:39, Ilya Kipnis <ilya.kipnis at gmail.com> wrote:
> Mikhail, are you using the xts package? Because when you cbind two xts time
> series, it takes care of alignment for you.
>
> -Ilya
>
>
> On Tue, Apr 15, 2014 at 12:07 PM, Mikhail Beketov <
> mikhailbeketov at googlemail.com> wrote:
>
>> Hello,
>> I have to analyze a large data-set of 1-min stock prices. The problem is
>> that the time-series for different stocks in my data-set have different
>> length, as some time points are missing in one series but present in
>> another etc. So, I have to create a table with aligned time series (all
>> dates/times should correspond to all the stocks). My questions are:
>> 1) Is there some efficient way to do it? Is there anything that is already
>> programmed.
>> 2) Does it make sense to align all of them to shortest time series (so,
>> delete the time points that are not given for all stocks)? Or, is better to
>> copy the preceding price values for the absent time points, and therefore
>> to align all of them to the longest time series?
>> Thanks,
>> Michael
>>
>>         [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-SIG-Finance at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>> -- Subscriber-posting only. If you want to post, subscribe first.
>> -- Also note that this is not the r-help list where general R questions
>> should go.
>>
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-SIG-Finance at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.



-- 
Chirag Anand
http://atvariance.in/chiraganand



More information about the R-SIG-Finance mailing list