select.range {cwhmisc} | R Documentation |
select.range
accepts two vectors of paired observations and
returns a vector of observations from data
. The observations
returned are those for which the paired values in groupvec
are
within the range specified by min
and max
.
NOTE: The in-range condition is greater than or equal to min
and less than max
. This allows contiguous ranges to be
specified without returning the same value in two sets.
select.range(groupvec, min, max, data)
groupvec |
a vector of observations to be used for grouping. |
min |
the minimum value of the range. |
max |
the maximum value of the range. |
data |
a numeric vector of observations. |
The subset of observations from data
is returned invisibly.
?
testvec <-c(2,4,3,5,4,5,7,6,4,5,6,8,7,9,8) agevec <-c(10,13,14,25,29,32,34,45,48,55,62,67,69,70,74) newvec <-select.range(agevec,0,30,testvec) newvec # [1] 2 4 3 5 4