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

trackSpeed

Compute interpoint speeds along a track


Description

Given a vector or matrix of successive positions (in any number of dimensions), and the corresponding times, returns a vector of the average speed over each step in the track.

Usage

trackSpeed(coords, time)

Arguments

coords

Either a vector (1 dimension) or a matrix whose rows are successive points along a measured track.

time

A vector of times corresponding to the positions; either numeric or one of R's standard time classes.

Details

The function computes Euclidean distances along the path, in an arbitrary number of dimensions, though usually 1, 2, or 3, and divides by the corresponding differences in time. Missing values are allowed in either coordinates or time, but will propagate into the computed speeds, in the sense that the speed is NA if any of the coordinates or times at either end of the interval are missing.

Value

Numeric vector of speeds.

Examples

xy <- geoXY(object@latitude, object@longitude)
trackSpeed(cbind(xy, object@elevation), object@time)

SoDA

Functions and Examples for "Software for Data Analysis"

v1.0-6.1
GPL (>= 2)
Authors
John M Chambers
Initial release
2014-06-12

We don't support your browser anymore

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