Try data.table with the roll=TRUE argument. Set your keys and then write :
futData[optData,roll=TRUE] That is fast and as you can see, short. Works on many millions and even billions of rows in R. Matthew http://datatable.r-forge.r-project.org/ "Santosh Srinivas" <santosh.srini...@gmail.com> wrote in message news:4ced3783.2af98e0a.57f0.ffffb...@mx.google.com... > Hello Group, > > I have the following options and future data in zoo objects > >> head(optData.z) > ExpDt OptTyp Strike TrdPrice TotTrdQty > 2009-01-01 09:55:03 20090129 1 2900 180.0000 50 > 2009-01-01 09:55:31 20090129 1 2900 188.0000 50 > 2009-01-01 09:55:37 20090129 1 2900 185.0000 500 > 2009-01-01 09:55:39 20090129 1 2900 185.0000 500 > 2009-01-01 09:55:47 20090129 1 2900 185.1125 600 > 2009-01-01 09:55:48 20090129 1 2900 185.2500 50 > >> head(futData.z) > ExpDt OptTyp Strike TrdPrice TotTrdQty > 2009-01-01 09:55:09 20090129 2 0 2979.000 900 > 2009-01-01 09:55:11 20090129 2 0 2976.633 600 > 2009-01-01 09:55:12 20090129 2 0 2977.211 900 > 2009-01-01 09:55:14 20090129 2 0 2977.750 800 > 2009-01-01 09:55:15 20090129 2 0 2977.019 4300 > 2009-01-01 09:55:16 20090129 2 0 2977.050 800 > > I want to get the closest available futures price for every option ... Is > there any function like the excel equivalent of approximate VLOOKUP of > excel > using date time? > > Thank you. > ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.