compileAOI: compile AOI columns in one column

Description Usage Arguments Details Value Author(s) Examples

View source: R/compileAOI.R

Description

Compiles the information on AOI's in separate variables to one variable

Usage

1

Arguments

data

A data frame containing fixation information of an eye tracking experiment. Each row indicates a fixation.

AOI

A vector containing the name or number of the columns in data indicating if the respective AOI was fixated (1) or not (0).

labels

[optional] A vector containing the names of the AOI in the same order as the column names or -numbers provided to AOI

Details

This function can be used to convert a wide format eye tracking data frame to a long format eye tracking data frame. It takes a data frame with multiple binary variables that indicate whether an AOI is fixated on (=1) or not (=0) and returns a vector with the AOI's that were fixated on.

NOTE: if the names of the AOI columns passed to the function are just numbers, make sure to pass these as character for the function to work properly. The function does not check for this case.

Value

A factor that contains the AOI fixated on for each row in the data frame whereby absence of a fixation on AOI is coded as 0.

Author(s)

Tine van Daal [aut], tine.vandaal@uantwerpen.be

San Verhavert [ctb], san.verhavert@uantwerpen.be

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
  data( SimData )
  
  # compileAOI accepts AOI's as names
  compileAOI( data = SimData, AOI = c( "AOI1", "AOI2", "AOI3" ) )
  
  # and as column numbers
  compileAOI( data = SimData, AOI = 2:4 )
  
  # and it returns 0 if some fixations are oitside the provided AOI's
  compileAOI( data = SimData, AOI = c( "AOI1", "AOI2" ) )
  
  # it is also possible to suply different lables for the AOI's
  compileAOI( data = SimData, AOI = c( "AOI1", "AOI2", "AOI3" ),
              labels = c( "1", "2", "3" ) )
  

eyeRead documentation built on Aug. 7, 2020, 5:07 p.m.