pace_formatter: Format pace durations

View source: R/mutate.R

pace_formatterR Documentation

Format pace durations

Description

pace_formatter takes a pace duration and returns a formatted string.

Usage

pace_formatter(pace)

Arguments

pace

A lubridate duration, returned by lubridate::duration or other methods in that family.

Details

This is most useful when plotting pace as one of the axes in a graph; rather than having the "number of seconds" as the axis value, this method can convert that to a more readable format.

Most commonly, using something like ggplot2::scale_y_reverse(label = pace_formatter) will ensure the y-axis goes from "slowest" to "fastest", and shows paces like "8:30" rather than "510"

Value

A formatted string representing the pace.

Examples

pace_formatter(lubridate::dseconds(380))
pace_formatter(lubridate::dseconds(510))
pace_formatter(lubridate::dseconds(680))

activatr documentation built on Sept. 11, 2024, 8:57 p.m.