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,
participant_ID = "participant_ID"
)
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
a vector of the time taken in each trial. Equal to the length of x trials by y participants in the dataset
- participant_ID
the variable that determines the participant identifier. If no column present, assumes a single participant
Value
a dataframe containing the time on the passed AOIs for each trial. One column for each AOI separated by trial.
Details
AOI_time 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
Examples
# \donttest{
data <- combine_eyes(HCL)
fix_d <- fixation_dispersion(data, participant_ID = "pNum")
# fixation data
AOI_time(data = fix_d, data_type = "fix", AOIs = HCL_AOIs, participant_ID = "pNum")
#> pNum trial AOI_1 AOI_2 AOI_3
#> 1 118 1 3500 1671 5886
#> 2 118 2 1387 1292 3924
#> 3 118 3 576 743 2932
#> 4 118 4 2412 3546 2609
#> 5 118 5 0 1101 2136
#> 6 118 6 789 886 2380
#> 7 119 1 3673 1743 2394
#> 8 119 2 912 880 1944
#> 9 119 3 1959 2152 2106
#> 10 119 4 4288 2043 1293
#> 11 119 5 4805 3270 2983
#> 12 119 6 3447 2920 4962
#raw data
AOI_time(data = data, data_type = "raw", AOIs = HCL_AOIs,
sample_rate = 120, participant_ID = "pNum")
#> pNum trial AOI_1 AOI_2 AOI_3
#> 1 118 1 9050 4283 15050
#> 2 118 2 3508 3392 10500
#> 3 118 3 1467 1967 7708
#> 4 118 4 6050 9358 7308
#> 5 118 5 242 2883 5908
#> 6 118 6 2017 2283 6842
#> 7 119 1 9550 4475 6383
#> 8 119 2 2333 2600 5450
#> 9 119 3 5008 5792 6100
#> 10 119 4 10867 5250 3800
#> 11 119 5 12500 9242 8008
#> 12 119 6 8742 7783 12650
# }