Displaying 2 results from an estimated 2 matches for "searchsorted".
2006 Aug 08
1
locating intervals
...r k, then
X[ix[k]] < X[k] < X[ix[k] +1] # also OK with "<=" on either one, but not
both
This is easy to code by looping over the data in X,Xi, but I suspect there
may be a faster and more elegant way to do this in R.
In Python (Numeric) the same can be achieved with
ix=Numeric.searchsorted(X[1:-1],Xi),
which is quite compact.
So, does anyone know of a corresponding R call that can achive the same?
Sincerely,
Halldór
--
Halldor Bjornsson
Weatherservice R & D
Icelandic Met. Office
[[alternative HTML version deleted]]
2006 Aug 08
1
locating intervals (corrected version)
...k, then
X[ix[k]] < Xi[k] < X[ix[k] +1] # also OK with "<=" on either one, but not
both
This is easy to code by looping over the data in X,Xi, but I suspect there
may be a faster and more elegant way to do this in R.
In Python (Numeric) the same can be achieved with
ix=Numeric.searchsorted(X[1:-1],Xi),
which is quite compact.
So, does anyone know of a corresponding R call that can achive the same?
Sincerely,
Halldór
--
Halldór Björnsson
Deildarstj. Ranns. & Þróun
Veðursvið Veðurstofu Íslands
Halldór Bjornsson
Weatherservice R & D
Icelandic Met. Office
[[alternative H...