geteegdata: Create data matrix from UCI EEG data

Description Usage Arguments Details Value Author(s) References Examples

View source: R/geteegdata.R

Description

Creates a data matrix (observations by variables) from the EEG Database on UCI Machine Learning Repository. Data matrix has 7 variables: subject, group, condition, trial, channel, time, and voltage. See eegdata and Details for more information.

Usage

1
2
geteegdata(indir,outdir=indir,cond=c("S1","S2m","S2n"),nt=NULL,
           filename="eegdata",filetype=c(".rda",".csv",".txt"))

Arguments

indir

Input directory (containing EEG data source folders).

outdir

Output directory (to save EEG data matrix file).

cond

Condition to read-in: S1=single stimulus, S2m=two matching stimuli, S2n=two non-matching stimuli.

nt

Number of trials to read-in for each subject (default is all trials).

filename

Name for EEG data matrix (default eegdata).

filetype

Type of file to save (default is R data file .rda).

Details

EEG Database on UCI website contains 64-channel electroencephalography (EEG) data from alcoholic and control subjects participating in a visual event-related potential (ERP) experiment. Subjects were exposed to three experimental conditions: S1 single visual stimulus, S2m two matching visual stimuli, S2n two non-matching visual stimuli. Each subject participated in multiple trials (replications) of each experimental condition. Data were recorded at 256 Hz for 1 second following the presentation of the visual stimulus/stimuli.

Value

Creates and saves a data matrix file.

Author(s)

Nathaniel E. Helwig <helwig@umn.edu>

References

Bache, K. & Lichman, M. (2013). UCI Machine Learning Repository [http://archive.ics.uci.edu/ml]. Irvine, CA: University of California, School of Information and Computer Science.

Begleiter, H. Neurodynamics Laboratory. State University of New York Health Center at Brooklyn.

Ingber, L. (1997). Statistical mechanics of neocortical interactions: Canonical momenta indicatros of electroencephalography. Physical Review E, 55, 4578-4593.

Ingber, L. (1998). Statistical mechanics of neocortical interactions: Training and testing canonical momenta indicators of EEG. Mathematical Computer Modelling, 27, 33-64.

Examples

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
##########   EXAMPLE 1: UCI TRAIN DATA (not run)   ##########

# Note: you need to change 'indir' and 'outdir' in Steps 2-4

# #(1)# download and untar SMNI_CMI_TRAIN.tar.gz file from UCI:
# #   # http://archive.ics.uci.edu/ml/machine-learning-databases/eeg-mld/

##### for Unix/Mac  #####

# #(2)# extract condition "S1" and save as .rda
# eegS1=geteegdata(indir="/Users/Nate/Downloads/SMNI_CMI_TRAIN/",
#                  cond="S1",filename="eegtrainS1")
                   
# #(3)# extract condition "S2m" and save as .rda
# eegS2m=geteegdata(indir="/Users/Nate/Downloads/SMNI_CMI_TRAIN/",
#                   cond="S2m",filename="eegtrainS2m")
                   
# #(4)# extract condition "S2n" and save as .rda
# eegS2n=geteegdata(indir="/Users/Nate/Downloads/SMNI_CMI_TRAIN/",
#                   cond="S2n",filename="eegtrainS2n")

# #(5)# combine conditions
# eegdata=rbind(eegS1,eegS2m,eegS2n)

##### for Windows  #####

# #(2)# extract condition "S1" and save as .rda
# eegS1=geteegdata(indir="C:/Users/Nate/Downloads/SMNI_CMI_TRAIN/",
#                  cond="S1",filename="eegtrainS1")
                   
# #(3)# extract condition "S2m" and save as .rda
# eegS2m=geteegdata(indir="C:/Users/Nate/Downloads/SMNI_CMI_TRAIN/",
#                   cond="S2m",filename="eegtrainS2m")
                   
# #(4)# extract condition "S2n" and save as .rda
# eegS2n=geteegdata(indir="C:/Users/Nate/Downloads/SMNI_CMI_TRAIN/",
#                   cond="S2n",filename="eegtrainS2n")

# #(5)# combine conditions
# eegdata=rbind(eegS1,eegS2m,eegS2n)


##########   EXAMPLE 2: UCI TEST DATA (not run)   ##########

# # Note: you need to change 'indir' and 'outdir' in Steps 2 and 3

# #(1)# download and untar SMNI_CMI_TEST.tar.gz file from UCI:
# #   # http://archive.ics.uci.edu/ml/machine-learning-databases/eeg-mld/

##### for Unix/Mac  #####

# #(2)# extract condition "S1" and save as .rda
# eegS1=geteegdata(indir="/Users/Nate/Downloads/SMNI_CMI_TEST/",
#                  cond="S1",filename="eegtestS1")
                   
# #(3)# extract condition "S2m" and save as .rda
# eegS2m=geteegdata(indir="/Users/Nate/Downloads/SMNI_CMI_TEST/",
#                   cond="S2m",filename="eegtestS2m")
                   
# #(4)# extract condition "S2n" and save as .rda
# eegS2n=geteegdata(indir="/Users/Nate/Downloads/SMNI_CMI_TEST/",
#                   cond="S2n",filename="eegtestS2n")

# #(5)# combine conditions
# eegdata=rbind(eegS1,eegS2m,eegS2n)

##### for Windows  #####

# #(2)# extract condition "S1" and save as .rda
# eegS1=geteegdata(indir="C:/Users/Nate/Downloads/SMNI_CMI_TEST/",
#                  cond="S1",filename="eegtestS1")
                   
# #(3)# extract condition "S2m" and save as .rda
# eegS2m=geteegdata(indir="C:/Users/Nate/Downloads/SMNI_CMI_TEST/",
#                   cond="S2m",filename="eegtestS2m")
                   
# #(4)# extract condition "S2n" and save as .rda
# eegS2n=geteegdata(indir="C:/Users/Nate/Downloads/SMNI_CMI_TEST/",
#                   cond="S2n",filename="eegtestS2n")

# #(5)# combine conditions
# eegdata=rbind(eegS1,eegS2m,eegS2n)


##########   EXAMPLE 3: UCI FULL DATA (not run)   ##########

# #(1)# download and untar eeg_full.tar file from UCI:
# #   # http://archive.ics.uci.edu/ml/machine-learning-databases/eeg-mld/

##### for Unix/Mac  #####

# #(2)# extract condition "S1" and save as .rda
# eegS1=geteegdata(indir="/Users/Nate/Downloads/eeg_full/",
#                  cond="S1",filename="eegfullS1")
                   
# #(3)# extract condition "S2m" and save as .rda
# eegS2m=geteegdata(indir="/Users/Nate/Downloads/eeg_full/",
#                   cond="S2m",filename="eegfullS2m")
                   
# #(4)# extract condition "S2n" and save as .rda
# eegS2n=geteegdata(indir="/Users/Nate/Downloads/eeg_full/",
#                   cond="S2n",filename="eegfullS2n")

# #(5)# combine conditions
# eegdata=rbind(eegS1,eegS2m,eegS2n)

##### for Windows  #####

# #(2)# extract all conditions and save as .rda (default use)
# eegS1=geteegdata(indir="C:/Users/Nate/Downloads/eeg_full/",
#                  cond="S1",filename="eegfullS1")
                   
# #(3)# extract condition "S2m" and save as .rda
# eegS2m=geteegdata(indir="C:/Users/Nate/Downloads/eeg_full/",
#                   cond="S2m",filename="eegfullS2m")
                   
# #(4)# extract condition "S2n" and save as .rda
# eegS2n=geteegdata(indir="C:/Users/Nate/Downloads/eeg_full/",
#                   cond="S2n",filename="eegfullS2n")

# #(5)# combine conditions
# eegdata=rbind(eegS1,eegS2m,eegS2n)

Example output



eegkitdata documentation built on May 1, 2019, 8:40 p.m.