Package 'kinematics'

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

Help Index


Return accelerations

Description

Return accelerations

Usage

accel(t, x, y)

Arguments

t

The times vector

x

The x positions

y

The y positions

Value

The accelerations

See Also

speed, approx_derivative


Return a dataframe with information about the time-to-time displacements

Description

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.

Usage

append_displacement(data)

Arguments

data

A dataframe containing t, x and y

Value

A data frame including all the dynamical information, including displacements

See Also

append_dynamics, speed


Return a data frame with extra columns with dynamical information

Description

Return a data frame with extra columns with dynamical information

Usage

append_dynamics(data, append.displacement = TRUE)

Arguments

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

Value

A data frame including instantaneous dynamical variables, such as speed and acceleration

See Also

speed, accel, append_displacement


Approximate derivative

Description

Approximate derivative

Usage

approx_derivative(t, x)

Arguments

t

Vector of times

x

Vector of values

Value

A vector (of the same size of t) representing the numerical derivative

See Also

speed, accel


Return curvatures

Description

Return curvatures

Usage

curvature(t, x, y)

Arguments

t

The times vector

x

The x positions

y

The y positions

Value

The local curvature

See Also

speed, accel, curvature_radius


Return curvature radius

Description

Return curvature radius

Usage

curvature_radius(t, x, y)

Arguments

t

The times vector

x

The x positions

y

The y positions

Value

The local curvature radius

See Also

speed, accel, curvature


Return displacements

Description

Return displacements

Usage

displacement(x, y)

Arguments

x

The x positions

y

The y positions

Value

The displacements between a position and its previous


Example data set

Description

Experimental sample of 3000 positions of a macroinvertebrate

Format

A data frame with 3000 observations of:

x

horizontal position

y

vertical position

t

time

...


Get polar coordinates

Description

Get polar coordinates

Usage

get_polar_coordinates(x, y, origin = c(0, 0))

Arguments

x

Vector of x coordinates

y

Vector if y coordinates

origin

(Default = c(0, 0)) Position of the origin of coordinates

Value

Data frame with radius (r) and angle vectors (th)


Return speeds

Description

Return speeds

Usage

speed(t, x, y)

Arguments

t

The times vector

x

The x positions

y

The y positions

Value

The speeds

See Also

accel, approx_derivative