Learn R Programming

MotilityLab (version 0.2-5)

interpolateTrack: Interpolate Track Positions

Description

Approximates the track positions at given time points using linear interpolation (via the approx function).

Usage

interpolateTrack(x, t, how = "linear")

Arguments

x
the input track (a matrix or data frame).
t
the times at which to approximate track positions. These must lie within the interval spanned by the track timepoints.
how
specifies how to perform the interpolation. Possible values are "linear" (which uses approx with default values) and "spline" (which uses spline with default values).

Examples

Run this code
## Compare interpolated and non-interpolated versions of a track
bb <- boundingBox( TCells[2] )
plot( TCells[2] )
t2i <- interpolateTrack(TCells[[2]], seq(bb[1,"t"],bb[2,"t"],length.out=100),"spline")
plot( tracks( t2i ), add=TRUE, col=2 )

Run the code above in your browser using DataLab