epoch.samples | R Documentation |
epoch.samples
is used for time-locking sample data to a particular event and creating
separate epochs.
epoch.samples(timelock, samples, sample.field = "paL", epoch = c(-100, 100), messages = NULL, eyetrial = FALSE)
timelock |
either a string or pattern that matches a messsage sent to Eyelink (e.g., 'STIMONSET', 'TRIAL [0-9]*'), or a vector of times for events of interest. |
samples |
a data frame of sample data obtained from |
sample.field |
a character corresponding to the sample field that you are epoching (e.g., 'paL' or 'paR') |
epoch |
the starting and ending samples of the epoch, relative to the event (decault = c(-100, 100)) |
messages |
a data frame obtained from |
eyetrial |
logical indicating whether to include the eyetrial resulting from |
This is a basic function for epoching sample data (such as pupil diameter) relative to some time-locking event.
The event is indicated either as a message sent to the Eyelink during the experiment, or as a vector of times
of events (which must correspond to time
in the sample data frame).
a list with fields:
timelock
a numeric vector of the time-locking events
epoch.window
a vector indicating the epoch times you specified with epoch
sample.field
a character indicating the sample field you specified with sample.field
message
if a message is provided, a character vector indicating the message for each epoch
eyetrial
if eyetrial=TRUE, then the corresponding eyetrial for each epoch
epochs
a matrix of the actual epoched data (events x epoch_width)
Jason Hubbard, hubbard3@uoregon.edu
## Not run: #the easiest way is to use edf.trials: trials <- edf.trials('/path/to/EDFfile.edf',samples=T,eventmask=T) trials$samples$paR[trials$samples$blink==1] <- NA #quick blink removal, not perfect epochdata <- epoch.samples('STIMONSET',trials$samples,sample.field='paR', epoch=c(-500,500),messages=trials$messages,eyetrial=T) #plot it! matplot(t(epochdata$epochs[1:20,]),type='l') #if you want to timelock to some type of event: events <- edf.events('/path/to/EDFfile.edf',type='STARTSACC',fields='sttime') samples <- edf.samples('/path/to/EDFfile.edf') epochdata <- epoch.samples(events$sttime,samples,sample.field='paR',epoch=c(-500,1)) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.