[6374] in s-news-athena

home help back first fref pref prev next nref lref last post

Indices corresponding to a condition

daemon@ATHENA.MIT.EDU (wand@agsm.unsw.edu.au)
Fri Feb 3 01:00:56 1995

From: wand@agsm.unsw.edu.au
To: s-news@utstat.toronto.edu (S-PLUS news)
Date: Fri, 3 Feb 1995 16:20:08 +1000 (EET)

How does one find the indices of the entries of
an array that satisfy a certain condition?

For example, suppose

a <- c(0.34,0.56,0.12,0.67,0.98,0.41)

and you want the indices of those 
entries of "a" that are between 0.2 and 0.8;

i.e. you want to obtain the array with entries

1 2 4 6

Is there an easy way to do this?

Matt Wand
Australian Graduate School of Management,
wand@agsm.unsw.edu.au

home help back first fref pref prev next nref lref last post