Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

cutter

Function to Identify in Which Interval a Value Falls


Description

Function to identify in which interval of a set of cut points, cuts, a value x falls within or beyond. The number of intervals is equal to the number of cut points plus 1. Values of x have to exceed the value of the cut point to be allocated to the higher interval.

Usage

cutter(x, cuts)

Arguments

x

name of the vector to be processed.

cuts

the vector of cut points.

Value

xi

a vector of the same length as x containing an integer between 1 and the number of cut points plus 1 indicating in which interval each value of x fell. Values <cut[1] have xi set to 1, and values >cut[highest] have xi set to the number of cut points plus 1.

Author(s)

Robert G. Garrett

Examples

## Make test data available
data(kola.c)
attach(kola.c)

## Cut the data into quartiles
xi <- cutter(Cu, quantile(Cu, probs = c(0.25, 0.5, 0.75)))

## Detach test data
detach(kola.c)

rgr

Applied Geochemistry EDA

v1.1.15
GPL-2
Authors
Robert G. Garrett
Initial release
2018-03-05

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.