Description Usage Arguments Details Value Note Author(s) Examples
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:
each electrode must be a separate column
voltages at each time point should be listed under the appropriate electrode column as rows
no other data should be present in the raw data file (e.g., subject, condition, time, etc.)
1 2 |
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, |
See also easy.load
for a more user-friendly way to
generate the appropriate code.
Name each individual file following the format mentioned above (e.g., SS34_Positive.txt).
load.data
will ignore all text preceding the "_", and treat all text following the "_"
as the condition
, (e.g., Positive). Use only one "_" in the file name (i.e., to separate
your own naming convention from the condition
); using multiple "_" characters will lead to
faulty importing of data. The erp.easy convention for subjects is a capital "S" followed by the
number corresponding to the order in which the file was loaded (e.g., S1, S2, etc.). Subjects will
be loaded into the "Subject" column of the returned data frame.
If no header is present in the ERP files, one will be supplied, using the standard R convention of a capital "V" followed by increasing integers (e.g., V1, V2, V3). Use these automatically assigned column name values to refer to the electrodes (unless a header is provided in the raw data file).
Enter the starting time of the baseline, if present in your individual files, in
epoch.st
(e.g., -200).
Once the desired data frames have been loaded, they can be exported as a number of different file types.
The sample rate will be calculated for you, based on the starting (epoch.st
)
and ending (epoch.end
) time points of the recording epoch and the number of time
points in a given condition (the number of rows in your file for each condition).
A single, concatenated data frame of all electrode data for all subjects organized into columns, with three added columns:
"Subject" containing repeating subject names
"Stimulus" containing repeating condition names (e.g., Neutral)
"Time" containing a repeating list of timepoints sampled
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).
Travis Moore
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.