select.range: Select values from a vector depending on a range in a second...

Description Usage Arguments Value Author(s) Examples

Description

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.

Usage

1
select.range(data, groupvec, min, max)

Arguments

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.

Value

The subset of observations from data is returned invisibly.

Author(s)

??

Examples

1
2
3
testvec <- c(2.1,4.3,3.2,5.1,4.2,5.7,7.1,6.5,4.1,5,6,8,7,9 ,8 ,NA,NA)
agevec  <- c(10 ,13 ,14 ,25 ,29 ,32 , 34, 45, 48, 55, 62,67,69,70,74)
select.range(testvec,agevec,25,34.5) #  5.1 4.2 5.7 7.1

cwhmisc documentation built on May 1, 2019, 7:55 p.m.