Calculate difference of two xts time series when values are at different times
I have two xts time series in R and want to calculate the differences between the values of the time series at the times which are closest to each other. That is, if my two indices are:

    [1] (10/10/05 13:00:00) (10/10/05 14:00:00) (10/10/05 14:23:00)

and

    [1] (10/10/05 12:38:00) (10/10/05 12:53:00) (10/10/05 12:59:00) (10/10/05 13:08:00) (10/10/05 13:23:00)
    [6] (10/10/05 13:38:00) (10/10/05 13:53:00) (10/10/05 14:23:00) (10/10/05 15:05:00) (10/10/05 15:11:00)

I want to calculate the differences of the values at:

 - 13:00 and 12:59
 - 14:00 and 13:53
 - 14:30 and 14:23

How should I do this? The standard `merge` method from `zoo` with `all=FALSE` won't do what I want because the indices have to be exactly equal for it to merge properly.

Any ideas?
Calculate difference of two xts time series when values are at different times
===

I have two xts time series in R and want to calculate the differences between the values of the time series at the times which are closest to each other. That is, if my two indices are:

    [1] (10/10/05 13:00:00) (10/10/05 14:00:00) (10/10/05 14:23:00)

and

    [1] (10/10/05 12:38:00) (10/10/05 12:53:00) (10/10/05 12:59:00) (10/10/05 13:08:00) (10/10/05 13:23:00)
    [6] (10/10/05 13:38:00) (10/10/05 13:53:00) (10/10/05 14:23:00) (10/10/05 15:05:00) (10/10/05 15:11:00)

I want to calculate the differences of the values at:

 - 13:00 and 12:59
 - 14:00 and 13:53
 - 14:30 and 14:23

How should I do this? The standard `merge` method from `zoo` with `all=FALSE` won't do what I want because the indices have to be exactly equal for it to merge properly.

Any ideas?