dif.wave: Calculate a difference waveform from two data sets

Description Usage Arguments Details Value Author(s) Examples

View source: R/Difference.R

Description

dif.wave calculates a difference waveform from two data frames in the format returned from load.data

Usage

1
dif.wave(x, z, name = NULL, keep = NULL)

Arguments

x

A data frame in the format returned from load.data. This value serves as the minuend (i.e., value to be subtracted from).

z

A data frame in the format returned from load.data. This value serves as the subtrahend (i.e., value subtracted).

name

Specify the Stimulus column name of the difference data frame. Must provide the new name in quotations.

keep

Include one of the data frames used in subtraction in the returned difference data frame. By default keep = NULL and only the resulting difference data frame will be returned.

Details

The data frames must either:

  1. have been imported using load.data - OR -

  2. for subset data, the "Stimulus" column must be "refactored." See the example below for one way to "reset" the factors in the "Stimulus" column. Note this procedure is only necessary for subset data, and not data frames that were independently imported.

Value

One of two possible data frames, depending on the value of keep:

  1. keep = "y": the difference (i.e., x - z) data frame and the minuend data frame (i.e., x)

  2. keep = "n": just the difference data frame

Author(s)

Travis Moore

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
 # Calculate a difference wave
 Negative = ERPdata[1:6765, ]
 Neutral = ERPdata[6766:13530, ]
 refactor.neg <- factor(Negative$Stimulus)
 refactor.neut <- factor(Neutral$Stimulus)
 Negative$Stimulus <- refactor.neg
 Neutral$Stimulus <- refactor.neut
 difference <- dif.wave(Negative, Neutral, name = "Neg - Neut", keep = Neutral)
 head(difference) # view the new Stimulus column name
 grandaverage(difference, "V78") # plot the grand average difference wave

erp.easy documentation built on May 29, 2017, 11:39 p.m.

Related to dif.wave in erp.easy...