zone_index {cycleRtools} | R Documentation

## Index zones.

### Description

Generate a vector of zone "levels" from an input vector and defined boundaries.

### Usage

    zone_index(x, zbounds)

### Arguments

`x` | numeric; values to be "zoned".
`zbounds` | numeric; values for zone boundaries.

### Value

a numeric vector of zone values of the same length as `x`. The number of zone levels will be `length(zbounds) + 1`.

### Examples

    data(ridedata)

    ## Best used to append to existing data.
    ridedata$zone <- zone_index(ridedata$power.W, c(100, 200, 300))

    ## How much distance was covered in each zone?
    ridedata$delta.dist <- c(0, diff(ridedata$distance.km))
    with(ridedata, tapply(delta.dist, zone, sum, na.rm = TRUE))  # Km.

[Package cycleRtools version 1.1.1 Index]