[R] Find all numbers in a certain interval
Antje
niederlein-rstat at yahoo.de
Wed Dec 17 14:02:00 CET 2008
Thanks a lot for every answer I got!
I could solve my problem!
Greg, your proposal seems to be quite useful for me :-) Thank you.
Ciao,
Antje
Antje schrieb:
> 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
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list