load.data: Import your individual ERP data files.

Description

load.data imports your individual ERP data files. File extensions must be .txt and file names must be in the format: YourFile_Condition.txt (e.g., SS34_Positive.txt). Raw data files to be imported should be organized as follows:

Usage

1
load.data(path, condition, num.subs, epoch.st, epoch.end, header = FALSE)

Arguments

path

The folder path containing your ERP files

condition

In quotes, a string indicating which trial type you will be importing (i.e., the condition indicated in the file name)

num.subs

The number of files (subjects) to import for a given condition

epoch.st

The earliest time point sampled in the ERP files, including the basline (e.g., -200)

epoch.end

The final time point sampled in the ERP files

header

Only accepts values of TRUE or FALSE. Used to specify whether or not there is an existing header row in the ERP files. If there is no header, load.data will supply one (see details below).

Details

Value

A single, concatenated data frame of all electrode data for all subjects organized into columns, with three added columns:

  1. "Subject" containing repeating subject names

  2. "Stimulus" containing repeating condition names (e.g., Neutral)

  3. "Time" containing a repeating list of timepoints sampled

Note

While importing data must be done using a separate function call for each condition, it can be convenient to use R's native rbind.data.frame() command to bind several loaded conditions (variables) into a single data frame consisting of multiple conditions. All erp.easy functions will act on all conditions included in the data frame passed to the function. For example, if you'd like to see all conditions plotted, simply use rbind.data.frame() to make a single data frame to pass to an erp.easy plotting function, and you will see all added conditions plotted simultaneously in the same figure (as opposed to making separate data frames for each condition, then passing each data frame separately to a function).

Author(s)

Travis Moore

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
# Importing data for a condition named "Neutral" (file names: "Sub1_Neutral.txt",
"Sub2_Neutral.txt", etc.)
neutral <- load.data(path = "/Users/Username/Folder/", condition = "Neutral",
num.subs = 20, epoch.st = -200, epoch.end = 899, header = FALSE)

# Adding imported data named "positive" to the imported "neutral" data
combo <- rbind.data.frame(neutral, positive)

## End(Not run)

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.