Used to reference the EEG data to a specified electrode or electrodes. Defaults to average reference. When specific electrodes are used, they are removed from the data. Meta-data about the referencing scheme is held in the eeg_data structure.

eeg_reference(data, ...)

# S3 method for default
eeg_reference(data, ...)

# S3 method for eeg_data
eeg_reference(data, ref_chans = "average",
  exclude = NULL, robust = FALSE, ...)

# S3 method for eeg_epochs
eeg_reference(data, ref_chans = "average",
  exclude = NULL, robust = FALSE, ...)

reref_eeg(data, ...)

Arguments

data

Data to re-reference. Primarily meant for use with data of class eeg_data.

...

Further parameters to be passed to eeg_reference

ref_chans

Channels to reference data to. Defaults to "average" i.e. average of all electrodes in data. Character vector of channel names or numbers.

exclude

Electrodes to exclude from average reference calculation.

robust

Use median instead of mean; only used for average reference.

Value

object of class eeg_data, re-referenced as requested.

Methods (by class)

  • default: Default method

  • eeg_data: Rereference objects of class eeg_data

  • eeg_epochs: Rereference objects of class eeg_data

Examples

# demo_epochs is average referenced by default demo_epochs
#> Epoched EEG data #> #> Number of channels : 11 #> Number of epochs : 80 #> Epoch limits : -0.197 - 0.451 seconds #> Electrode names : A5 A13 A21 A29 A31 B5 B6 B8 B16 B18 B26 #> Sampling rate : 128 Hz #> Reference : average
# Rereference it but exclude B5 from calculation of the average eeg_reference(demo_epochs, exclude = "B5")
#> Epoched EEG data #> #> Number of channels : 11 #> Number of epochs : 80 #> Epoch limits : -0.197 - 0.451 seconds #> Electrode names : A5 A13 A21 A29 A31 B5 B6 B8 B16 B18 B26 #> Sampling rate : 128 Hz #> Reference : average
# Reference data using the median of the reference channels rather than the mean eeg_reference(demo_epochs, robust = TRUE)
#> Epoched EEG data #> #> Number of channels : 11 #> Number of epochs : 80 #> Epoch limits : -0.197 - 0.451 seconds #> Electrode names : A5 A13 A21 A29 A31 B5 B6 B8 B16 B18 B26 #> Sampling rate : 128 Hz #> Reference : average