linear: Interpolate using linear interpolation

Description Usage Arguments Details Value Examples

View source: R/linear.R

Description

Perform linear path interpolation on a movement dataset.

Usage

1
linear(xyt, t.slice)

Arguments

xyt

a 2x3 dataframe containing the coordinates and times of the two points to be interpolated between, often termed the anchor points. Each row of the dataframe should be arranged as x, y, t.

t.slice

a single time (POSIX or numeric), or list of times, to be interpolated for. The times must lie between those of the points in xyt.

Details

Linear interpolation is the simplest, and most commonly employed methods for path interpolation.

Value

The function returns a dataframe (with nrow = length{t.slice}) corresponding to the interpolated locations.

Examples

1
2
3
4
5
6
7
data(contrived)
xyt <- contrived
###times for interpolation
t.slice <- c(1.5,2,2.5,3,3.5,4,4.5,5,5.5)
a <- linear(xyt[2:3,],t.slice)
plot(xyt[,1],xyt[,2],pch=20)
points(a[,1],a[,2])

jedalong/PathInterpolatR documentation built on May 19, 2019, 12:40 a.m.