load.data: Import your ERP data files.

Description Usage Arguments Details Value Note Author(s) Examples

View source: R/Load.R

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
2
load.data(path, condition, num.subs, epoch.st, epoch.end, bsln.cor = "n",
  header = FALSE)

Arguments

path

The folder path containing your ERP files

condition

In quotes, a string indicating which trial type to be imported (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 (typically final time point - 1)

bsln.cor

If "y", applies baseline correction to the imported data. Baseline correction is achieved by subtracting the mean voltage prior to 0 ms on a channel- by-channel basis.

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

See also easy.load for a more user-friendly way to generate the appropriate code.

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)

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

Search within the erp.easy package
Search all R packages, documentation and source code