| Type: | Package |
| Title: | Analyse Eye Data |
| Version: | 0.10.0 |
| Description: | Enables the automation of actions across the pipeline, including initial steps of transforming binocular data and gap repair to event-based processing such as fixations, saccades, and entry/duration in Areas of Interest (AOIs). It also offers visualisation of eye movement and AOI entries. These tools take relatively raw (trial, time, x, and y form) data and can be used to return fixations, saccades, and AOI entries and time spent in AOIs. As the tools rely on this basic data format, the functions can work with data from any eye tracking device. Implements fixation and saccade detection using methods proposed by Salvucci and Goldberg (2000) <doi:10.1145/355017.355028>. |
| License: | GPL-3 |
| URL: | https://tombeesley.github.io/eyetools/ |
| BugReports: | https://github.com/tombeesley/eyetools/issues |
| Depends: | R (≥ 3.5) |
| Imports: | ggforce, ggplot2, viridis, glue, hdf5r, lifecycle, magick, pbapply, rlang, stats, utils, zoo, png, grid, ggrepel, abind |
| Suggests: | knitr, rmarkdown, testthat (≥ 3.0.0), |
| VignetteBuilder: | knitr |
| Config/testthat/edition: | 3 |
| Encoding: | UTF-8 |
| LazyData: | true |
| Language: | en-GB |
| Config/roxygen2/version: | 8.0.0 |
| NeedsCompilation: | no |
| Packaged: | 2026-07-17 13:42:55 UTC; thoma |
| Author: | Tom Beesley [aut, cre], Matthew Ivory [aut] |
| Maintainer: | Tom Beesley <t.beesley@lancaster.ac.uk> |
| Repository: | CRAN |
| Date/Publication: | 2026-07-17 14:30:02 UTC |
eyetools: Analyse Eye Data
Description
Enables the automation of actions across the pipeline, including initial steps of transforming binocular data and gap repair to event-based processing such as fixations, saccades, and entry/duration in Areas of Interest (AOIs). It also offers visualisation of eye movement and AOI entries. These tools take relatively raw (trial, time, x, and y form) data and can be used to return fixations, saccades, and AOI entries and time spent in AOIs. As the tools rely on this basic data format, the functions can work with data from any eye tracking device. Implements fixation and saccade detection using methods proposed by Salvucci and Goldberg (2000) doi:10.1145/355017.355028.
Author(s)
Maintainer: Tom Beesley t.beesley@lancaster.ac.uk
Authors:
Tom Beesley t.beesley@lancaster.ac.uk
Matthew Ivory matthew.ivory@lancaster.ac.uk
See Also
Useful links:
Sequence analysis of area of interest entries
Description
Analyses the sequence of entries into defined AOI regions across trials. Can only be used with fixation data with a "fix_n" column denoting fixation events. Assumes that AOIs are non-overlapping and hasn't been tested with overlapping AOIs. Consecutive fixations within an AOI are grouped together as a single entry. Non-consecutive fixations in the same AOI (i.e., with an intervening fixation in no AOI) are treated as two separate entries.
Usage
AOI_seq(data, AOIs, progress = TRUE)
Arguments
data |
A dataframe with fixation data (from fixation_dispersion). Either single or multi participant data |
AOIs |
A dataframe of areas of interest (AOIs), with one row per AOI (name, x, y, width_radius, height). |
progress |
Display a progress bar |
Value
a dataframe containing the sequence of entries into AOIs on each trial, entry/exit/duration time into AOI
Examples
data <- combine_eyes(HCL)
fix_d <- fixation_dispersion(data)
AOI_seq(fix_d, AOIs = HCL_AOIs)
Analysis of time spent in areas of interest
Description
Analyses total time on defined AOI regions across trials. Works with fixation and raw data as the input (must use one or the other, not both).
Usage
AOI_time(data, data_type = NULL, AOIs, as_prop = FALSE, trial_time = NULL)
Arguments
data |
A dataframe of either fixation data (from fix_dispersion) or raw data |
data_type |
Whether data is a fixation ("fix") or raw data ("raw") |
AOIs |
A dataframe of areas of interest (AOIs), with one row per AOI (name, x, y, width_radius, height). |
as_prop |
whether to return time in AOI as a proportion of the total time of trial |
trial_time |
needed if as_prop is set to TRUE. a vector of the time taken in each trial. Equal to the length of x trials by y participants in the dataset |
Details
Analyses data separately for each unique combination of values in pID and trial. Returned values can be absolute time or proportion of time over the period.
Value
a dataframe containing the time on the passed AOIs for each trial. One column for each AOI separated by trial.
Examples
data <- combine_eyes(HCL)
fix_d <- fixation_dispersion(data)
# fixation data
AOI_time(data = fix_d, data_type = "fix", AOIs = HCL_AOIs)
#raw data
AOI_time(data = data, data_type = "raw", AOIs = HCL_AOIs)
#as proportional data
AOI_time(data = fix_d, data_type = "fix", AOIs = HCL_AOIs,
as_prop = TRUE, trial_time = HCL_behavioural$RT)
Binned time analysis of area of interest entries
Description
Analyses total time on defined AOI regions across trials separated into bins. Works with raw data as the input. Data can be separated into bins of a given length of time and the number of bins per trial is calculated automatically, keeping the bin length consistent across varying lengths of trial. Any data that cannot fill a bin (typically the last few milliseconds of the trial) are dropped to ensure that bins are of a consistent length
Usage
AOI_time_binned(
data,
AOIs,
bin_length = NULL,
max_time = NULL,
as_prop = FALSE
)
Arguments
data |
A dataframe of raw data |
AOIs |
A dataframe of areas of interest (AOIs), with one row per AOI (name, x, y, width_radius, height). |
bin_length |
the time duration to be used for each bin. |
max_time |
maximum length of time to use, default is total trial length |
as_prop |
whether to return time in AOI as a proportion of the total time of trial |
Details
AOI_time_binned can take either single participant data or multiple participants, where participants are demarcated by values in the "pID" column.
Value
a dataframe containing the time on the passed AOIs for each trial. One column for each AOI separated by trial.
Examples
data <- combine_eyes(HCL)
#with bins of 100ms each and only for the first 2000ms
AOI_time_binned(data = data, AOIs = HCL_AOIs,
bin_length = 100, max_time = 2000)
Read Eyelink ASC Sample Data
Description
Reads gaze sample data from an EyeLink ASC file, parses binocular or monocular recordings, segments samples into trials based on gaps in the timestamp sequence, and returns a tidied data frame with time reset to zero at the start of each trial.
Usage
ASC_to_df(
file,
recording = c("binocular", "monocular"),
pID = NA,
frequency = NA
)
Arguments
file |
Character string. Path to the EyeLink ASC (.asc) file to read. |
recording |
Character string. Type of recording to parse, either
|
pID |
Participant identifier to attach to every row of the output.
Required; the function will error if left as |
frequency |
Numeric. Sampling frequency in Hz of the recording
(e.g. 500, 1000). Used to determine the inter-sample gap threshold for
trial segmentation. The function will estimate the frequency as the median
difference between samples if left as |
Details
Lines in the ASC file are treated as gaze samples if they begin with a
digit. Columns are split on whitespace, EyeLink's missing-value marker
(".") is converted to NA, and all columns are coerced to
numeric. For binocular recordings the first 7 columns are expected
(time, left x/y/pupil, right x/y/pupil); for monocular recordings the
first 4 columns are expected (time, x, y, pupil).
Value
A data frame with one row per gaze sample, with columns:
- pID
Participant ID, as supplied.
- trial
Integer trial number, incremented whenever the gap between consecutive samples exceeds twice the expected sampling interval.
- left_x, left_y, right_x, right_y
Gaze coordinates for each eye (binocular recordings only).
- x, y
Gaze coordinates (monocular recordings only).
- time
Sample timestamp, reset to zero at the start of each trial.
Examples
## Not run:
samples <- read_eyelink_samples(
file = "participant01.asc",
recording = "binocular",
pID = "P01",
frequency = 1000
)
## End(Not run)
Example dataset from that contains binocular eye data from two participants from a simple contingency learning task (the data are from Beesley, Nguyen, Pearson, & Le Pelley, 2015). In this task there are two stimuli that appear simultaneously on each trial (to the left and right of the screen). Participants look at these cues and then make a decision by selecting an "outcome response" button. Data was recorded with a Tobii TX300 sampling at 300Hz. Participant sat approximately 60 cm from the screen. The screen resolution was 1920 x 1080.
Description
The dataset contains data from two participants and the first six trials of the study.
Usage
HCL
Format
A dataframe of 31,041 observations and seven variables
- pID
participant ID
- time
timestamp of the sample (milliseconds)
- left_x
x coordinate of the left eye
- left_y
y coordinate of the left eye
- right_x
x coordinate of the right eye
- right_y
y coordinate of the right eye
- trial
trial number
...
Example AOIs for use with HCL
Description
This dataframe contains three rectangular areas of interest (AOIs), set out for use with the HCL dataset. Values are in pixels. This is the standard AOI format required by many functions in the package. A template dataframe can be created using create_AOI_df()
Usage
HCL_AOIs
Format
A data frame with 3 rows and 5 variables:
- name
custom name for the AOI
- x
centred x coordinate of the AOI
- y
centred y coordinate of the AOI
- width_radius
either the width of the AOI, or the radius for circular AOIs
- height
the height of the AOI; should be NA for circular AOIs
...
Example dataset of behavioural data to complement dataset HCL.
Description
This contains information on stimuli (such as the side the predictive cue was presented on) as well as response data, including accuracy and response times
Usage
HCL_behavioural
Format
A dataframe of 12 observations and eight variables
- pID
participant ID
- trial
trial number
- P_cue
Are these necessary columns?
- NP_cue
Are these necessary columns?
- cue_order
whether the predictive cue os presented on the left (1) or the right (2)
- correct_out
NAre these necessary columns?
- accuracy
response accuracy
- RT
response time in milliseconds
...
Combine binocular data into single X/Y coordinate pairs
Description
Combines the data from binocular samples into X/Y coordinate pairs. Two methods can be used: "average" or "best_eye". For "average", the result is based on the average of the two eyes for each sample, or for samples where there is data from only a single eye, that eye is used. For "best_eye", a summary of the proportion of missing samples is computed, and the eye with the fewest missing samples is used.
Usage
combine_eyes(data, method = "average", progress = TRUE)
Arguments
data |
raw data with columns time, left_x, left_y, right_x, right_y, and trial |
method |
either "average" or "best_eye" - see description. |
progress |
whether to provide a progress bar or not. |
Value
a dataframe of x-2 variables (with left_x and right_x condensed to x, and left_y and right_y condensed to y) and the same number of observations as the input data
Examples
combine_eyes(HCL, method = "average")
A battery of metrics and plots to compare the two algorithms (dispersion and VTI)
Description
A tool for comparing the two different algorithms present in this package. This function is useful for assessing the data as well as exploring which algorithm is likely to fit data more appropriately. The raw data is run through both algorithms (using the same specified dispersion tolerances, etc.) before making comparisons of the underlying data. Can only be used for single participant data.
Usage
compare_algorithms(
data,
plot_fixations = TRUE,
print_summary = TRUE,
threshold = 100,
min_dur = 150,
min_dur_sac = 20,
disp_tol = 100,
NA_tol = 0.25,
smooth = FALSE
)
Arguments
data |
A dataframe with raw data (time, x, y, trial) for one participant |
plot_fixations |
Whether to plot the detected fixations. default as TRUE |
print_summary |
Whether to print the summary table. default as TRUE |
threshold |
velocity threshold (degrees of VA / sec) to be used for identifying saccades. Supplied to the VTI algorithm |
min_dur |
Minimum duration (in milliseconds) of period over which fixations are assessed. Supplied to both algorithms. |
min_dur_sac |
Minimum duration (in milliseconds) for saccades to be determined. Supplied to the VTI algorithm |
disp_tol |
Maximum tolerance (in pixels) for the dispersion of values allowed over fixation period. Supplied to both algorithms |
NA_tol |
the proportion of NAs tolerated within any window of samples that is evaluated as a fixation. Supplied to the dispersion algorithm |
smooth |
include a call to eyetools::smoother on each trial. Supplied to the VTI algorithm |
Value
a list of the fixation data, correlation output, and data used for plotting
Examples
data <- combine_eyes(HCL)
data <- interpolate(data)
compare_algorithms(data[data$pID == 119,])
conditional_transform
Description
A function to perform conditional transformations of the x/y raw data. The function takes the dataframe and performs a single axis flip based on the values specified in the cond_column. The primary use of this function is to correct or normalise the data when counterbalancing stimulus placement within experiments (e.g., having a target stimulus appear on the left and right equally often) The screen width and height in pixels can be set using tracker_properties_set().
Usage
conditional_transform(
data,
flip = c("x", "y"),
cond_column,
cond_values,
message = TRUE
)
Arguments
data |
a dataframe that includes columns x and y and the column specified in cond_column. Can be raw, fixation, or saccade data. |
flip |
either "x", to flip across vertical midline, or "y" to flip across horizontal midline |
cond_column |
a column name, on which the flips are conditional |
cond_values |
a single value or vector stating which values in con_column result in a flip |
message |
whether to output messages during function. Useful to turn off when using in a vectorised fashion where it is running multiple times |
Value
a dataframe of the equivalent format as the input data
Examples
data <- combine_eyes(HCL)
data <- merge(data, HCL_behavioural)
conditional_transform(data, flip = "x",
cond_column = "cue_order",
cond_values = 2)
Create a blank data frame for populating with AOIs
Description
Used to define a set of AOIs for use across various functions within the eyetools package.
Usage
create_AOI_df(num_AOIs = 3, AOI_data = NULL, AOI_names = NULL)
Arguments
num_AOIs |
number of AOIs, setting the number of rows |
AOI_data |
a list containing data for each AOI, ordered by x, y, width_radius, and height (NA if circular) |
AOI_names |
a vector of names for the AOIs specified in AOI_data |
Value
an AOI dataframe in the format required for several AOI functions in eyetools
Examples
# create an empty data frame with 3 AOIs
create_AOI_df(3)
# create an AOI dataframe with data, the second of which is circular, with names
create_AOI_df(num_AOIs = 3,
AOI_data = list(c(460,840,400,300), c(1460,840,400,NA), c(960,270,300,500)),
AOI_names = c("AOI_1", "AOI_2", "AOI_3"))
Compute visual angle from distance metrics
Description
Takes a single value or vector of distances and returns the visual angle equivalent.
Usage
dist_to_visual_angle(vector, dist_type = "cm")
Arguments
vector |
vector of distances (or single distance) |
dist_type |
default is "cm". Specify "pixel" for conversion from pixel values. |
Value
an equivalent-sized object to the input
Examples
# calculate visual angle for stimulus of 5cm
dist_to_visual_angle(5)
# calculate visual angle of stimuli 2cm and 10cm width
dist_to_visual_angle(c(2,10))
# calculate visual angle of 150 pixel wide
dist_to_visual_angle(150, dist_type = "pixels")
Fixation detection using a velocity threshold identification method
Description
Determine fixations by assessing the velocity of eye-movements, using a method that is similar to that proposed by Salvucci & Goldberg (2000). Applies the algorithm used in VTI_saccade and removes the identified saccades before assessing whether separated fixations are outside of the dispersion tolerance. If they are outside of this tolerance, the fixation is treated as a new fixation regardless of the length of saccade separating them. Compared to fixation_dispersion(), fixation_VTI() is more conservative in determining a fixation as smaller saccades are discounted and the resulting data is treated as a continued fixation (assuming it is within the pixel tolerance set by disp_tol). Returns a summary of the fixations found per trial, including start and end coordinates, timing, duration, mean velocity, and peak velocity.
Usage
fixation_VTI(
data,
threshold = 100,
min_dur = 150,
min_dur_sac = 20,
disp_tol = 100,
smooth = FALSE,
progress = TRUE
)
Arguments
data |
A dataframe with raw data (pID, time, x, y, trial), the standardised raw data form for eyetools |
threshold |
velocity threshold (degrees of VA / sec) to be used for identifying saccades. |
min_dur |
Minimum duration (in milliseconds) of period over which fixations are assessed |
min_dur_sac |
Minimum duration (in milliseconds) for saccades to be determined |
disp_tol |
Maximum tolerance (in pixels) for the dispersion of values allowed over fixation period |
smooth |
include a call to eyetools::smoother on each trial |
progress |
Display a progress bar |
Details
Analyses data separately for each unique combination of values in pID and trial.
Value
a dataframe containing each detected fixation by trial, with mean x/y position in pixel, start and end times, and duration.
References
Salvucci, D. D., & Goldberg, J. H. (2000). Identifying fixations and saccades in eye-tracking protocols. Proceedings of the Symposium on Eye Tracking Research & Applications - ETRA '00, 71–78.
Examples
data <- combine_eyes(HCL)
data <- interpolate(data)
fixation_VTI(data)
Fixation detection using a dispersion method
Description
Detects fixations by assessing dispersion of the eye position, using a method that is similar to that proposed by Salvucci & Goldberg (2000). Evaluates the maximum dispersion (distance) between x/y coordinates across a window of data. Looks for sufficient periods in which this maximum dispersion is below the specified dispersion tolerance. NAs are considered breaks in the data and are not permitted within a valid fixation period.
Usage
fixation_dispersion(
data,
min_dur = 150,
disp_tol = 100,
NA_tol = 0.25,
progress = TRUE
)
Arguments
data |
A dataframe with raw data (pID, time, x, y, trial), the standardised raw data form for eyetools |
min_dur |
Minimum duration (in milliseconds) of period over which fixations are assessed |
disp_tol |
Maximum tolerance (in pixels) for the dispersion of values allowed over fixation period |
NA_tol |
the proportion of NAs tolerated within any window of samples that is evaluated as a fixation |
progress |
Display a progress bar |
Details
It can take either single participant data or multiple participants, where participants are demarcated by values in the "pID" column.
Value
a dataframe containing each detected fixation by trial, with mean x/y position in pixel, start and end times, and duration.
References
Salvucci, D. D., & Goldberg, J. H. (2000). Identifying fixations and saccades in eye-tracking protocols. Proceedings of the Symposium on Eye Tracking Research & Applications - ETRA '00, 71–78.
Examples
data <- combine_eyes(HCL)
fixation_dispersion(data)
Get messages stored in TOBII-generated HDF5 files
Description
A function to get the message event files from a TOBII-generated hdf5 file to dataframe. Used when a Psychopy experiment uses the io.sendMessageEvent() to record events
Usage
hdf5_get_event(filename)
Arguments
filename |
the hdf5 file generated from TOBII |
Value
A dataframe of message events as recorded by TOBII eye trackers
Examples
## Not run:
raw_data <- hdf5_get_event("example_TOBII.hdf5")
## End(Not run)
Convert TOBII-generated HDF5 files to dataframe
Description
A function to convert TOBII-generated hdf5 files to a dataframe
Usage
hdf5_to_df(filename)
Arguments
filename |
the hdf5 file generated from TOBII |
Value
A list of dataframes collected from the eyetracker content, if only one eyetracking event is present, return this as a single dataframe
Examples
## Not run:
raw_data <- hdf5_to_df("example_TOBII.hdf5")
## End(Not run)
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,
vel_threshold = 35,
maxgap = 150,
method = "approx",
report = FALSE,
progress = TRUE
)
Arguments
data |
A dataframe with raw data (pID, time, x, y, trial), the standardised raw data form for eyetools |
vel_threshold |
the maximum velocity that is tolerated between start and end points of periods of missing data |
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 |
report |
default is FALSE. If TRUE, then the return value is a list containing the returned data frame and the report. |
progress |
Display a progress bar |
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)
Plots absolute or proportional time spent in AOIs over time
Description
A visualisation tool for plotting the changes in defined AOI regions across a single trial time.
Usage
plot_AOI_growth(
data = NULL,
pID_values = NULL,
trial_values = NULL,
AOIs = NULL,
type = "abs",
plot_time_not_in_AOI = FALSE
)
Arguments
data |
raw data in standard raw data form (time, x, y, trial) |
pID_values |
specify particular values within 'pID' to plot data from certain participants |
trial_values |
can be used to select particular trials within the data |
AOIs |
A dataframe of areas of interest (AOIs), with one row per AOI (name, x, y, width_radius, height) |
type |
either "abs" (absolute) or "prop" (proportion) |
plot_time_not_in_AOI |
boolean as to whether to include proportion of time spent outside AOIs |
Value
a plot of the raw data
Examples
data <- combine_eyes(HCL)
data <- interpolate(data)
# plot absolute and then proportional
plot_AOI_growth(data = data, AOIs = HCL_AOIs, type = "abs")
plot_AOI_growth(data = data, AOIs = HCL_AOIs, type = "prop")
Plot heatmap of raw data
Description
Plots a heatmap of raw data.
Usage
plot_heatmap(
data = NULL,
pID_values = NULL,
trial_values = NULL,
bg_image = NULL,
flip_y = FALSE,
plot_type = "density",
alpha_range = c(0.1, 0.8),
plot_header = FALSE
)
Arguments
data |
data in standard raw data form (time, x, y, trial) |
pID_values |
specify particular values within 'pID' to plot data from certain participants |
trial_values |
specify particular values within 'trial' to plot data from certain trials |
bg_image |
The filepath of a PNG image to be added to the plot, for example to show a screenshot of the task. |
flip_y |
reverse the y axis coordinates (useful if origin is top of the screen) |
plot_type |
Specify the nature of the data displayed. Either "density" (default) or "hex" |
alpha_range |
a pair of values between 0 and 1. The first is a cut off, whereby lower values are not displayed. The second value sets the transparancy of the visible poitns. |
plot_header |
display the header title text which explains graphical features of the plot. |
Value
a plot of the raw data
Examples
data <- combine_eyes(HCL)
# plot all trials data
plot_heatmap(data, pID_values = 118, alpha_range = c(0.3,0.8))
#plot one trial
plot_heatmap(data, trial_values = 1)
Plot of raw data over time
Description
A tool for visualising the timecourse of raw data over a single trial. Participant and trial values can be selected from the data. If values for these parameters are not provided then a single participant and a single trial will be sampled at random. Data can be split into bins by time or by the number of bins.
Usage
plot_seq(
data = NULL,
AOIs = NULL,
trial_values = NULL,
pID_values = NULL,
bg_image = NULL,
flip_y = FALSE,
plot_header = FALSE,
bin_time = NULL,
bin_range = NULL
)
Arguments
data |
A dataframe with raw data. If multiple trials are used, then one trial is sampled at random. |
AOIs |
A dataframe of areas of interest (AOIs), with one row per AOI (name, x, y, width_radius, height). |
trial_values |
specify particular values within 'trial' to plot data from certain trials |
pID_values |
specify particular values within 'pID' to plot data from certain participants |
bg_image |
The filepath of a PNG image to be added to the plot, for example to show a screenshot of the task. |
flip_y |
reverse the y axis coordinates (useful if origin is top of the screen) |
plot_header |
display the header title text which explains graphical features of the plot. |
bin_time |
if wanting to split data into bins, the time (in ms) for each bin of data to be displayed |
bin_range |
if wanting to split data into bins, the first and last bin to be display, e.g., c(1,5) |
Value
a plot of the raw data representing changes over time
Examples
data <- combine_eyes(HCL)
# plot the raw data
plot_seq(data)
# with AOIs
plot_seq(data, AOIs = HCL_AOIs)
# plot raw data with bins
plot_seq(data, bin_time = 500)
Plot raw data and fixations
Description
A tool for visualising raw eye-data, processed fixations, and saccades. Can use all three data types together and independently. Fixations can be labeled in the order they were made. Can overlay areas of interest (AOIs) and customise the resolution.
Usage
plot_spatial(
raw_data = NULL,
fix_data = NULL,
sac_data = NULL,
AOIs = NULL,
pID_values = NULL,
trial_values = NULL,
bg_image = NULL,
flip_y = FALSE,
show_fix_order = TRUE,
plot_header = FALSE
)
Arguments
raw_data |
data in standard raw data form (time, x, y, trial) |
fix_data |
data output from fixation function |
sac_data |
data output from saccade function |
AOIs |
A dataframe of areas of interest (AOIs), with one row per AOI (name, x, y, width_radius, height). If using circular AOIs, then the column width_radius is used for the radius and the height should be set to NA. |
pID_values |
specify particular values within 'pID' to plot data from certain participants |
trial_values |
specify particular values within 'trial' to plot data from certain trials |
bg_image |
The filepath of a PNG image to be added to the plot, for example to show a screenshot of the task. |
flip_y |
reverse the y axis coordinates (useful if origin is top of the screen) |
show_fix_order |
label the fixations in the order they were made |
plot_header |
display the header title text which explains graphical features of the plot. |
Value
a plot of the raw data
Examples
data <- combine_eyes(HCL)
# plot the raw data
plot_spatial(raw_data = data, pID_values = 118)
# plot both raw and fixation data together
plot_spatial(raw_data = data, fix_data = fixation_dispersion(data), pID_values = 118)
#plot one trial
plot_spatial(raw_data = data, fix_data = fixation_dispersion(data), trial_values = 6)
Velocity threshold identification of saccades
Description
Use the velocity threshold algorithm from Salvucci & Goldberg (2000) to determine saccadic eye movements. Returns a summary of the saccades found per trial, including start and end coordinates, timing, duration, mean velocity, and peak velocity.
Usage
saccade_VTI(data, threshold = 150, min_dur = 20)
Arguments
data |
A dataframe with raw data (pID, time, x, y, trial), the standardised raw data form for eyetools |
threshold |
velocity threshold (degrees of VA / sec) to be used for identifying saccades |
min_dur |
minimum duration (ms) expected for saccades. This helps to avoid identification of very short saccades occurring at the boundary of velocity threshold |
Details
Analyses data separately for each unique combination of values in pID and trial.
Value
a data frame giving the saccades found by trial
References
Salvucci, D. D., & Goldberg, J. H. (2000). Identifying fixations and saccades in eye-tracking protocols. Proceedings of the Symposium on Eye Tracking Research & Applications - ETRA '00, 71–78.
Examples
data <- combine_eyes(HCL)
saccade_VTI(data)
Smoothing of raw data
Description
A wrapper for the stats::loess function, with default parameters suitable for smoothing raw eye data
Usage
smoother(data, span = 0.05, plot = FALSE)
Arguments
data |
A dataframe with raw data (time, x, y, trial) for one participant |
span |
From stats::loess. The parameter alpha which controls the degree of smoothing. |
plot |
whether to plot the raw and smoothed plot for inspection |
Details
Analyses data separately for each unique combination of values in pID and trial.
Value
a dataframe of the same shape as the input data
Examples
data <- combine_eyes(HCL)
smoother(data)
#with an inspection plot
smoother(data, span = .02, plot = TRUE)
Get Current Eyetracker Properties
Description
Returns a list containing the current global eyetracker settings.
Usage
tracker_properties_get()
Value
A named list of the current tracker parameters.
Set the properties of the eye-tracker that was used in recording the data
Description
This function is used to specify the properties of the eye-tracker used to record the data. Users can update one or more parameters. Unnamed parameters retain previous values. If these are not set by the user, then default parameters are set and a warning is issued in every call to relevant functions
Usage
tracker_properties_set(
sample_frequency = NULL,
viewing_distance_cm = NULL,
screen_width_cm = NULL,
screen_height_cm = NULL,
screen_width_pixels = NULL,
screen_height_pixels = NULL
)
Arguments
sample_frequency |
Numeric frequency. |
viewing_distance_cm |
Distance in cm. |
screen_width_cm |
Width in cm. |
screen_height_cm |
Height in cm. |
screen_width_pixels |
Width in pixels. |
screen_height_pixels |
Height in pixels. |