Title: | Studying Sampled Trajectories |
---|---|
Description: | Allows analyzing time series representing two-dimensional movements. It accepts a data frame with a time (t), horizontal (x) and vertical (y) coordinate as columns, and returns several dynamical properties such as speed, acceleration or curvature. |
Authors: | Pablo Rodriguez-Sanchez (https://pabrod.github.io) and Sanne J. P. van den Berg (https://www.wur.nl/en/Persons/Sanne-dr.-SJP-Sanne-van-den-Berg.htm) |
Maintainer: | Pablo Rodriguez-Sanchez <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.0.0 |
Built: | 2025-03-06 05:03:56 UTC |
Source: | https://github.com/pabrod/kinematics |
Return accelerations
accel(t, x, y)
accel(t, x, y)
t |
The times vector |
x |
The x positions |
y |
The y positions |
The accelerations
The displacement is a bit more complicated than other dynamical variables, as it depends on the sampling frequency. If you are subsampling, always re-run append_displacement after subsampling.
append_displacement(data)
append_displacement(data)
data |
A dataframe containing t, x and y |
A data frame including all the dynamical information, including displacements
Return a data frame with extra columns with dynamical information
append_dynamics(data, append.displacement = TRUE)
append_dynamics(data, append.displacement = TRUE)
data |
A dataframe containing t, x and y |
append.displacement |
(Optional) Set it to FALSE to not calculate displacements. Useful if the data is going to be resampled |
A data frame including instantaneous dynamical variables, such as speed and acceleration
speed, accel, append_displacement
Approximate derivative
approx_derivative(t, x)
approx_derivative(t, x)
t |
Vector of times |
x |
Vector of values |
A vector (of the same size of t) representing the numerical derivative
Return curvatures
curvature(t, x, y)
curvature(t, x, y)
t |
The times vector |
x |
The x positions |
y |
The y positions |
The local curvature
speed, accel, curvature_radius
Return curvature radius
curvature_radius(t, x, y)
curvature_radius(t, x, y)
t |
The times vector |
x |
The x positions |
y |
The y positions |
The local curvature radius
Return displacements
displacement(x, y)
displacement(x, y)
x |
The x positions |
y |
The y positions |
The displacements between a position and its previous
Experimental sample of 3000 positions of a macroinvertebrate
A data frame with 3000 observations of:
horizontal position
vertical position
time
...
Get polar coordinates
get_polar_coordinates(x, y, origin = c(0, 0))
get_polar_coordinates(x, y, origin = c(0, 0))
x |
Vector of x coordinates |
y |
Vector if y coordinates |
origin |
(Default = c(0, 0)) Position of the origin of coordinates |
Data frame with radius (r) and angle vectors (th)
Return speeds
speed(t, x, y)
speed(t, x, y)
t |
The times vector |
x |
The x positions |
y |
The y positions |
The speeds