Learn R Programming

cycleRtools (version 1.1.1)

zone_time: Calculate time in zones.

Description

Given a vector of zone boundaries, sums the time spent in each zone.

Usage

zone_time(data, column = "power.W", zbounds, pct = FALSE, character.only = FALSE)

Arguments

data
a "cycleRdata" object, produced from a read_ride function.
column
the column name of the data to which the zone boundaries relate.
zbounds
numeric; zone boundaries.
pct
should percentage values be returned?
character.only
are column name arguments given as character strings? A backdoor around non-standard evaluation. Mainly for internal use.

Value

a data frame of zone times.

Examples

Run this code
data(ridedata)

## Time spent above and below critical power...
zone_time(ridedata, "power.W", zbounds = 300) / 60  # Minutes.

## Or with more zones...
zone_time(ridedata, "power.W", zbounds = c(100, 200, 300)) / 60

## Or given as a percentage...
zone_time(ridedata, "power.W", zbounds = c(100, 200, 300), pct = TRUE)

Run the code above in your browser using DataLab