AOI_time {eyetools} | R Documentation |
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,
AOI_names = NULL,
sample_rate = NULL,
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 (x, y, width_radius, height). |
AOI_names |
An optional vector of AOI names to replace the default "AOI_1", "AOI_2", etc. |
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. |
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)