AOI_time_binned: Binned time analysis of area of interest entries

View source: R/AOI_time_binned.R

AOI_time_binnedR Documentation

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,
  AOI_names = NULL,
  sample_rate = NULL,
  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 (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.

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)



eyetools documentation built on June 18, 2025, 5:08 p.m.