Consider -> if (BinNumber==1) Loc_Prob=Bin1Main.data[findInterval(Dev_Size,Bin1Main.data[,1])+1,2] . .. ... .... if (BinNumber==10) Loc_Prob=Bin10Main.data[findInterval(Dev_Size,Bin10Main.data[,1])+1,2] BinNumber is just referencing 1 of 10 sets of data so: where BinNumber = 1 and Dev_Size = 160000 and Bin1Main.data -> [946,] 75407.58720 5.777982e-02 240 1.089000e+05 [947,] 86986.83708 4.762052e-02 833 9.713880e+04 [948,] 90271.43532 3.707760e-02 366 1.228392e+05 [949,] 91780.87644 2.635840e-02 349 9.583200e+04 [950,] 95189.31576 1.524112e-02 787 1.258884e+05 [951,] 130498.79040 4.440892e-16 625 1.306800e+05 I am getting the obvious "subscript out of bounds"error. How can i default Loc_Prob to 0.0 if there isnt a large enough value to match Dev_Size too? Something simple i am thinking but i cant get any of my thoughts too work. Thanks JR -- View this message in context: http://www.nabble.com/subscript-out-of-bounds-tp23398077p23398077.html Sent from the R help mailing list archive at Nabble.com.