Message-ID: <CAHQdM3Dy0LF5S6iC4v84OH7X-AObR-Nwmx7p24wrUq0wirV8qw@mail.gmail.com>
Date: 2012-09-19T14:20:19Z
From: Mike Spam
Subject: effective way to return only the first argument of "which()"
Hi,
I was looking for a function like "which()" but only returns the first argument.
Compare:
x <- c(1,2,3,4,5,6)
y <- 4
which(x>y)
returns:
5,6
which(x>y)[1]
returns:
5
which(x>y)[1] is exactly what i need. I did use this but the dataset
is too big (~18 mio. Points).
That's why i need a more effective way to get the first element of a
vector which is bigger/smaller than a specific number.
I found "match()" but this function only works for equal numbers.
Thanks,
Nico