Skip to contents

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.

Usage

AOI_seq(
  data,
  AOIs,
  AOI_names = NULL,
  sample_rate = NULL,
  long = TRUE,
  participant_ID = "participant_ID"
)

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 (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 raw_data. If not supplied, the sample rate will be estimated from the time column and the number of samples.

long

Whether to return the AOI fixations in long or wide format. Defaults to long

participant_ID

the variable that determines the participant identifier. If no column present, assumes a single participant

Value

a dataframe containing the sequence of entries into AOIs on each trial.

If long is TRUE, then each AOI entry is returned on a new row, if FALSE, then a row per trial is returned with all AOI entries in one character string

Examples

# \donttest{
data <- combine_eyes(HCL)
fix_d <- fixation_dispersion(data, participant_ID = "pNum")

AOI_seq(fix_d, AOIs = HCL_AOIs, participant_ID = "pNum")
#>     pNum trial AOI entry_n
#> 1    118     1   3       1
#> 2    118     1   1       2
#> 3    118     1   3       3
#> 4    118     1   2       4
#> 5    118     1   3       5
#> 6    118     1   2       6
#> 7    118     1   3       7
#> 8    118     1   1       8
#> 9    118     1   1       9
#> 10   118     1   3      10
#> 11   118     1   1      11
#> 12   118     1   3      12
#> 13   118     1   2      13
#> 14   118     1   3      14
#> 15   118     2   2       1
#> 16   118     2   3       2
#> 17   118     2   1       3
#> 18   118     2   3       4
#> 19   118     2   2       5
#> 20   118     2   1       6
#> 21   118     2   3       7
#> 22   118     2   1       8
#> 23   118     2   3       9
#> 24   118     2   2      10
#> 25   118     3   3       1
#> 26   118     3   2       2
#> 27   118     3   1       3
#> 28   118     3   3       4
#> 29   118     3   2       5
#> 30   118     3   3       6
#> 31   118     4   2       1
#> 32   118     4   3       2
#> 33   118     4   1       3
#> 34   118     4   2       4
#> 35   118     4   1       5
#> 36   118     4   3       6
#> 37   118     4   2       7
#> 38   118     4   1       8
#> 39   118     4   3       9
#> 40   118     4   2      10
#> 41   118     4   1      11
#> 42   118     4   2      12
#> 43   118     4   3      13
#> 44   118     5   3       1
#> 45   118     5   2       2
#> 46   118     5   3       3
#> 47   118     5   2       4
#> 48   118     5   3       5
#> 49   118     5   2       6
#> 50   118     5   3       7
#> 51   118     6   3       1
#> 52   118     6   2       2
#> 53   118     6   1       3
#> 54   118     6   3       4
#> 55   118     6   2       5
#> 56   118     6   1       6
#> 57   118     6   3       7
#> 58   119     1   3       1
#> 59   119     1   1       2
#> 60   119     1   3       3
#> 61   119     1   2       4
#> 62   119     1   1       5
#> 63   119     1   3       6
#> 64   119     1   1       7
#> 65   119     1   2       8
#> 66   119     1   1       9
#> 67   119     1   2      10
#> 68   119     1   3      11
#> 69   119     1   3      12
#> 70   119     1   1      13
#> 71   119     1   3      14
#> 72   119     2   1       1
#> 73   119     2   2       2
#> 74   119     2   3       3
#> 75   119     2   1       4
#> 76   119     2   3       5
#> 77   119     2   1       6
#> 78   119     2   2       7
#> 79   119     3   1       1
#> 80   119     3   2       2
#> 81   119     3   3       3
#> 82   119     3   2       4
#> 83   119     3   1       5
#> 84   119     3   2       6
#> 85   119     3   1       7
#> 86   119     3   3       8
#> 87   119     3   1       9
#> 88   119     4   1       1
#> 89   119     4   2       2
#> 90   119     4   1       3
#> 91   119     4   3       4
#> 92   119     4   1       5
#> 93   119     4   2       6
#> 94   119     4   1       7
#> 95   119     4   2       8
#> 96   119     4   1       9
#> 97   119     4   3      10
#> 98   119     4   3      11
#> 99   119     5   1       1
#> 100  119     5   2       2
#> 101  119     5   1       3
#> 102  119     5   2       4
#> 103  119     5   1       5
#> 104  119     5   2       6
#> 105  119     5   1       7
#> 106  119     5   3       8
#> 107  119     5   1       9
#> 108  119     5   3      10
#> 109  119     5   1      11
#> 110  119     5   3      12
#> 111  119     5   1      13
#> 112  119     6   3       1
#> 113  119     6   1       2
#> 114  119     6   2       3
#> 115  119     6   3       4
#> 116  119     6   2       5
#> 117  119     6   3       6
#> 118  119     6   2       7
#> 119  119     6   1       8
#> 120  119     6   2       9
#> 121  119     6   1      10
#> 122  119     6   3      11
# }