t_bearing: Add bearings

Description Usage Arguments Details Value Note Author(s) See Also Examples

View source: R/t_bearing.R

Description

Bearing towards the next coordinate in the tracks.

Usage

1
2
3
t_bearing(
  tracks, t_id = "id", bind = TRUE, drop = TRUE, cname = "bearings"
)

Arguments

tracks

psyo. Data frame with tracks.

t_id

character or numeric. Column name in tracks that identifies the separate tracks.

bind

logical. Return the distance as list (FALSE) or add it to tracks (TRUE).

drop

logical. If TRUE and only one observation is returned drop the data frame and collapse the return value to a vector.

cname

character. Column name of the returned calculation result.

Details

For the last coordinate within a track the function returns empty because there are no bearings towards a following coordinate possible.

If the succeeding coordinate is the same like the current coordinate, the function return empty for the current coordinate.

Value

psyo

Note

Please be aware that this function calculates the initial bearing from the first to the second point and that this bearing is saved with the second point. This seems counter intuitive for an initial bearing but is done for better compatibility with the gap functions.

Author(s)

Benjamin Ziepert. Please send feedback to: feedback-psyosphere@analyse-gps.com.

See Also

bearing, t_distance, t_speed, t_time_difference

Examples

1
2
3
4
5
## Not run: 
data(psyo)
psyo <- t_bearing(psyo)

## End(Not run)

psyosphere documentation built on July 2, 2020, 12:08 a.m.