add_behdata: Merge behavioral data with itrackR object

Description Usage Arguments Value See Also Examples

Description

Take a data frame containing behaivoral data and merge with the eyetracking data in an itrackR object. Merging is done based on ID and any index variables set using set_index. Index variables should match the same ones that are in obj$header.

Usage

1
add_behdata(obj, beh, append = FALSE)

Arguments

obj

an itrackR object

beh

a data frame containing behavioral data. Should at least have the column ID which matches ID names/numbers in obj$subs.

append

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

Value

data frame is saved in obj$beh, with the extra column eyetrial which matches the eyetracking data. Variables in obj$beh can be used for subsetting when calling eyemerge, plot.itrackR, and fixation_timeseries.

See Also

eyemerge

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## 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)

#notice the new eyetrial variable...
View(z$beh)


## End(Not run)

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