The heading of the velocity vector at each observation – the direction of travel from the previous point – as a per-row vector aligned to the Tracks' rows. The directional sibling of [instantaneous_speed()]; the per-observation counterpart of a velocity-based [derive_headings()] rule (which gives one heading per track).
Usage
velocity_angle(
ts,
units = c("radians", "degrees"),
x_col = ts@cols$x,
y_col = ts@cols$y
)Details
Returned in the package's heading convention: radians in `[0, 2*pi)` (or degrees in `[0, 360)`), `0` = the positive x-axis, increasing counterclockwise – the same frame as [derive_headings()] output, so it drops straight into [circ_summary()] / [radiate()]. Map to a display orientation with [circ_display()] when plotting.
Direction needs a step, so the first row of each track is `NA`. The result is invariant to any [set_distance_scale()] (the scale cancels in the ratio).
Examples
ts <- simulate_tracks(conditions = data.frame(n_trials = 3L),
n_points = 20, seed = 1, output = "trajset")
ts <- set_frame_rate(ts, 30)
head(velocity_angle(ts))
#> [1] NA 5.538253 5.704025 5.734100 5.428359 5.310436
