drift_correct: Perform drift correction on fixations for itrackR object

Description Usage Arguments Value See Also Examples

Description

Correct for drifts in fixation data. Algorithm computes the median x/y coordinates separately for each subject and behavioral variable specified, then fixations are adjusted based on difference between this "true" center and the center of the screen based on obj$resolution. Fixations are only adjusted if deviation is greater than some threshold.

Usage

1
drift_correct(obj, vars = c("ID"), threshold = 10)

Arguments

obj

an itrackR object

vars

variables to specify subsets of data for performing drift correction. default is 'ID'. Can also name any column in obj$beh (e.g., 'Block')

threshold

do not adjust fixations that deviate less than this threshold (in pixels). Default is 10 pixels

append

set to TRUE if you've already added behavioral data and you're adding more columns (default = FALSE, overwrite existing data).

Value

All fixations in obj$fixations are adjusted, and adjustment amounts are stored in obj$transform. To undo correction, use undrift.

See Also

undrift

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## Not run: 
# itrackr.data('edfs') returns full path to 2 edf files
z <- itrackr(edfs=itrackr.data('edfs'))

#Extracts messages like "BLOCK 1", and "TRIAL 7" and creates variables "Block" and "Trial", giving them values
# 1 and 7.
z <- set_index(z,c('Block', 'Trial'), patterns=c('BLOCK [0-9]*', 'TRIAL [0-9][0-9]*), numeric.only = TRUE)

beh <- itrackr.data('beh)

z <- add_behdata(z,beh)

#perform drift correction for each subject and Block.
z <- drift_correct(z, vars=c('Block'))

#if you're curious how adjustment was done, check it out:

View(z$transform)


## End(Not run)

jashubbard/itrackR documentation built on May 18, 2019, 4:53 p.m.