Thx guys,

well the error I got is elswhere and I thought it was due to the asynchrone
timeseries.

let's assume that I got the intraday ratio, what I dois the following

d<-index(to.daily(ratio))
for (i in 1:length(d)){
 tstart<-paste(d[i], "09:00:00")
 tend<-paste(d[i],"17:00:00")
ts_ratio<-ratio[tstart:tend]
#
# other operations
#
}

and I have this error
Error in tstart:tend : argument NA / NaN

So I assume if it is not due to asynchrone series, it is due to the
subsetting.
Does xts objects accept this kind of subset?


On Thu, Jun 11, 2009 at 4:05 PM, Jeff Ryan <jeff.a.ryan@gmail.com> wrote:

> Anass,
>
> xts and zoo automatically align series via "merge" when performing Ops
> methods (+/-*...etc)
>
> This is what you want in most cases.
>
> See ?merge.xts, ?xts, ?merge.zoo and ?Ops.zoo
>
> HTH
> Jeff
>
> On Thu, Jun 11, 2009 at 9:00 AM, Joshua Ulrich<josh.m.ulrich@gmail.com>
> wrote:
> > Hi Anass,
> >
> > Can you provide an example of what you're trying to do and what error
> > you are receiving?  I'm able to run the code below without error.
> >
> >> require(xts)
> >>
> >> Lines <-
> > + "2008-06-02 09:00:00,5007.0
> > + 2008-06-02 09:01:00,5010.0
> > + 2008-06-02 09:02:00,5014.0
> > + 2008-06-02 09:03:00,5012.5
> > + 2008-06-02 09:04:00,5013.5
> > + 2008-06-02 09:05:00,5009.5
> > + 2008-06-02 09:06:00,5007.0
> > + 2008-06-02 09:07:00,5006.5
> > + 2008-06-02 09:08:00,5008.5
> > + 2008-06-02 09:09:00,5004.5"
> >>
> >> one <- read.zoo(textConnection(Lines),sep=',',FUN=as.POSIXct)
> >> one <- as.xts(one)
> >>
> >> Lines <-
> > + "2008-06-02 09:01:00,7115.0
> > + 2008-06-02 09:03:00,7117.0
> > + 2008-06-02 09:05:00,7111.0
> > + 2008-06-02 09:07:00,7107.0
> > + 2008-06-02 09:09:00,7102.5"
> >>
> >> two <- read.zoo(textConnection(Lines),sep=',',FUN=as.POSIXct)
> >> two <- as.xts(two)
> >>
> >> one/two
> >                           e1
> > 2008-06-02 09:01:00 0.7041462
> > 2008-06-02 09:03:00 0.7042996
> > 2008-06-02 09:05:00 0.7044719
> > 2008-06-02 09:07:00 0.7044463
> > 2008-06-02 09:09:00 0.7046111
> >> two/one
> >                          e1
> > 2008-06-02 09:01:00 1.420160
> > 2008-06-02 09:03:00 1.419850
> > 2008-06-02 09:05:00 1.419503
> > 2008-06-02 09:07:00 1.419555
> > 2008-06-02 09:09:00 1.419223
> >>
> >
> > Best,
> > Joshua
> > --
> > http://www.fosstrading.com
> >
> >
> >
> > On Thu, Jun 11, 2009 at 6:11 AM, Anass Mouhsine<anass.mouhsine@gmail.com>
> wrote:
> >> Hi all,
> >>
> >> Suppose I have two xts time series with asynchroneous time index.
> >> I would like for example to calculate a ratio of those two series, but I
> >> don't know how to get an intersection of the two indices in order to
> avoid
> >> errors.
> >>
> >> an example of the data is the following
> >>
> >> series1
> >>
> >> 2008-06-02 09:00:00 5007.0
> >> 2008-06-02 09:01:00 5010.0
> >> 2008-06-02 09:02:00 5014.0
> >> 2008-06-02 09:03:00 5012.5
> >> 2008-06-02 09:04:00 5013.5
> >> 2008-06-02 09:05:00 5009.5
> >> 2008-06-02 09:06:00 5007.0
> >> 2008-06-02 09:07:00 5006.5
> >> 2008-06-02 09:08:00 5008.5
> >> 2008-06-02 09:09:00 5004.5
> >>
> >> Series2
> >>
> >> 2008-06-02 09:01:00 7115.0
> >> 2008-06-02 09:03:00 7117.0
> >> 2008-06-02 09:05:00 7111.0
> >> 2008-06-02 09:07:00 7107.0
> >> 2008-06-02 09:09:00 7102.5
> >>
> >> Any idea?
> >>
> >> Thanks in advance
> >>
> >> _______________________________________________
> >> R-SIG-Finance@stat.math.ethz.ch mailing list
> >> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> >> -- Subscriber-posting only.
> >> -- If you want to post, subscribe first.
> >>
> >
> > _______________________________________________
> > R-SIG-Finance@stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> > -- Subscriber-posting only.
> > -- If you want to post, subscribe first.
> >
>
>
>
> --
> Jeffrey Ryan
> jeffrey.ryan@insightalgo.com
>
> ia: insight algorithmics
> www.insightalgo.com
>



-- 

En toda ocasion, disfruta de la vida

	[[alternative HTML version deleted]]

