Learn R Programming

erp.easy (version 1.0.0)

p.measures: Calculate grand average and individual peak amplitude and latency

Description

p.measures calculates simple peak amplitude and latency for each condition in the data frame. Values are calculated for grand average waveforms, as well as for each individual subject. Values are based on the electrode, or electrode cluster for dense arrays, provided in electrodes. This function will identify the largest deviation from 0, whether positive or negative.

Usage

p.measures(data, electrodes, window, num.pts = 10)

Arguments

data
A data frame in the format returned from load.data
electrodes
A single value or concatenation of several values (to be averaged) indicating which electrodes to include in generating the plot. At this time, if the raw data files imported using load.data) do not have a header, you must include a capital "V" in front of the number and enclose each electrode in quotes. (For example, electrodes = "V78", or electrodes = c("V78", "V76").)
window
The beginning and end points of a time window of interest; this is different from the beginning and ending times epoch.st and epoch.end defined in load.data (you only need to define the epoch once upon importing the data).
num.pts
The number of bins to check for local peak measures. If no local peaks are found, the simple peak will be returned. To force the simple peak, set num.pts to 0.

Value

A data frame with columns labeled:
  • Subject
  • Trial Type
  • Peak Latency
  • Peak Amplitude

Details

At this time there is no way to specify a negative or positive peak. p.measures simply returns the largest absolute value deviation from zero.

Examples

Run this code
# Calculate peak latency and amplitude
p.measures(ERPdata, electrodes = "V78", window = c(1000, 1500))

Run the code above in your browser using DataLab