distSpeed {diveMove}R Documentation

Calculate distance and speed between locations

Description

Calculate distance, time difference, and velocity between pairs of points defined by latitude and longitude, given the time at which all points were measured.

Usage

distSpeed(pt1, pt2, velocity=TRUE)
track(txy, id=gl(1, nrow(txy)), subset)

Arguments

pt1 a matrix or data frame with three columns; the first a chron object with dates and times for all points, the second and third numeric vectors of longitude and latitude for all points, respectively, in decimal degrees.
pt2 a matrix with the same structure as pt1.
velocity logical; should velocity between points be calculated?
txy a data frame with a chron object in its first column, lon and lat in second and third column, respectively.
id a factor dividing the data in txy into distinct groups.
subset a logical expression indicating the rows to be analyzed, in terms of elements of txy.

Details

pt1 and pt2 may contain any number of rows. track is essentially a wrapper for distSpeed, taking a data frame, assumed to be ordered chronologically, and calculations are done between all successive rows.

Value

For distSpeed, a matrix with three columns: distance (km), time difference (h), and velocity (m/s). For track, a data frame with an id column and the same columns as in distSpeed.

Author(s)

Sebastian P. Luque spluque@gmail.com


[Package diveMove version 0.1-5 Index]