interpolate {eyetools}R 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 = 25,
  method = "approx",
  report = FALSE,
  participant_ID = "participant_ID"
)

Arguments

data

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

maxgap

maximum number of consecutive NAs to fill. Any longer gaps will be left unchanged (see zoo package)

method

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

report

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

participant_ID

the variable that determines the participant identifier. If no column present, assumes a single participant

Details

It can take either single participant data or multiple participants where there is a variable for unique participant identification. The function looks for an identifier named participant_ID by default and will treat this as multiple-participant data as default, if not it is handled as single participant data, or the participant_ID needs to be specified

Value

a dataframe of the same shape of the input data

Examples

data <- combine_eyes(HCL)
interpolate(data, maxgap = 20, participant_ID = "pNum")


[Package eyetools version 0.7.2 Index]