Learn R Programming

eegkit (version 1.0-5)

eegtimemc: Plots Multi-Channel EEG Time Course

Description

Creates plot of multi-channel electroencephalography (EEG) time courses with subplots positioned according to electrode locations. User can control the plot orientation, line types, line colors, etc.

Usage

eegtimemc(time, voltmat, channel, size = c(0.75,0.75),
          vadj = 0.5, hadj = 0.5, xlab = "", ylab = "",
          voltSE = NULL, vlty = 1, slty = NA, vlwd = 1,
          slwd = 1, vcol = "blue", scol = "cyan", ...)

Value

Produces plot of EEG time course with NULL return value.

Arguments

time

Vector of time points at which EEG was recorded.

voltmat

Matrix of multi-channel EEG voltages (time by channel).

channel

Character vector giving name of channel for each column of voltmat.

size

Relative size of each subplot.

vadj

Vertical adjustment for each subplot.

hadj

Horizontal adjustment for each subplot.

xlab

X-axis label for each subplot.

ylab

Y-axis label for each subplot.

voltSE

Matrix of voltage standard errors (same size as voltmat).

vlty

Line type for voltmat.

slty

Line type for voltSE. If slty=NA (default) shaded polygons are plotted.

vlwd

Line width for voltmat.

slwd

Line width for voltSE. Ignored if slty=NA.

vcol

Line color for voltmat.

scol

Polygon or line color for voltSE.

...

Optional inputs for eegtime function.

Author

Nathaniel E. Helwig <helwig@umn.edu>

References

Begleiter, H. (1995). EEG Database [Dataset]. UCI Machine Learning Repository. tools:::Rd_expr_doi("10.24432/C5TS3D")

Harrell Jr F (2025). Hmisc: Harrell Miscellaneous. tools:::Rd_expr_doi("10.32614/CRAN.package.Hmisc"), R package version 5.2-3, https://CRAN.R-project.org/package=Hmisc

Examples

Run this code
##########   EXAMPLE   ##########

# # get control ("c") data from "eegdata" data
# data(eegdata)
# idx <- which(eegdata$group=="c")
# eegdata <- eegdata[idx,]

# # get average 
# eegmean <- tapply(eegdata$voltage,list(eegdata$time,eegdata$channel),mean)
# eegse <- tapply(eegdata$voltage,list(eegdata$time,eegdata$channel),sd)/sqrt(50)

# # plot time course for all electrodes
# dev.new(height=15,width=15, noRStudioGD = TRUE)
# tseq <- seq(0,1000,length.out=256)
# eegtimemc(tseq,eegmean,colnames(eegmean),ylim=c(-11,14),voltSE=eegse)

Run the code above in your browser using DataLab