[R] Find all numbers in a certain interval
Antje
niederlein-rstat at yahoo.de
Tue Dec 16 11:09:19 CET 2008
Hi all,
I'd like to know, if I can solve this with a shorter command:
a <- rnorm(100)
which(a > -0.5 & a < 0.5)
# would give me all indices of numbers greater than -0.5 and smaller than +0.5
I have something similar with a dataframe and it produces sometimes quite long
commands...
I'd like to have something like:
which(within.interval(a, -0.5, 0.5))
Is there anything I could use for this purpose?
Antje
More information about the R-help
mailing list