Learn R Programming

cycleRtools (version 1.0.0)

reset: Reset a dataset or vector.

Description

Subtracts the first element from all other elements.

Usage

reset(x)

Arguments

x
a numeric vector or formatted cycling dataset (i.e. class "cycleRdata").

Value

  • either a data frame or vector, depending on the class of x.

Details

if x is a formatted dataset from a read* function, all the columns are reset as appropriate. This can be useful after subsetting a ride dataset, for example. Otherwise, this is a simple shortcut for x - x[[1]].

Examples

Run this code
data(cycling_data)
# Remove first minute of data and reset.
data_raw <- cycling_data[cycling_data$timer.s > 60, ]
data_reset <- reset(data_raw)
# Compare...
data_raw$distance.km[[1]]
data_reset$distance.km[[1]]

Run the code above in your browser using DataLab