Learn R Programming

SciencesPo (version 1.3.5)

between: Classify values into groups

Description

Classify values into groups based on which numbers they're between.

Usage

between(x, chunks)

Arguments

x
Numeric vector to classify
chunks
Vector listing what values the grouping should be done on. Should include the max and the min in this list as well.

Value

  • Vector of length(x) indicating which group each element is in (for between). Or vector of length(x) indicating the lower bound of the group that it is in.

See Also

dummy.

Examples

Run this code
age <-sample(1:100, 1000, rep=TRUE)
between(age,c(0, 15, 30, 50, 100))

Run the code above in your browser using DataLab