interpolate: Interpolation of missing data (NAs)

View source: R/interpolate.R

interpolateR Documentation

Interpolation of missing data (NAs)

Description

Extends the zoo::na.approx and zoo::na.spline functions to include a report which provides the proportion of missing data before and after the interpolation process. This is handy for evaluating the effectiveness of the repair.

Usage

interpolate(
  data,
  maxgap = 150,
  method = "approx",
  sample_rate = NULL,
  report = FALSE
)

Arguments

data

dataframe with columns time, x, y, trial (the standardised raw data form for eyeproc)

maxgap

maximum time gap of consecutive trackloss to fill (in ms). Any longer gaps will be left unchanged (see zoo package)

method

"approx" for linear interpolation or "spline" for cubic spline interpolation

sample_rate

Optional sample rate of the eye-tracker (Hz) for use with data. If not supplied, the sample rate will be estimated from the time column and the number of samples.

report

default is FALSE. If TRUE, then the return value is a list containing the returned data frame and the report.

Details

Analyses data separately for each unique combination of values in pID and trial.

Value

a dataframe of the same shape of the input data

Examples

data <- combine_eyes(HCL)
interpolate(data, maxgap = 150)


eyetools documentation built on June 18, 2025, 5:08 p.m.