Skip to content
Prev 25857 / 29559 Next

average bearing of animal movement data

You can convert a "trip" object to a SpatialPointsDataFrame with
as("SpatialPointsDataFrame",my_trip). Then you can use functions like
"spDistsN1" from sp to compute the distance from "home" to each point,
find the maximum, and then use "bearing" from the "geosphere" package
to get the bearing for that row.

A complication I see is that this will only return the maximum
distance to a vertex point on the trip. For a trip in two flat
dimensions the maximum distance will always be a vertex point on the
trip but I think on a sphere its possible for great circles between
two points to have a location on the circle that is further from a
given point than either of the end points. But I can't get my head
quite round the 3d triangular geometry this early in the morning. For
small steps in a trip where you can approximate the geometry as flat
this is not a problem.

In contrast, the minimum distance from a trip to a "home" point is
rarely a vertex point on the trip because its possible for the trip
path to go very close to the home point in question. e.g a trip from
(10,0) to (-10,0) goes right through (0,0) but its points are both 10
units away.

Barry
On Wed, Aug 2, 2017 at 7:25 PM, Alice Domalik <adomalik at sfu.ca> wrote: