I don't have your data, so just using something that happens to be in
my workspace...(an xts object named ES_M1)

I'm sure there is something simpler, but something like this should do
what you're after.

This will only look at data between 9:00 and 10:00. Then, it extracts
the first row from all days.


> D <- split(ES_M1['T09:00/T10:00'],'days')> led <- lapply(D,'first')> do.call(rbind,led)                    ES.Bid.Price ES.Ask.Price ES.Trade.Price ES.Mid.Price
2011-06-06 09:00:00      1294.50      1294.75        1294.75     1294.625
2011-06-07 09:00:00      1290.50      1290.75        1290.50     1290.625
2011-06-08 09:00:00      1279.75      1280.00        1280.00     1279.875
2011-06-09 09:00:00      1286.00      1286.25        1286.00     1286.125
2011-06-10 09:00:00      1277.75      1278.00        1278.00     1277.875


HTH,

Garrett


On Wed, Jun 15, 2011 at 3:49 AM, Ulrich Staudinger <ustaudinger@gmail.com>wrote:

> You can try :
>
> seconds <- as.double(time(finalData[,1]))
> day = 60*60*24
> hour = 60*60
> minute = 60
> secs <- floor(seconds%%minute)
> mins <- floor(( seconds %% hour ) / 60)
> horas <- floor(( seconds %% day ) / 60 / 60)
>
> that should help you to find the minutes and hours for a given position.
>
> Hope this helps
>
>
>
>
>
> On Wed, Jun 15, 2011 at 5:40 AM, Noah Silverman <noahsilverman@ucla.edu
> >wrote:
>
> > Hi,
> >
> > I have a long series of hourly bars.  They are not aligned on the exact
> > hour.  I used xts to convert actual tick data to hourly bars.
> >
> > I want to access the first trade of each day.  Is there an easy way to do
> > this?
> >
> > Furthermore, what if I want to find the first trade that occurred after
> > 6:30am each day?  (Or any other arbitrary time each day?)
> >
> >
> > Here are a few rows of data:
> >
> > finalData[4880:4890,]
> >                    ds.Open ds.High  ds.Low ds.Close          ret
> > 2008-02-27 02:59:47 1461.75 1477.75 1457.25  1465.25  0.002220515
> > 2008-02-27 03:59:32 1467.25 1474.25 1425.75  1443.25 -0.015128361
> > 2008-02-27 04:59:30 1442.75 1477.25 1410.00  1431.25 -0.008349327
> > 2008-02-27 05:59:59 1434.00 1438.75 1366.75  1366.75 -0.046112530
> > 2008-02-27 09:59:59 1378.25 1439.25 1378.25  1428.00  0.043839205
> > 2008-02-27 10:59:58 1427.75 1636.75 1395.50  1591.00  0.108087885
> > 2008-02-27 11:59:59 1591.00 1592.25 1505.75  1551.25 -0.025301692
> > 2008-02-27 12:59:58 1550.50 1562.25 1495.75  1525.00 -0.017066647
> > 2008-02-27 13:14:59 1524.75 1584.25 1521.75  1545.50  0.013353073
> > 2008-02-27 18:59:56 1545.50 1560.25 1518.25  1551.00  0.003552402
> > 2008-02-27 19:59:53 1549.50 1549.50 1523.50  1524.00 -0.017561427
> >
> >
> >
> > Thanks!
> >
> >
> >
> > --
> > Noah Silverman
> > UCLA Department of Statistics
> > 8117 Math Sciences Building
> > Los Angeles, CA 90095
> >
> > _______________________________________________
> > R-SIG-Finance@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.
> >
>
>
>
> --
> Ulrich Staudinger
> http://www.activequant.org
>
>        [[alternative HTML version deleted]]
>
> _______________________________________________
> R-SIG-Finance@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]]

