View source: R/PreprocessingFunctions.R
process_gaze | R Documentation |
Preprocessing of gaze vector Interpolate over gaps in data and smooth the x and y vectors using a moving average filter. The gaze vector must contain the variables timestamp, and variables containing unfiltered x and y coordinates. Default names: x.raw and y.raw. Timestamps are assumed to be in milliseconds. The unprocessed x and y variables are kept under the names x.unprocessed and y.unprocessed for comparison. The function will add the variable timestamp.t to the data frame before returning. This is a theoretical timestamp based on the detected median sample-to-sample timestamp difference as compared to the actual registered time stamps in the data. This can be useful in some validation analyses.
process_gaze(
gaze_raw,
max_gap_ms = 75,
marg_ms = 30,
filter_ms = 15,
xcol = "x.raw",
ycol = "y.raw"
)
gaze_raw |
Data frame containing unfiltered timestamp, x.raw and y.raw vectors. |
max_gap_ms |
The maximum gaps defined as subsequent NAs in the data to interpolate over in milliseconds. Default 75 ms |
marg_ms |
The margin in milliseconds before and after the gap to use as basis for interpolation. |
filter_ms |
The size of the moving average window to use in smoothing. Default 15 ms |
xcol |
Name of column containing unprocessed x coordinates |
ycol |
Name of column containing unprocessed y coordinates |
data frame with gaze data after interpolation and filtering
processed_gaze <- process_gaze(sample.data.unprocessed)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.