clip_trials: Clip Trials to Standard Length

Description Usage Arguments Details Value See Also

View source: R/clip_trials.R

Description

Clips all trials to identical start and stop times, and issues a warning if there are any missing samples.

Usage

1

Arguments

data

Data frame containing all of your time series data and metadata.

trial

Name of the variable containing the trial label.

time

Name of the variable containing the time stamp.

start

Value for start time. Times earlier than this will be discarded.

stop

Value for stop time. Times later than this will be discarded.

Details

Due to a variety of factors, trials in an eye-tracking experiment end up being somewhat variable in length. clip_trials is useful for trimming multiple trials down to identical lengths, issuing a warning if your data contain trials that are shorter than the standard length you have specified.

Note that unlike most of the other functions in this package, clip_trials operates on an entire data frame (not individual vectors). The data frame must contain a column specifying trial number and a column specifying time. The names of these columns should be passed, without quotes, to the trial and time parameters, respectively.

If you did not include a trial number label in your eye-tracking output, you can use label_trials to construct one based on the sample index. Importantly, you must first use the zero_trials function to synchronize the time variable of each trial such that the 0 time point of each trial corresponds to the onset of the experimental event. The times in start and stop should be expressed in units relative to this event, e.g., if the time scale is in milliseconds, arguments of start = -1000 and stop = 6000 will standardize all trials to begin 1 second before the event and end 6 seconds after the event.

See the vignette on cleaning pupil data (browseVignettes("itrak")) for an example of how to use this function.

Value

Copy of data frame reduced to the range of times given by start and stop.

See Also

label_trials, zero_trials


jashu/itrak documentation built on May 9, 2020, 1:57 p.m.