Learn R Programming

taRifx (version 1.0.6.2)

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

Description

Classify values into groups based on which numbers they're between. quantile.cutpoints creates a data.frame of quantiles for feeding into e.g. categorize()

Usage

between(vec, cutpoints)

bin(vec, n = 10)

quantile_cutpoints(vec, probs)

Arguments

vec

Numeric vector to classify

cutpoints

Vector listing what values the grouping should be done on. Should include the max and the min in this list as well.

n

Number of groups to bin into

probs

Probabilities at which to create cutpoints

Value

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

See Also

categorize

Examples

Run this code
# NOT RUN {
test <- runif(100)
between(test,c(0,.1,.5,.9,1))
bin(test,n=5)
# }

Run the code above in your browser using DataLab