Is this what you want:
> x <- c(0,3,4)
> ?findInterval
> findInterval(2, x)
[1] 1
>
On Wed, Dec 2, 2009 at 9:34 AM, Hao Cen wrote:
> Hi,
>
> How can I find the index of the next largest element in a sorted vector if
> an element is not found.
>
> for example, searching 2 in c(0,3,4) would retur
On Dec 2, 2009, at 9:34 AM, Hao Cen wrote:
Hi,
How can I find the index of the next largest element in a sorted
vector if
an element is not found.
for example, searching 2 in c(0,3,4) would return 1 since 2 is not
in the
vector and 0 is the next largest element to 2.
I tried which and
Hi,
How can I find the index of the next largest element in a sorted vector if
an element is not found.
for example, searching 2 in c(0,3,4) would return 1 since 2 is not in the
vector and 0 is the next largest element to 2.
I tried which and match and neither returns such information.
> which(
3 matches
Mail list logo