create electrode region of interests

Description

An utility function to create a factor that collapses other factor levels (typically electrode names) in a new variable vector with the new ROI (region of interest) variable. It can be used only with data.frame in long format.

Usage

1
create.roi(datall, electrode="electrode", groups=NULL, roi.levels=NULL )

Arguments

datall

a data frame containing ERP data in long format.

electrode

name of the column in datall containing electrode names.

groups

a list containing (in separate vectors) electrode names to create the ROI.
E.g. list(c("Fp1", "Fp2"), c("P3", "P4")).

roi.levels

a vector with the names of the newly created factor variable.
E.g. c("Frontopolar", "Parietal").

Details

All levels of the variable electrode that are not specified in groups will be coded as NA in the returned vector.

Value

The function returns a vector with the new coded ROI variable.

Author(s)

Giorgio Arcara

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
data(ERPsets)

datall=erp.mean(base = "Exp1_word_subj", numbers = 1:20,
 win.ini = 400, win.end = 600, startmsec= -200, endmsec=1500, erplist=ERPsets)

datall$caudality=create.roi(datall, "electrode", 
groups=list(c("Fp1", "Fp2"), c("P3", "P4")), 
roi.levels=c("Frontopolar", "Parietal"))

table(datall$caudality, datall$electrode)
	

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.