library(ERP);require(mnormt);require(fdrtool);library(ggplot2);library(dplyr);library(gridExtra)
library(erpR);require(akima);library(reshape2);library(boot);library(plotly);library(ggmap);library(SCBmeanfd)
data(ERPsets)
load("ERPdata.RData")
###list2data
list_to_df <- function(list_data,frames){
# some check function
for (i in 1:length(list_data)){
list_data[[i]]$frames <-frames
list_data[[i]]$list.name <- names(list_data)[i]
}
Data_list <- lapply(list_data,melt,id=c("frames","list.name"))
Data_list <- lapply(Data_list,reshape,
timevar = "frames",idvar = c("variable","list.name"),
direction = "wide")
Ana_data <- Data_list[[1]]
for (i in 2:length(ERPsets)){
Ana_data <- rbind(Ana_data,Data_list[[i]])
}
colnames(Ana_data)[2] <- "Channel"
rownames(Ana_data) <- 1:dim(Ana_data)[1]
return(Ana_data)
}
ERP_df <- list_to_df(list_data=ERPsets, # input list_data
frames= 1:426) # input frames
ERP_df <- AddExpCondSub(data = ERP_df, # input the transformed data
list.name_col = 1) # list.name column
#ERP_df <- ERP_df[,-1] # remove list name column, Depend on user's need
head(ERP_df[,c(1:3,427:430)],3) # look at the data
list.name Channel value.1 value.425 value.426 Experiment
1 Exp1_word_subj1 Fp1 0.36995740 14.160980 9.971283 Exp1
2 Exp1_word_subj1 Fp2 -0.02759907 13.750350 9.678596 Exp1
3 Exp1_word_subj1 F3 0.42971300 6.269233 4.413941 Exp1
Condition
1 word
2 word
3 word
data_select <- function(data,frames,datacol,subjcol=NULL,chancol=NULL,othvarcol=NULL,
select_subj=NULL,
select_chan=NULL,...){
# some check function
subj_select <- function(data,frames,datacol,subjcol,chancol=NULL,othvarcol=NULL,
select_subj,...){
dta <- data
num <- length(select_subj)
data_list <- list()
for (i in 1:num){
data_new <- subset(dta,dta[,subjcol]==select_subj[i])
data_list[[i]] <- data_new
}
data_select <- data_list[[1]]
if (num != 1) {
for (i in 2:num) {
data_select <- rbind(data_select,data_list[[i]])
}
}
data_select <- data_select[order(data_select[,subjcol]),]
rownames(data_select) <- 1:dim(data_select)[1]
return (data_select)
}
chan_select <- function(data,frames,datacol,subjcol=NULL,chancol,othvarcol=NULL,
select_chan,...){
dta <- data
num <- length(select_chan)
data_list <- list()
for (i in 1:num){
data_new <- subset(dta,dta[,chancol]==select_chan[i])
data_list[[i]] <- data_new
}
data_select <- data_list[[1]]
if (num != 1){
for (i in 2:num){
data_select <- rbind(data_select,data_list[[i]])
}
}
#data_select <- data_select[order(data_select[,subjcol]),]
rownames(data_select) <- 1:dim(data_select)[1]
return (data_select)
}
joint_select <- function(data,frames,datacol,subjcol,chancol,othvarcol=NULL,
select_subj,
select_chan,...){
dta <- data
ind_data <- subj_select(dta,frames,datacol,subjcol,chancol,othvarcol,
select_subj = select_subj)
ind_ele_data <- chan_select(ind_data,frames,datacol,subjcol,chancol,othvarcol,
select_chan = select_chan)
ind_ele_data <- ind_ele_data[order(ind_ele_data[,subjcol]),]
rownames(ind_ele_data) <- 1 :dim(ind_ele_data)[1]
return(ind_ele_data)
}
if (is.null(select_subj)==FALSE & is.null(select_chan)==FALSE){
dta <- joint_select(data = data,frames = frames,
datacol,subjcol,chancol,othvarcol,
select_subj=select_subj,
select_chan=select_chan)
} else if (is.null(select_subj)==FALSE & is.null(select_chan)== TRUE) {
dta <- subj_select(data=data,frames=frames,
datacol,subjcol,chancol,othvarcol,
select_subj=select_subj)
} else if (is.null(select_chan)==FALSE & is.null(select_subj)== TRUE) {
dta <- chan_select(data,frames,
datacol,subjcol,chancol,othvarcol,
select_chan=select_chan)
} else {
dta <- data
}
### remain as factor problem
return(dta)
}
# Subject 1 don't want to be processed in the study
dta1 <- data_select(data = ERPdata,
frames = 1:426,
datacol = 2:427,
subjcol = 430,
chancol = 1,
othvarcol = c(428:429,431:432),
select_subj = c(paste("subj",seq(2,20),sep="")), # subject 1 kick out ?
select_chan=c("T3","T4","P3","P4"))
head(dta1[,c(1:3,426:432)])
## Channel value.1 value.2 value.425 value.426 Experiment Condition
## 1 T3 0.57489760 0.48456870 8.310769 5.841200 Exp1 nonword
## 2 T3 1.33823900 1.51385800 9.254281 6.510309 Exp1 word
## 3 T4 -0.09975457 -0.22743520 16.568830 11.653980 Exp1 nonword
## 4 T4 2.40591700 2.88414000 10.910920 7.684408 Exp1 word
## 5 P3 0.11640080 -0.08791288 14.946770 10.512290 Exp1 nonword
## 6 P3 1.55994200 1.98808000 9.814218 6.912074 Exp1 word
## Subject AveRT IQ
## 1 subj10 0.2578423 68
## 2 subj10 0.2954770 68
## 3 subj10 0.2578423 68
## 4 subj10 0.2954770 68
## 5 subj10 0.2578423 68
## 6 subj10 0.2954770 68
data_summarize <- function(data,frames,datacol,subjcol=NULL,chancol=NULL,othvarcol=NULL,
summarycol,
fun=mean,
select_subj=NULL,
select_chan=NULL,...){
#some check function
options(warn=-1) # should close the warnings?
# selection
dta <- data_select(data,frames,datacol,subjcol,chancol,othvarcol,
select_subj,
select_chan)
# process
agglength <- length(summarycol)
aggvar_list <- list(dta[,summarycol[1]])
if (agglength > 1){
for (i in 2:agglength ){
aggvar_list <- append(aggvar_list,list(dta[,summarycol[i]]))
}
}
aggdata <- aggregate(dta[,datacol],by=aggvar_list,
fun,...)
aggdata <- aggdata[,1:(agglength+length(datacol))]
for (i in 1: agglength){
colnames(aggdata)[i] <- colnames(dta)[summarycol[i]]
}
rownames(aggdata) <- 1:dim(aggdata)[1]
return(aggdata)
}
A <-data_summarize (data = ERPdata,
frames = 1:426,
datacol = 2:427,
#you could put all elements you want to aggregate in datacol argument
subjcol = 430,
chancol = 1,
othvarcol = c(428:429,431:432),
summarycol= c(1,429),
fun=median,
# could also select data
select_chan = c("CZ","Fp1"),
select_subj = c("subj1","subj10"))
tail(A[,1:6]);dim(A)
Channel Condition value.1 value.2 value.3 value.4
1 Fp1 nonword -1.4049110 -1.9667935 -1.7905150 -1.7634650
2 CZ nonword -1.8309385 -2.4948925 -2.1159490 -1.9471855
3 Fp1 word 0.4695684 0.1779768 -0.5842498 -0.9740931
4 CZ word 0.8391661 0.8317206 0.2696740 0.1090901
[1] 4 428
downsample <- function(data,
datacol,
binwidth=10,
movinginterval=NULL) {
if (is.null(movinginterval) == FALSE) {
if (movinginterval >= binwidth){stop("movinginterval should not bigger than binwidth!")}
dta <- data
dta_signal <- dta[,datacol]
dta_othvar <- dta[,-datacol]
num1 <- (dim(dta_signal)[2] - (dim(dta_signal)[2] %% binwidth)) /binwidth
num2 <- dim(dta_signal)[2] %% binwidth
dta_downsample <- data.frame(melt(apply(dta_signal[,1:binwidth],1,mean)))
i = movinginterval - 1
while ((binwidth+i) <= dim(dta_signal)[2]){
dta_downsample <- cbind(dta_downsample,melt(apply(dta_signal[,(1+i):(binwidth+i)],1,mean)))
i = i + movinginterval -1
}
if (num2 >= 1) {
dta_downsample <- cbind(dta_downsample,
value=melt(apply(dta_signal[,(1+i):dim(dta_signal)[2]],1,mean)))
}
colnames(dta_downsample) <- paste("value",1:dim(dta_downsample)[2],sep=".")
dta_final <- cbind(dta_othvar,dta_downsample)
} else {
dta <- data
dta_signal <- dta[,datacol]
dta_othvar <- dta[,-datacol]
num1 <- (dim(dta_signal)[2] - (dim(dta_signal)[2] %% binwidth))/binwidth
num2 <- dim(dta_signal)[2] %% binwidth
dta_downsample <- data.frame(melt(apply(dta_signal[,1:binwidth],1,mean)))
for (i in 1 : num1-1){
dta_downsample <- cbind(dta_downsample,
melt(apply(dta_signal[,(i*binwidth+1):((i+1)*binwidth)],
1,mean)))
}
if (num2 == 1) {
dta_downsample <- cbind(dta_downsample,
value=dta_signal[,(num1*binwidth+num2)])
###### notice
}
if (num2 > 1) {
dta_downsample <- cbind(dta_downsample,
melt(apply(dta_signal[,(num1*binwidth+1):(num1*binwidth+num2)],
1,mean)))
}
dta_downsample <- dta_downsample[,-1]
colnames(dta_downsample) <- paste("value",1:dim(dta_downsample)[2],sep=".")
dta_final <- cbind(dta_othvar,dta_downsample)
}
return(dta_final)
}
down1 <- downsample(data = ERPdata,
datacol = 2:427,
binwidth = 10,
movinginterval=NULL)
down2 <- downsample(data = ERPdata,
datacol = 2:427,
binwidth = 10,
movinginterval=9) # movinginterval shoud not bigger than binwidth
dim(down1) ; dim(down2)
[1] 1360 49
[1] 1360 60
# group comparison please put in data after aggregate_raw
edaplot <- function(data,frames=NULL,datacol,subjcol=NULL,chancol=NULL,othvarcol=NULL,
outlinesub=NULL,outcolor="red",
select_subj=c(NULL),
select_chan=c(NULL),...){
#some check functions
#if (is.null(frames) == FALSE)
# if (length(frames) != (ncol(data)-1-length(othvarcol)))
# stop(paste("frames should be either null or of length",
# (ncol(data)-1-length(othvarcol))))
#if (is.null(frames) == FALSE) {
# if (any(frames != sort(frames)))
# stop("frames should be an ascending sequence of integers")
# }
#if (is.null(frames))
# frames = 1:(ncol(data)-1-length(othvarcol))
#selection
dta <- data_select(data,frames,datacol,subjcol,chancol,othvarcol,
select_subj,
select_chan,...)
# plot
subvar <- variable.names(dta)[subjcol]
#dta$groupvar <- rownames(dta)
#########
dta$Info <- NA
for (i in 1 : dim(dta)[1]){
info1 <- paste0(as.character(dta[i,othvarcol]),collapse=";")
dta$Info[i] <- paste(dta[i,chancol],dta[i,subjcol],info1,sep=";")
}
###########
datalong <- melt(dta,
id=c(variable.names(dta)[c(subjcol,chancol,othvarcol)],
"Info"))
datalong <- datalong[order(datalong$Info),]
datalongorder <- datalong
datalongorder$frames <- rep(frames,length(datalongorder[,1])/length(frames))
if (is.null(outlinesub) == FALSE){ # how to outline several subjects (and color)
data2 <- subset(datalongorder,datalongorder[,1]==outlinesub)
plot <- ggplot(datalongorder,
aes(x=frames,y=value,group=Info,...))+
geom_line()+
geom_line(data=data2,aes(x=frames,y=value),col=outcolor)
# need warning for covering geom_line()
} else {
plot <- ggplot(datalongorder,
aes(x=frames,y=value,group=Info))+
geom_line()
}
return(plot)
}
#Although Full data (all trials) work fine, I recommened that the argument erpdata should be a single subject data or an aggregate data.
edaplot(ERPdata,
frames = 1:426,
datacol=2:427,
subjcol=430,
chancol=1,
othvarcol=c(428:429,431:432),
# choose the subject you want to show(optional)
select_sub = c("subj9","subj1","subj5","subj8"),
# choose the channel you want to show(optional)
select_chan = c("F3","F4"))+
facet_grid(Channel~Condition)
#ggplotly(s1)
edaplot(ERPdata,
frames = 1:426,
datacol=2:427,
subjcol=430,
chancol=1,
othvarcol=c(428:429,431:432),
# choose the subject you want to show(optional)
select_sub = c("subj9","subj1","subj5","subj8"),
# choose the channel you want to show(optional)
select_chan = c("F3","F4"),
# highlight a single subject with the color you want
outlinesub="subj9",outcolor = "blue")+
facet_grid(Channel~Condition)
edaplot(ERPdata,
frames=1:426,
datacol = 2:427,subjcol=430,chancol=1,othvarcol=c(428:429,431:432),
select_chan = c("F3","F4","CZ"),
select_sub = c("subj9","subj1","subj5","subj8"))+
# One subject one color
geom_line(aes(col=Subject))+ # will cover outline sub
facet_grid(Condition~Channel)
edaplot(ERPdata,
frames=1:426,
datacol = 2:427,subjcol=430,chancol=1,othvarcol=c(428:429,431:432),
select_chan = c("F3","F4","CZ"))+
# Color depend on IQ (Size , alpha either)
geom_line(aes(col=IQ,alpha=Channel,size=Condition))+
facet_grid(Condition~Channel)
edaplot(ERPdata,
frames=1:426,
datacol = 2:427,subjcol=430,chancol=1,othvarcol=c(428:429,431:432),
select_chan = c("F3","F4","CZ"))+
# One Condition one color
geom_line(aes(col=Condition))+
facet_grid(.~Channel)
edaplot(ERPdata,
frames=1:426,
datacol = 2:427,subjcol=430,chancol=1,othvarcol=c(428:429,431:432),
select_chan = c("F3","F4","CZ"))+
# One Condition one color
geom_line(aes(col=Condition))+
facet_grid(.~Channel)+
scale_colour_manual(values=c("red","blue"),name="Cond",label=c("A","B"))
edaplot(ERPdata,
frames=1:426,
datacol = 2:427,subjcol=430,chancol=1,othvarcol=c(428:429,431:432),
select_chan = c("F3","F4","CZ"))+
geom_line(aes(col=Condition))+
facet_grid(Condition~Channel)
edaplot(ERPdata,
frames=1:426,
datacol = 2:427,subjcol=430,chancol=1,othvarcol=c(428:429,431:432),
select_chan = c("F3","F4","CZ"))+
geom_line(aes(col=Condition))+
facet_grid(Condition~Channel)+
# put on the summary line NOTE: need a group=NULL argument
stat_summary(aes(group=NULL),fun.y = "mean",
colour = "purple", size = 0.5, geom = "line")
edaplot(ERPdata,
frames=1:426,
datacol = 2:427,subjcol=430,chancol=1,othvarcol=c(428:429,431:432),
select_chan = c("F3","F4","CZ"))+
geom_line(aes(col=Condition))+
facet_grid(Condition~Channel)+
theme_bw()+
theme(legend.position="top")+
xlim(-100,500)+
ylim(-50,50)+
labs(list(title = "Flexible",x="time",y="signal"))+
geom_vline(xintercept = c(0,213,426),col="yellow")
ciplot <- function(data,frames,datacol,subjcol=NULL,chancol=NULL,othvarcol=NULL,
cpvarcol=NULL, signal_line_col="black",
# general argument
level = 0.95,
ci.alpha = 0.3,
# select type
type = "boot", # or "scb"
# choose scb
cv.degree,
cv.interval = NULL,
scbtype = "normal", # or "bootstrap"
# choose boot
fun=samplemean <- function(x, d){return(mean(x[d]))},
bootnum=500,
# data_selection
select_subj = NULL,
select_chan = NULL,...){
# need some check function
# data selection
dta <- data_select(data,frames,datacol,subjcol,chancol,othvarcol,
select_subj,
select_chan,...)
if (!is.null(cpvarcol)){dta[,cpvarcol] = as.factor(as.character(dta[,cpvarcol]))}
if (! type %in% c("boot","scb"))
stop("type should be 'boot' or 'scb' !")
if (type == "scb"){
if (! scbtype %in% c("normal", "bootstrap")){stop("scbtype should be 'normal' or 'bootstrap'")}
if (is.null(cpvarcol)){
dtalist <- list()
for (i in 1:length(levels(dta[,chancol]))){
dtachan <- subset( dta,dta[,chancol] == levels(dta[,chancol])[i])
h <- cv.select(frames,dtachan[,datacol],
degree = cv.degree, interval = cv.interval)
scbchan <- scb.mean(frames, dtachan[,datacol],
bandwidth = h, level = level,
scbtype = scbtype,...)
dtalist[[i]] <- data.frame(FUN = scbchan$nonpar)
if (scbtype == "bootstrap"){
dtalist[[i]]$Q1 <- scbchan$bootscb[,1]
dtalist[[i]]$Q2 <- scbchan$bootscb[,2]
}
if (scbtype == "normal"){
dtalist[[i]]$Q1 <- scbchan$normscb[,1]
dtalist[[i]]$Q2 <- scbchan$normscb[,2]
}
dtalist[[i]]$Channel <- levels(dta[,chancol])[i]
dtalist[[i]]$frames <- frames
}
plotdata <- dtalist[[1]]
for (i in 2:length(dtalist)){plotdata <- rbind(plotdata,dtalist[[i]])}
plot <- ggplot(plotdata,aes(x=frames))+
geom_ribbon(aes(x=frames, ymax=Q2, ymin=Q1),
fill=signal_line_col,alpha=ci.alpha)+ # set alpha
geom_line(aes(y = FUN),col=signal_line_col)+
labs(y="Signal")+# Need some changes ?
facet_wrap(~Channel)+
theme(legend.position="none")
} else {
dtalist <- list()
for (i in 1:length(levels(dta[,chancol]))){
dtacplist <- list()
for (j in 1 : length(levels(dta[,cpvarcol]))){
dtachan <- subset(dta,
dta[,chancol] == levels(dta[,chancol])[i] & dta[,cpvarcol] == levels(dta[,cpvarcol])[j])
h <- cv.select(frames,dtachan[,datacol],
degree = cv.degree, interval = cv.interval)
scbchan <- scb.mean(frames, dtachan[,datacol],
bandwidth = h, level = level,
scbtype = scbtype)
dtacplist[[j]] <- data.frame(FUN = scbchan$nonpar)
if (scbtype == "bootstrap"){
dtacplist[[j]]$Q1 <- scbchan$bootscb[,1]
dtacplist[[j]]$Q2 <- scbchan$bootscb[,2]
}
if (scbtype == "normal"){
dtacplist[[j]]$Q1 <- scbchan$normscb[,1]
dtacplist[[j]]$Q2 <- scbchan$normscb[,2]
}
dtacplist[[j]]$Channel <- levels(dta[,chancol])[i]
dtacplist[[j]]$frames <- frames
dtacplist[[j]]$Condition <- levels(dta[,cpvarcol])[j]
}
dtalist[[i]] <- dtacplist[[1]]
for (k in 2:length(dtacplist)){dtalist[[i]] <- rbind(dtalist[[i]],dtacplist[[k]])}
}
plotdata <- dtalist[[1]]
for (i in 2:length(dtalist)){plotdata <- rbind(plotdata,dtalist[[i]])}
plot <- ggplot(plotdata,aes(x=frames,group=Condition))+
geom_ribbon(aes(x=frames, ymax=Q2, ymin=Q1,fill=Condition),
alpha=0.5)+ # set alpha
geom_line(aes(y = FUN,col=Condition))+
labs(y="Signal")+# Need some changes ?
facet_wrap(~Channel)+
scale_color_manual(values = c("red","blue"),name = colnames(dta)[cpvarcol])+
scale_fill_manual(values = c("red","blue"),name = colnames(dta)[cpvarcol])
}
} else {
bootstrap <- function(x,bootnum,bootfun,bootintval,quantilenum,...){
boot_result <- boot(x,statistic = bootfun,R = bootnum,...) #fun
return(quantile(boot_result$t,bootintval,na.rm = T)[quantilenum])
}
bootintval <- c((0.5-level/2),(level/2+0.5))
bootalpha <- ci.alpha
# Do you want to compare between variable ?
if (is.null(cpvarcol)==TRUE){
data_fun <- data_summarize(dta,frames,datacol,subjcol,chancol,othvarcol,
summarycol = c(chancol),fun=fun)
data_Q1 <- data_summarize(dta,frames,datacol,subjcol,chancol,othvarcol,
summarycol = c(chancol),
fun=bootstrap,bootnum=bootnum,bootfun=fun,
bootintval=bootintval,quantilenum=1)
data_Q2 <- data_summarize(dta,frames,datacol,subjcol,chancol,othvarcol,
summarycol = c(chancol),
fun=bootstrap,bootnum=bootnum,bootfun=fun,
bootintval=bootintval,quantilenum=2)
data_fun_long <- melt(data_fun,id=c(colnames(dta)[chancol]))
data_fun_long <- data_fun_long[order(data_fun_long[,1],
data_fun_long[,2],
data_fun_long[,3]),]
colnames(data_fun_long)[3] <- "FUN"
data_Q1_long <- melt(data_Q1,id=c(colnames(dta)[chancol]))
data_Q1_long <- data_Q1_long[order(data_Q1_long[,1],
data_Q1_long[,2],
data_Q1_long[,3]),]
data_Q2_long <- melt(data_Q2,id=c(colnames(dta)[chancol]))
data_Q2_long <- data_Q2_long[order(data_Q2_long[,1],
data_Q2_long[,2],
data_Q2_long[,3]),]
data_fun_long$Q1 <- data_Q1_long[,3]
data_fun_long$Q2 <- data_Q2_long[,3]
data_fun_long$frames <- c(rep(frames,(dim(data_fun_long)[1]/length(frames)))) #change
colnames(data_fun_long)[1] <- c("Channel")
plot <- ggplot(data_fun_long,aes(x=frames))+
geom_ribbon(aes(x=frames, ymax=Q2, ymin=Q1),
fill=signal_line_col,
alpha=bootalpha)+
geom_line(aes(y = FUN),
col=signal_line_col)+
labs(y="Signal")+# Need some changes ?
facet_wrap(~Channel)+
theme(legend.position="none")
} else {
dta[,cpvarcol] <- as.factor(dta[,cpvarcol])
dta[,chancol] <- as.factor(dta[,chancol])
data_fun <- data_summarize(dta,frames,datacol,subjcol,chancol,othvarcol,
summarycol = c(chancol,cpvarcol),fun=fun)
data_Q1 <- data_summarize(dta,frames,datacol,subjcol,chancol,othvarcol,
summarycol = c(chancol,cpvarcol),
fun=bootstrap,bootnum=bootnum,bootfun=fun,
bootintval=bootintval,quantilenum=1)
data_Q2 <- data_summarize(dta,frames,datacol,subjcol,chancol,othvarcol,
summarycol = c(chancol,cpvarcol),
fun=bootstrap,bootnum=bootnum,bootfun=fun,
bootintval=bootintval,quantilenum=2)
data_fun_long <- melt(data_fun,id=c(colnames(dta)[chancol],colnames(dta)[cpvarcol]))
data_fun_long <- data_fun_long[order(data_fun_long[,1],
data_fun_long[,2],
data_fun_long[,3]),]
colnames(data_fun_long)[4] <- "FUN"
data_Q1_long <- melt(data_Q1,id=c(colnames(dta)[chancol],colnames(dta)[cpvarcol]))
data_Q1_long <- data_Q1_long[order(data_Q1_long[,1],
data_Q1_long[,2],
data_Q1_long[,3]),]
data_Q2_long <- melt(data_Q2,id=c(colnames(dta)[chancol],colnames(dta)[cpvarcol]))
data_Q2_long <- data_Q2_long[order(data_Q2_long[,1],
data_Q2_long[,2],
data_Q2_long[,3]),]
data_fun_long$Q1 <- data_Q1_long[,4]
data_fun_long$Q2 <- data_Q2_long[,4]
data_fun_long$frames <- c(rep(frames,(dim(data_fun_long)[1]/length(frames))))
colnames(data_fun_long)[1:2] <- c("Channel","Condition")
plot <- ggplot(data_fun_long,aes(x=frames,group=Condition))+
geom_ribbon(aes(x=frames, ymax=Q2, ymin=Q1,fill=Condition),
alpha=bootalpha)+
geom_line(aes(y = FUN,col=Condition))+
labs(y="Signal")+# Need some changes ?
facet_wrap(~Channel)
}
}
return(plot)
}
ciplot(readRDS("NIRS_tutorial.Rdata"), # input the data
frames=seq(-2,14.96,by=0.16),
datacol=5:111, subjcol=1, chancol=2, othvarcol=3:4, cpvarcol = 3 ,
#signal_line_col = "blue",
level = 0.95,
ci.alpha = 0.3,
type = "scb",
cv.degree=2,
cv.interval = c(0.5,1),
scbtype = "bootstrap")
##########################
ciplot <- function(data,frames,datacol,subjcol=NULL,chancol=NULL,othvarcol=NULL,
cpvarcol=NULL, signal_line_col="black",
fun=samplemean <- function(x, d){return(mean(x[d]))}, # very unfriendly setting
bootnum=500,
bootintval=c(.025,.975),
bootalpha=0.3,
select_subj = NULL,
select_chan = NULL,...){
# need some check function
bootstrap <- function(x,bootnum,bootfun,bootintval=c(0.025,0.975),quantilenum,...){
boot_result <- boot(x,statistic = bootfun,R = bootnum,...) #fun
return(quantile(boot_result$t,bootintval,na.rm = T)[quantilenum])
}
# data selection
dta <- data_select(data,frames,datacol,subjcol,chancol,othvarcol,
select_subj,
select_chan,...)
# Do you want to compare between variable ?
if (is.null(cpvarcol)==TRUE){
data_fun <- data_summarize(dta,frames,datacol,subjcol,chancol,othvarcol,
summarycol = c(chancol),fun=fun)
data_Q1 <- data_summarize(dta,frames,datacol,subjcol,chancol,othvarcol,
summarycol = c(chancol),
fun=bootstrap,bootnum=bootnum,bootfun=fun,
bootintval=bootintval,quantilenum=1)
data_Q2 <- data_summarize(dta,frames,datacol,subjcol,chancol,othvarcol,
summarycol = c(chancol),
fun=bootstrap,bootnum=bootnum,bootfun=fun,
bootintval=bootintval,quantilenum=2)
data_fun_long <- melt(data_fun,id=c(colnames(dta)[chancol]))
data_fun_long <- data_fun_long[order(data_fun_long[,1],
data_fun_long[,2],
data_fun_long[,3]),]
colnames(data_fun_long)[3] <- "FUN"
data_Q1_long <- melt(data_Q1,id=c(colnames(dta)[chancol]))
data_Q1_long <- data_Q1_long[order(data_Q1_long[,1],
data_Q1_long[,2],
data_Q1_long[,3]),]
data_Q2_long <- melt(data_Q2,id=c(colnames(dta)[chancol]))
data_Q2_long <- data_Q2_long[order(data_Q2_long[,1],
data_Q2_long[,2],
data_Q2_long[,3]),]
data_fun_long$Q1 <- data_Q1_long[,3]
data_fun_long$Q2 <- data_Q2_long[,3]
data_fun_long$frames <- c(rep(frames,(dim(data_fun_long)[1]/length(frames)))) #change
colnames(data_fun_long)[1] <- c("Channel")
plot <- ggplot(data_fun_long,aes(x=frames))+
geom_ribbon(aes(x=frames, ymax=Q2, ymin=Q1),
fill=signal_line_col,
alpha=bootalpha)+
geom_line(aes(y = FUN),
col=signal_line_col)+
labs(y="Signal")+# Need some changes ?
facet_wrap(~Channel)+
theme(legend.position="none")
} else {
dta[,cpvarcol] <- as.factor(dta[,cpvarcol])
dta[,chancol] <- as.factor(dta[,chancol])
data_fun <- data_summarize(dta,frames,datacol,subjcol,chancol,othvarcol,
summarycol = c(chancol,cpvarcol),fun=fun)
data_Q1 <- data_summarize(dta,frames,datacol,subjcol,chancol,othvarcol,
summarycol = c(chancol,cpvarcol),
fun=bootstrap,bootnum=bootnum,bootfun=fun,
bootintval=bootintval,quantilenum=1)
data_Q2 <- data_summarize(dta,frames,datacol,subjcol,chancol,othvarcol,
summarycol = c(chancol,cpvarcol),
fun=bootstrap,bootnum=bootnum,bootfun=fun,
bootintval=bootintval,quantilenum=2)
data_fun_long <- melt(data_fun,id=c(colnames(dta)[chancol],colnames(dta)[cpvarcol]))
data_fun_long <- data_fun_long[order(data_fun_long[,1],
data_fun_long[,2],
data_fun_long[,3]),]
colnames(data_fun_long)[4] <- "FUN"
data_Q1_long <- melt(data_Q1,id=c(colnames(dta)[chancol],colnames(dta)[cpvarcol]))
data_Q1_long <- data_Q1_long[order(data_Q1_long[,1],
data_Q1_long[,2],
data_Q1_long[,3]),]
data_Q2_long <- melt(data_Q2,id=c(colnames(dta)[chancol],colnames(dta)[cpvarcol]))
data_Q2_long <- data_Q2_long[order(data_Q2_long[,1],
data_Q2_long[,2],
data_Q2_long[,3]),]
data_fun_long$Q1 <- data_Q1_long[,4]
data_fun_long$Q2 <- data_Q2_long[,4]
data_fun_long$frames <- c(rep(frames,(dim(data_fun_long)[1]/length(frames))))
colnames(data_fun_long)[1:2] <- c("Channel","Condition")
plot <- ggplot(data_fun_long,aes(x=frames,group=Condition))+
geom_ribbon(aes(x=frames, ymax=Q2, ymin=Q1,fill=Condition),
alpha=bootalpha)+
geom_line(aes(y = FUN,col=Condition))+
labs(y="Signal")+# Need some changes ?
facet_wrap(~Channel)
}
return(plot)
}
ciplot(ERPdata, # input the data
frames=1:426,
datacol=2:427,
subjcol=430,
chancol=1,
othvarcol=c(428:429,431:432),
# Important : the column of that single variable you want to compare
# and if (NULL) the function will return a single line and interval
cpvarcol = NULL ,
signal_line_col = "blue", # work if cpvarcol = NULL
# boot package
fun=samplemean <- function(x, d){return(mean(x[d]))}, # the function use to draw boot interval and line
bootnum=300, # bootsraping number
bootintval=c(.025,.975), # bootstrap confidence interval
bootalpha=0.5,# the value of alpha on the plot
#sim = "parametric", # other setting in "boot package"
# Data selection
select_chan = c("Fp1","Fp2"))+ # select data
#select_subj = c("subj1","subj2","subj3","subj10"))+
#other setting in ggplot2
ylim(-5,5)
ciplot(ERPdata, # input the data
frames=1:426,
datacol=2:427,
subjcol=430,
chancol=1,
othvarcol=c(428:429,431:432),
# have cpvarcol
cpvarcol = 429 ,
#signal_line_col = "blue",
fun=samplemean <- function(x, d){return(mean(x[d]))},
bootnum=300,
bootintval=c(.025,.975),
bootalpha=0.5)+
ylim(-10,10)+
#other setting in ggplot2
scale_fill_manual(values=c("red","blue"),name="Word or Non Word",label=c("No","Yes"))+
scale_colour_manual(values=c("red","blue"),name="Word or Non Word",label=c("No","Yes"))+
theme(legend.position = "bottom")
chan_test <- function(data,datacol,chancol,
testtype="erpfatest",
# do not specify model.matrix like original test function###
design_model,
# do not specify model.matrix like original test function
design0_model=NULL,...){
dta <- data
dta[,chancol]=as.factor(dta[,chancol])
levelnum <- length(levels(dta[,chancol]))
if (levelnum == 1) {
design <- model.matrix(design_model,data=data)
if (is.null(design0_model)==F){
design0 <- model.matrix(design0_model,data=data)
}
if ( testtype == "erpavetest" ){
test_list <- erpavetest(dta[,datacol],design,design0,...)
}
if (testtype == "erpfatest") {
test_list <- erpfatest(dta[,datacol],design,design0,...)
}
if (testtype == "erptest") {
test_list <- erptest(dta[,datacol], design, design0,...)
}
if (testtype == "gbtest") {
test_list <- gbtest(dta[,datacol], design, design0,...)
}
} else {
test_list=list()
dta_list=list()
for (i in 1:levelnum) {
dta_list[[i]] <- subset(dta,dta[,chancol]==(levels(dta[,chancol])[i]))
design <- model.matrix(design_model,data=dta_list[[i]])
if (is.null(design0_model)==F){
design0 <- model.matrix(design0_model,data=dta_list[[i]])
}
if ( testtype == "erpavetest" ){
test_list[[i]] <- erpavetest(dta_list[[i]][,datacol],
design,design0,...)
}
if (testtype == "erpfatest") {
test_list[[i]] <- erpfatest(dta_list[[i]][,datacol],
design,design0,...)
}
if (testtype == "erptest") {
test_list[[i]] <- erptest(dta_list[[i]][,datacol],
design, design0,...)
}
if (testtype == "gbtest") {
test_list[[i]] <- gbtest(dta_list[[i]][,datacol],
design, design0,...)
}
names(test_list)[i] <- levels(dta[,chancol])[i]
}
}
return(test_list)
}
ERP_test <- chan_test(ERPdata,2:427,chancol=1,testtype="erpfatest",
design_model=(~Subject+Condition), # do not specify "model.matrix" like original test function
design0_model=(~Subject)) # do not specify "model.matrix" like original test function
# other seeting in ERP package
mcplot <- function(tests_rst,
type = "test", # type = "test" or "signal"
multi = F, # IMPORTANT : depend on your tests rst
# IMPORTANT : Work only if type = test
cor = FALSE,
# IMPORTANT : depend on your tests rst and data
data,frames,datacol,subjcol=NULL,chancol=NULL,othvarcol=NULL,cpvarcol=NULL,
significant_col = "pink" , significant_alpha = 0.2,
# IMPORTANT : work only if type = signal
wantbootplot = FALSE,
fun = samplemean <- function(x, d){return(mean(x[d]))},
bootnum = 10,
bootintval = c(.025,.975),
bootalpha = 0.3 ) {
options(warn=-1)
# some check functions
if (type == "test") {
if (multi==FALSE){
data <- data.frame(signal=as.numeric(tests_rst$signal))
data$frames = frames
data$significant <-
ifelse(data$frames %in% data$frames[tests_rst$significant],
"sig","non-sig")
data$sign_frames <-
ifelse(data$frames %in% data$frames[tests_rst$significant],
data$frames,NA)
data$group <- rep(0,length(data$signal))
data$r2 <- tests_rst$r2
if (cor == TRUE){
plot <- ggplot(data,
aes(x=frames,y=sign(signal)*sqrt(r2),group=group))+
geom_vline(data=data,
aes(xintercept = sign_frames,
col=significant_col),
alpha=significant_alpha)+
geom_line()+
labs(y = "Correlation")+
theme(legend.position="none")
} else {
plot <- ggplot(data,aes(x=frames,y=signal,group=group))+
geom_vline(data=data,
aes(xintercept = sign_frames),
col=significant_col,
alpha=significant_alpha)+
geom_line()+
labs(y = "Signal")+
theme(legend.position="none")
}
} else {
listlen <- length(tests_rst)
data_list <- list()
for (k in 1:listlen){
data_list[[k]] <- data.frame(signal=as.numeric(tests_rst[[k]]$signal))
data_list[[k]]$frames = frames
data_list[[k]]$significant<-ifelse(data_list[[k]]$frames %in% data_list[[k]]$frames[tests_rst[[k]]$significant],"sig","non-sig")
data_list[[k]]$sign_frames <- ifelse(data_list[[k]]$frames %in% data_list[[k]]$frames[tests_rst[[k]]$significant],data_list[[k]]$frames,NA)
data_list[[k]]$group <- rep(0,length(data_list[[k]]$signal))
data_list[[k]]$r2 <- tests_rst[[k]]$r2
data_list[[k]]$Channel <- names(tests_rst)[k]
}
data_plot <- data_list[[1]]
for (j in 2 : listlen){
data_plot <- rbind(data_plot,data_list[[j]])
}
if (cor == TRUE){
plot <- ggplot(data_plot,aes(x=frames,y=sign(signal)*sqrt(r2),group=group))+
geom_vline(data=data_plot,
aes(xintercept = sign_frames),
col=significant_col,
alpha=significant_alpha)+
geom_line()+
facet_wrap(~Channel)+
labs(y = "Correlation")+
theme(legend.position="none")
} else {
plot <- ggplot(data_plot,aes(x=frames,y=signal,group=group))+
geom_vline(data=data_plot,
aes(xintercept = sign_frames),
col=significant_col,
alpha=significant_alpha)+
geom_line()+
labs(y="Signal")+
facet_wrap(~Channel)+
theme(legend.position="none")
}
}
}
if (type == "signal") {
bootstrap <- function(x,bootnum,bootfun,bootintval=c(0.025,0.975),quantilenum,...){
boot_result <- boot(x,statistic = bootfun,R = bootnum,...) #fun
return(quantile(boot_result$t,bootintval,na.rm = T)[quantilenum])}
dta <- data # selection ?
if (multi == F ){
data_sign <- data.frame(frames=frames)
data_sign$significant <-
ifelse(data_sign$frames %in% data_sign$frames[tests_rst$significant],"sig","non-sig")
data_sign$sign_frames <-
ifelse(data_sign$frames %in% data_sign$frames[tests_rst$significant],data_sign$frames,NA)
data_sign$group <- rep(0,length(frames))
plot <- ciplot(dta,frames,
datacol,subjcol,chancol,othvarcol=othvarcol,
cpvarcol,
fun = fun,bootnum,bootintval=bootintval,
bootalpha=ifelse(wantbootplot==T,bootalpha,0))+
geom_vline(data=data_sign,
aes(xintercept = sign_frames),
col=significant_col,
alpha=significant_alpha)+
labs(y="Signal")
}
if (multi == T) {
listlen <- length(tests_rst)
test_list = list()
for (i in 1: listlen){
test_list[[i]] <- data.frame(frames=frames)
test_list[[i]]$significant <-
ifelse(test_list[[i]]$frames %in% test_list[[i]]$frames[tests_rst[[i]]$significant],"sig","non-sig")
test_list[[i]]$sign_frames <-
ifelse(test_list[[i]]$frames %in% test_list[[i]]$frames[tests_rst[[i]]$significant],test_list[[i]]$frames,NA)
test_list[[i]]$group <- rep(0,length(frames))
test_list[[i]]$Channel <- names(tests_rst)[i]
}
test_plot <- test_list[[1]]
for (k in 2:listlen){
test_plot <- rbind(test_plot,test_list[[k]])
}
if (is.null(cpvarcol)==TRUE){
data_fun <- data_summarize(dta,frames,
datacol,subjcol,chancol,othvarcol,
summarycol = c(chancol),fun=fun)
data_Q1 <- data_summarize(dta,frames,
datacol,subjcol,chancol,othvarcol,
summarycol = c(chancol),
fun=bootstrap,
bootnum=bootnum,bootfun=fun,
bootintval=bootintval,quantilenum=1)
data_Q2 <- data_summarize(dta,frames,
datacol,subjcol,chancol,othvarcol,
summarycol = c(chancol),
fun=bootstrap,bootnum=bootnum,bootfun=fun,
bootintval=bootintval,quantilenum=2)
data_fun_long <- melt(data_fun,id=c(colnames(dta)[chancol]))
data_fun_long <- data_fun_long[order(data_fun_long[,1],
data_fun_long[,2],
data_fun_long[,3]),]
colnames(data_fun_long)[3] <- "FUN"
data_Q1_long <- melt(data_Q1,id=c(colnames(dta)[chancol]))
data_Q1_long <- data_Q1_long[order(data_Q1_long[,1],
data_Q1_long[,2],
data_Q1_long[,3]),]
data_Q2_long <- melt(data_Q2,id=c(colnames(dta)[chancol]))
data_Q2_long <- data_Q2_long[order(data_Q2_long[,1],
data_Q2_long[,2],
data_Q2_long[,3]),]
data_fun_long$Q1 <- data_Q1_long[,3]
data_fun_long$Q2 <- data_Q2_long[,3]
data_fun_long$frames <- c(rep(frames,
(dim(data_fun_long)[1]/length(frames))))
colnames(data_fun_long)[1] <- c("Channel")
data_plot <- merge(data_fun_long,
test_plot,
by =c("Channel","frames"))
plot <- ggplot(data_plot,aes(x=frames))+
geom_vline(aes(xintercept = sign_frames),
col=significant_col,
alpha=significant_alpha)+
geom_ribbon(aes(x=frames, ymax=Q2, ymin=Q1),
alpha=ifelse(wantbootplot==T,bootalpha,0))+
geom_line(aes(y = FUN))+
facet_wrap(~Channel)+
labs(y="Signal")+
theme(legend.position="none")
} else {
dta[,cpvarcol] <- as.factor(dta[,cpvarcol])
dta[,chancol] <- as.factor(dta[,chancol])
data_fun <- data_summarize(dta,frames,
datacol,subjcol,chancol,othvarcol,
summarycol = c(chancol,cpvarcol),fun=fun)
data_Q1 <- data_summarize(dta,frames,
datacol,subjcol,chancol,othvarcol,
summarycol = c(chancol,cpvarcol),
fun=bootstrap,bootnum=bootnum,bootfun=fun,
bootintval=bootintval,quantilenum=1)
data_Q2 <- data_summarize(dta,frames,
datacol,subjcol,chancol,othvarcol,
summarycol = c(chancol,cpvarcol),
fun=bootstrap,bootnum=bootnum,bootfun=fun,
bootintval=bootintval,quantilenum=2)
data_fun_long <- melt(data_fun,
id=c(colnames(dta)[chancol],
colnames(dta)[cpvarcol]))
data_fun_long <- data_fun_long[order(data_fun_long[,1],
data_fun_long[,2],
data_fun_long[,3]),]
colnames(data_fun_long)[4] <- "FUN"
data_Q1_long <- melt(data_Q1,
id=c(colnames(dta)[chancol],
colnames(dta)[cpvarcol]))
data_Q1_long <- data_Q1_long[order(data_Q1_long[,1],
data_Q1_long[,2],
data_Q1_long[,3]),]
data_Q2_long <- melt(data_Q2,
id=c(colnames(dta)[chancol],
colnames(dta)[cpvarcol]))
data_Q2_long <- data_Q2_long[order(data_Q2_long[,1],
data_Q2_long[,2],
data_Q2_long[,3]),]
data_fun_long$Q1 <- data_Q1_long[,4]
data_fun_long$Q2 <- data_Q2_long[,4]
data_fun_long$frames <-
c(rep(frames,(dim(data_fun_long)[1]/length(frames))))
colnames(data_fun_long)[1:2] <- c("Channel","Condition")
data_plot <- merge(data_fun_long,
test_plot,
by =c("Channel","frames"))
plot <- ggplot(data_plot,aes(x=frames,group=Condition))+
geom_vline(aes(xintercept = sign_frames),
col=significant_col,
alpha=significant_alpha)+
geom_ribbon(aes(x=frames, ymax=Q2, ymin=Q1,fill=Condition),
alpha=bootalpha)+
geom_line(aes(y = FUN,col=Condition))+
labs(y="Signal")+# Need some changes ?
facet_wrap(~Channel)+
theme(legend.position="none")
}
}
}
return(plot)
}
#### type = test ; multi = TRUE ; cor = FALSE
ERP_test <- chan_test(ERPdata,2:427,chancol=1,testtype="erpfatest",
design_model=(~Subject+Condition),
design0_model=(~Subject))
mcplot(tests_rst = ERP_test,
# You could select , type = "test" or "signal"
type = "test",
# it is depend on your tests rst
multi = T,
# Work only if type = test
cor = FALSE,
# data information
data = ERPdata , frames = 1:426 , datacol = 2:427, subjcol = 430 , chancol = 1 , othvarcol = c(428:429,431:432),
# it is depend on your tests rst
# if type is "test" , it is not important
# cpvarcol = 429 ,
# the color of significant window
significant_col = "pink" , significant_alpha = 0.2)
# only if type = signal
# wantbootplot = TRUE,
# fun = samplemean <- function(x, d){return(mean(x[d]))}, # boot package
# bootnum = 10,
# bootintval = c(.025,.975),
# bootalpha = 0.3 )
#### type = test ; multi = FALSE ; cor = FALSE
# select CZ data
CZ <- data_select(data = ERPdata,frames = 1:426,
datacol = 2:427,subjcol = 430,chancol = 1,othvarcol = c(428:429,431:432),
select_chan=c("CZ"))
CZ_test <- erpfatest(CZ[2:427],
design=model.matrix(~Subject+Condition,data=CZ),
design0=model.matrix(~Subject,data=CZ))
mcplot(tests_rst = CZ_test,
type = "test",
# Single Channel, So multi = FALSE
multi = F,
cor = FALSE,
data = CZ , frames = 1:426 ,
datacol = 2:427, subjcol = 430 , chancol = 1 ,
othvarcol = c(428:429,431:432) , cpvarcol = 429 ,
significant_col = "lightblue" , significant_alpha = 0.5)
#### type = test; multi = T ; cor = T
ERP_cor_test <- chan_test(ERPdata,2:427,chancol=1,testtype="erpfatest",
design_model=(~IQ+Condition),
design0_model=(~Condition))
mcplot(tests_rst = ERP_cor_test ,
type = "test",
multi = T,
# Work only if type = test
cor = T,
data = ERPdata , frames = 1:426 ,
datacol = 2:427, subjcol = 430 , chancol = 1 ,
othvarcol = c(428:429,431:432) , cpvarcol = 429 ,
significant_col = "lightblue" , significant_alpha = 0.5)
# type = test; multi = F ; cor = T
CZ <- data_select(data = ERPdata,frames = 1:426,
datacol = 2:427,subjcol = 430,chancol = 1,othvarcol = c(428:429,431:432),
select_chan=c("CZ"))
CZ_word <- subset(CZ,CZ$Condition=="word")
CZ_word_test <- erpfatest(CZ_word[2:427],
design=model.matrix(~IQ,data=CZ_word))
mcplot(tests_rst = CZ_word_test ,
type = "test",
multi = F,
# Work only if type = test
cor=T,
data=CZ_word,frames=1:426,datacol=2:427,subjcol=430,chancol=1,othvarcol=c(428:429,431:432), #cpvarcol = NULL ,
significant_col = "purple" , significant_alpha = 0.2)
# type = signal ; multi = FALSE ; Have cpvar
CZ <- data_select(data = ERPdata,frames = 1:426,
datacol = 2:427,subjcol = 430,chancol = 1,othvarcol = c(428:429,431:432),
select_chan=c("CZ"))
CZ_test <- erpfatest(CZ[2:427],
design=model.matrix(~Subject+Condition,data=CZ),
design0=model.matrix(~Subject,data=CZ))
mcplot(tests_rst = CZ_test ,
# type = "test" or "signal"
type = "signal",
# depend on your tests_rst
multi = F,
# only if type = test
cor = FALSE,
data = CZ , frames = 1:426 ,datacol = 2:427, subjcol = 430 , chancol = 1 , othvarcol = c(428:429,431:432) ,
# depend on your r=test rst setting
cpvarcol = 429 ,
# the color of significant window
significant_col = "pink" , significant_alpha = 0.2,
# boot strap
wantbootplot = TRUE,
fun = samplemean <- function(x, d){return(mean(x[d]))},
bootnum = 10,
bootintval = c(.025,.975),
bootalpha=0.3)+
ylim(-10,10)
# type = signal ; multi = FALSE ; No cpvar (similar to correlation or simple T test setting)
CZ <- data_select(data = ERPdata,frames = 1:426,
datacol = 2:427,subjcol = 430,chancol = 1,othvarcol = c(428:429,431:432),
select_chan=c("CZ"))
CZ_word <- subset(CZ,CZ$Condition=="word")
CZ_word_test <- erpfatest(CZ_word[2:427],
design=model.matrix(~IQ,data=CZ_word))
mcplot(tests_rst = CZ_word_test ,
type = "signal", # type = "test" or "signal"
multi = F,
cor = FALSE, # only if type = test
data = CZ_word , frames = 1:426 ,datacol = 2:427, subjcol = 430 , chancol = 1 , othvarcol = c(428:429,431:432) ,
# No cpvar (similar to correlation or simple T test setting)
cpvarcol = NULL ,
significant_col = "purple" , significant_alpha = 0.2,# only if type = signal
wantbootplot = TRUE,
fun = samplemean <- function(x, d){return(mean(x[d]))},
bootnum = 10,
bootintval = c(.025,.975),
bootalpha = 0.3 )+
ylim(-10,10)
# type = signal ; multi = TRUE ; Have cpvar
mcplot(tests_rst = ERP_test,
type = "signal", # type = "test" or "signal"
multi = T,
cor = FALSE, # only if type = test
data = ERPdata , frames = 1:426 ,
datacol = 2:427, subjcol = 430 , chancol = 1 ,
othvarcol = c(428:429,431:432) , cpvarcol = 429 ,
significant_col = "pink" , significant_alpha = 0.2,# only if type = signal
wantbootplot = TRUE,
fun = samplemean <- function(x, d){return(mean(x[d]))},
bootnum = 10,
bootintval = c(.025,.975),
bootalpha = 0.3 )+
ylim(-10,10)#+
#facet_wrap(nrow = ,ncol = )
# type = signal ; multi = TRUE ; No cpvar
ERP_cor_test <- chan_test(ERPdata,2:427,chancol=1,testtype="erpfatest",
design_model=(~IQ+Condition),
design0_model=(~Condition))
mcplot(tests_rst = ERP_cor_test,
type = "signal",
multi = T,
cor = FALSE,
data = ERPdata , frames = 1:426 ,
datacol = 2:427, subjcol = 430 , chancol = 1 ,
othvarcol = c(428:429,431:432) ,
cpvarcol = NULL ,
significant_col = "pink" , significant_alpha = 0.2,# only if type = signal
wantbootplot = TRUE,
fun = samplemean <- function(x, d){return(mean(x[d]))},
bootnum = 10,
bootintval = c(.025,.975),
bootalpha = 0.3 )
coord_plot <- function(tests_rst,frames,show,
elect_coord=readRDS("Elect_Location.Rdata"),
type = "test", logscale = T,
point_size = 18,show_na_ele = F,
text = T,text_size = 3,text_col = "black",
circle = T,nose = T,cir_nose_col="black"){
# some check function
if (!type %in% c("test","pval","correctedpval","signal","r2")) {
stop("Available projectios are: test,pval,correctedpval,signal,r2, \n\t\tThe projection specified is: ",
type, call. = F)
}
num <- length(tests_rst)
rstlist <- list()
for (i in 1:num){
rstlist[[i]] <- data.frame(pval = tests_rst[[i]]$pval)
rstlist[[i]]$correctedpval <- tests_rst[[i]]$correctedpval
rstlist[[i]]$test <- tests_rst[[i]]$test
rstlist[[i]]$signal <- as.numeric(tests_rst[[i]]$signal)
rstlist[[i]]$r2 <- tests_rst[[i]]$r2
rstlist[[i]]$frame <- frames
}
for (i in 1:num) {
names(rstlist)[i] <- names(tests_rst)[i]
rstlist[[i]]$Electrode <- names(rstlist)[i]
}
sum_rstlist <- list()
for (i in 1:num){
sum_rstlist[[i]] <- rstlist[[i]][rstlist[[i]]$frame %in% show,]
}
sum_rstlist_fun <- list()
sum_rstlist_fun <- sum_rstlist
plotdta <- data.frame(sum_rstlist_fun[[1]])
for (i in 2:num){
plotdta <- rbind(plotdta,as.data.frame(sum_rstlist_fun[[i]]))
}
print("The following electrodes will not be plot :")
print(as.character(plotdta$Electrode[!toupper(plotdta$Electrode) %in% toupper(elect_coord$Electrode)]))
currdta <- subset(plotdta,toupper(plotdta$Electrode) %in% toupper(elect_coord$Electrode))
currdta$Electrode <- toupper(currdta$Electrode)
currele <- elect_coord
currele$Electrode <- toupper(currele$Electrode)
currdtaele <- merge(currele,currdta,all=T)
circleFun <- function(center = c(0,0),diameter = 1, npoints = 100){
r = diameter / 2
tt <- seq(0,2*pi,length.out = npoints)
xx <- center[1] + r * cos(tt)
yy <- center[2] + r * sin(tt)
return(data.frame(x = xx, y = yy))
}
diameter <- max(dist(currdtaele[,2:3]))+point_size*0.03
datcir <- circleFun(c(mean(as.numeric(currdtaele$x)),
mean(as.numeric(currdtaele$y))),
diameter,npoints = 100)
datnose <- data.frame(x=c(datcir[23,1],0,-datcir[23,1]),
y=c(datcir[23,2],datcir[23,2]+0.3,datcir[23,2]))
currdtaele <- as.data.frame(currdtaele)
currdtaele$x <- as.numeric(currdtaele$x)
currdtaele$y <- as.numeric(currdtaele$y)
if (show_na_ele == F){
currdtaele = na.omit(currdtaele)
}
if (type == "pval"){
if (logscale == T){
plot <- ggplot(currdtaele,aes(x=x,y=y))+
geom_point(aes(fill= -log(pval)),
col=cir_nose_col,size=point_size,pch=21)+
geom_text(aes(label=Electrode),
size=text_size,
alpha = ifelse(text==T,1,0),
col=text_col)+
geom_path(data=datcir,aes(x,y),
alpha = ifelse(circle==T,1,0),
col = cir_nose_col)+
geom_path(data=datnose,aes(x,y),
alpha = ifelse(nose==T,1,0),
col = cir_nose_col)+
scale_fill_gradient2(high="red",low = "blue",midpoint = -log(0.05),
na.value = "grey50",
limit=c(0,-log(min(currdtaele$pval))))
}
if (logscale == F){
plot <- ggplot(currdtaele,aes(x=x,y=y))+
geom_point(aes(fill= pval),
col=cir_nose_col,size=point_size,pch=21)+
geom_text(aes(label=Electrode),
size=text_size,
alpha = ifelse(text==T,1,0),
col=text_col)+
geom_path(data=datcir,aes(x,y),
alpha = ifelse(circle==T,1,0),
col = cir_nose_col)+
geom_path(data=datnose,aes(x,y),
alpha = ifelse(nose==T,1,0),
col = cir_nose_col)+
scale_fill_gradient2(low="red",high = "blue",midpoint = 0.05,
na.value = "grey50",
limit=c(0,max(currdtaele$pval)),
guide = guide_colorbar(reverse = T))
}
}
if (type == "correctedpval"){
if (logscale == T){
plot <- ggplot(currdtaele,aes(x=x,y=y))+
geom_point(aes(fill= -log(correctedpval)),
col=cir_nose_col,size=point_size,pch=21)+
geom_text(aes(label=Electrode),
size=text_size,
alpha = ifelse(text==T,1,0),
col=text_col)+
geom_path(data=datcir,aes(x,y),
alpha = ifelse(circle==T,1,0),
col = cir_nose_col)+
geom_path(data=datnose,aes(x,y),
alpha = ifelse(nose==T,1,0),
col = cir_nose_col)+
scale_fill_gradient2(high="red",low = "blue",midpoint = -log(0.05),
na.value = "grey50",
limit=c(0,-log(min(currdtaele$correctedpval))))
}
if (logscale == F){
plot <- ggplot(currdtaele,aes(x=x,y=y))+
geom_point(aes(fill= correctedpval),
col=cir_nose_col,size=point_size,pch=21)+
geom_text(aes(label=Electrode),
size=text_size,
alpha = ifelse(text==T,1,0),
col=text_col)+
geom_path(data=datcir,aes(x,y),
alpha = ifelse(circle==T,1,0),
col = cir_nose_col)+
geom_path(data=datnose,aes(x,y),
alpha = ifelse(nose==T,1,0),
col = cir_nose_col)+
scale_fill_gradient2(low="red",high = "blue",midpoint = 0.05,
na.value = "grey50",
limit=c(0,max(currdtaele$correctedpval)),
guide = guide_colorbar(reverse = T))
}
}
if (type == "test"){
if (logscale == T){
plot <- ggplot(currdtaele,aes(x=x,y=y))+
geom_point(aes(fill=log(test)),
col=cir_nose_col,size=point_size,pch=21)+
geom_text(aes(label=Electrode),
size=text_size,alpha = ifelse(text==T,1,0),col=text_col)+
geom_path(data=datcir,aes(x,y),
alpha = ifelse(circle==T,1,0),col = cir_nose_col)+
geom_path(data=datnose,aes(x,y),
alpha = ifelse(nose==T,1,0),
col = cir_nose_col)+
scale_fill_gradient2(high="red",low = "blue",
midpoint = median(log(currdtaele$test)),
na.value = "grey50",
limit=c(min(log(currdtaele$test)),
max(log(currdtaele$test))))
}
if (logscale == F){
plot <- ggplot(currdtaele,aes(x=x,y=y))+
geom_point(aes(fill=test),
col=cir_nose_col,size=point_size,pch=21)+
geom_text(aes(label=Electrode),
size=text_size,
alpha = ifelse(text==T,1,0),
col=text_col)+
geom_path(data=datcir,aes(x,y),
alpha = ifelse(circle==T,1,0),
col = cir_nose_col)+
geom_path(data=datnose,aes(x,y),
alpha = ifelse(nose==T,1,0),
col = cir_nose_col)+
scale_fill_gradient2(high="red",low = "blue",
midpoint = median(currdtaele$test),
na.value = "grey50",
limit=c(min(currdtaele$test),
max(currdtaele$test)))
}
}
if (type == "signal"){
plot <- ggplot(currdtaele,aes(x=x,y=y))+
geom_point(aes(fill=signal),col=cir_nose_col,size=point_size,pch=21)+
geom_text(aes(label=Electrode),
size=text_size,
alpha = ifelse(text==T,1,0),
col=text_col)+
geom_path(data=datcir,aes(x,y),
alpha = ifelse(circle==T,1,0),
col = cir_nose_col)+
geom_path(data=datnose,aes(x,y),
alpha = ifelse(nose==T,1,0),
col = cir_nose_col)+
scale_fill_gradient2(high="red",low = "blue",
midpoint = median(currdtaele$signal),
na.value = "grey50",
limit=c(min(currdtaele$signal),
max(currdtaele$signal)))
}
if (type == "r2"){
plot <- ggplot(currdtaele,aes(x=x,y=y))+
geom_point(aes(fill=r2),col=cir_nose_col,size=point_size,pch=21)+
geom_text(aes(label=Electrode),
size=text_size,
alpha = ifelse(text==T,1,0),
col=text_col)+
geom_path(data=datcir,aes(x,y),
alpha = ifelse(circle==T,1,0),
col = cir_nose_col)+
geom_path(data=datnose,aes(x,y),
alpha = ifelse(nose==T,1,0),
col = cir_nose_col)+
scale_fill_continuous(high="yellow",low = "red",
na.value = "grey50",
limit=c(0,1))
}
return(plot)
}
coord_plot(tests_rst =ERP_test,frames=1:426,
elect_coord=readRDS("Elect_Location.RData"),
type = "correctedpval",logscale = F,
show = 200, point_size = 10,show_na_ele = F,
text = T,text_size = 3,text_col = "black",
circle = T,nose = T,cir_nose_col="black")
[1] "The following electrodes will not be plot :"
[1] "T3" "T4" "T5" "T6" "A2" "VEOG1" "HEOG1"
coord_plot(tests_rst =ERP_test,frames=1:426,
elect_coord=readRDS("Elect_Location.RData"),
type = "correctedpval",logscale = T,
show = 200, point_size = 10,show_na_ele = T,
text = T,text_size = 3,text_col = "black",
circle = T,nose = F,cir_nose_col="black")
[1] "The following electrodes will not be plot :"
[1] "T3" "T4" "T5" "T6" "A2" "VEOG1" "HEOG1"
coord_plot(tests_rst =ERP_test,frames=1:426,
elect_coord=readRDS("Elect_Location.RData"),
type = "correctedpval",logscale = T,
show = 200, point_size = 10,show_na_ele = F,
text = T,text_size = 3,text_col = "black",
circle = T,nose = T,cir_nose_col="black")+
scale_fill_gradient2(low="blue",high = "red",
midpoint = -log(0.01),
na.value = "grey80",
limit=c(0,25),
guide_colorbar(title = "-Log \nCorrected \np-value"))+
theme_nothing(legend = T)+
labs(list(title = paste("Frames = ",200)))
[1] "The following electrodes will not be plot :"
[1] "T3" "T4" "T5" "T6" "A2" "VEOG1" "HEOG1"
p <- list()
for (i in 1:4){
p[[i]] <- coord_plot(tests_rst =ERP_test,frames=1:426,
elect_coord=readRDS("Elect_Location.RData"),
type = "test",
show = ((i-1)*100+1):((i)*100), # ??
point_size = 10,show_na_ele = F,
text = T,text_size = 3,text_col = "black",
circle = T,nose = T,cir_nose_col="black")+
scale_fill_gradient2(low="blue",high = "red",
midpoint = median(sapply(ERP_test[[i]]$test,median)),
na.value = "grey",
limit=c(min(sapply(ERP_test[[i]]$test,min)),
max(sapply(ERP_test[[i]]$test,max))))+
theme_nothing(legend = T)+
labs(list(title = paste("Frames = ",
paste(((i-1)*100+1),((i)*100),sep = "~"))))
}
[1] "The following electrodes will not be plot :"
[1] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[9] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[17] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[25] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[33] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[41] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[49] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[57] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[65] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[73] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[81] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[89] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[97] "T3" "T3" "T3" "T3" "T4" "T4" "T4" "T4"
[105] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[113] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[121] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[129] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[137] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[145] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[153] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[161] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[169] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[177] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[185] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[193] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[201] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[209] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[217] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[225] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[233] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[241] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[249] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[257] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[265] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[273] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[281] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[289] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[297] "T5" "T5" "T5" "T5" "T6" "T6" "T6" "T6"
[305] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[313] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[321] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[329] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[337] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[345] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[353] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[361] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[369] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[377] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[385] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[393] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[401] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[409] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[417] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[425] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[433] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[441] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[449] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[457] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[465] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[473] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[481] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[489] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[497] "A2" "A2" "A2" "A2" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[505] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[513] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[521] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[529] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[537] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[545] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[553] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[561] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[569] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[577] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[585] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[593] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[601] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[609] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[617] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[625] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[633] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[641] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[649] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[657] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[665] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[673] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[681] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[689] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[697] "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[1] "The following electrodes will not be plot :"
[1] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[9] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[17] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[25] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[33] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[41] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[49] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[57] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[65] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[73] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[81] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[89] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[97] "T3" "T3" "T3" "T3" "T4" "T4" "T4" "T4"
[105] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[113] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[121] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[129] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[137] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[145] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[153] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[161] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[169] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[177] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[185] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[193] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[201] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[209] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[217] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[225] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[233] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[241] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[249] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[257] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[265] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[273] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[281] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[289] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[297] "T5" "T5" "T5" "T5" "T6" "T6" "T6" "T6"
[305] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[313] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[321] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[329] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[337] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[345] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[353] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[361] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[369] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[377] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[385] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[393] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[401] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[409] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[417] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[425] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[433] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[441] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[449] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[457] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[465] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[473] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[481] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[489] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[497] "A2" "A2" "A2" "A2" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[505] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[513] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[521] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[529] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[537] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[545] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[553] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[561] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[569] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[577] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[585] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[593] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[601] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[609] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[617] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[625] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[633] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[641] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[649] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[657] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[665] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[673] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[681] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[689] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[697] "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[1] "The following electrodes will not be plot :"
[1] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[9] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[17] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[25] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[33] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[41] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[49] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[57] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[65] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[73] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[81] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[89] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[97] "T3" "T3" "T3" "T3" "T4" "T4" "T4" "T4"
[105] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[113] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[121] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[129] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[137] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[145] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[153] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[161] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[169] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[177] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[185] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[193] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[201] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[209] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[217] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[225] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[233] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[241] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[249] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[257] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[265] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[273] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[281] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[289] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[297] "T5" "T5" "T5" "T5" "T6" "T6" "T6" "T6"
[305] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[313] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[321] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[329] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[337] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[345] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[353] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[361] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[369] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[377] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[385] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[393] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[401] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[409] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[417] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[425] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[433] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[441] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[449] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[457] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[465] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[473] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[481] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[489] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[497] "A2" "A2" "A2" "A2" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[505] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[513] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[521] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[529] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[537] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[545] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[553] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[561] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[569] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[577] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[585] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[593] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[601] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[609] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[617] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[625] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[633] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[641] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[649] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[657] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[665] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[673] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[681] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[689] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[697] "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[1] "The following electrodes will not be plot :"
[1] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[9] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[17] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[25] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[33] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[41] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[49] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[57] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[65] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[73] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[81] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[89] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[97] "T3" "T3" "T3" "T3" "T4" "T4" "T4" "T4"
[105] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[113] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[121] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[129] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[137] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[145] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[153] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[161] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[169] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[177] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[185] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[193] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[201] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[209] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[217] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[225] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[233] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[241] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[249] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[257] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[265] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[273] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[281] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[289] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[297] "T5" "T5" "T5" "T5" "T6" "T6" "T6" "T6"
[305] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[313] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[321] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[329] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[337] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[345] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[353] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[361] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[369] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[377] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[385] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[393] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[401] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[409] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[417] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[425] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[433] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[441] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[449] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[457] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[465] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[473] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[481] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[489] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[497] "A2" "A2" "A2" "A2" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[505] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[513] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[521] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[529] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[537] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[545] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[553] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[561] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[569] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[577] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[585] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[593] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[601] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[609] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[617] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[625] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[633] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[641] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[649] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[657] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[665] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[673] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[681] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[689] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[697] "HEOG1" "HEOG1" "HEOG1" "HEOG1"
grid.arrange(p[[1]],p[[2]],p[[3]],p[[4]],ncol=2)
p <- list()
for (i in 1:4){
p[[i]] <- coord_plot(tests_rst =ERP_test,frames=1:426,
elect_coord=readRDS("Elect_Location.RData"),
type = "correctedpval",
show = ((i-1)*100+1):((i)*100), # ??
point_size = 10,show_na_ele = F,
text = T,text_size = 3,text_col = "black",
circle = T,nose = T,cir_nose_col="black")+
scale_fill_continuous(low="red",high = "yellow",na.value = "grey97",
limit=c(0,0.05),
guide = guide_colorbar(reverse=T))+
theme_nothing(legend = T)+
labs(list(title = paste("Frames = ",
paste(((i-1)*100+1),((i)*100),sep = "~"))))
}
[1] "The following electrodes will not be plot :"
[1] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[9] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[17] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[25] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[33] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[41] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[49] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[57] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[65] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[73] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[81] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[89] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[97] "T3" "T3" "T3" "T3" "T4" "T4" "T4" "T4"
[105] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[113] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[121] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[129] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[137] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[145] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[153] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[161] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[169] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[177] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[185] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[193] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[201] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[209] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[217] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[225] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[233] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[241] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[249] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[257] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[265] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[273] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[281] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[289] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[297] "T5" "T5" "T5" "T5" "T6" "T6" "T6" "T6"
[305] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[313] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[321] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[329] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[337] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[345] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[353] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[361] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[369] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[377] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[385] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[393] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[401] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[409] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[417] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[425] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[433] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[441] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[449] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[457] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[465] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[473] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[481] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[489] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[497] "A2" "A2" "A2" "A2" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[505] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[513] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[521] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[529] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[537] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[545] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[553] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[561] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[569] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[577] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[585] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[593] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[601] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[609] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[617] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[625] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[633] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[641] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[649] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[657] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[665] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[673] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[681] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[689] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[697] "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[1] "The following electrodes will not be plot :"
[1] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[9] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[17] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[25] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[33] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[41] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[49] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[57] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[65] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[73] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[81] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[89] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[97] "T3" "T3" "T3" "T3" "T4" "T4" "T4" "T4"
[105] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[113] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[121] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[129] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[137] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[145] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[153] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[161] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[169] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[177] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[185] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[193] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[201] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[209] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[217] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[225] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[233] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[241] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[249] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[257] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[265] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[273] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[281] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[289] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[297] "T5" "T5" "T5" "T5" "T6" "T6" "T6" "T6"
[305] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[313] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[321] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[329] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[337] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[345] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[353] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[361] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[369] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[377] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[385] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[393] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[401] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[409] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[417] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[425] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[433] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[441] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[449] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[457] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[465] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[473] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[481] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[489] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[497] "A2" "A2" "A2" "A2" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[505] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[513] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[521] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[529] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[537] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[545] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[553] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[561] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[569] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[577] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[585] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[593] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[601] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[609] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[617] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[625] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[633] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[641] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[649] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[657] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[665] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[673] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[681] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[689] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[697] "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[1] "The following electrodes will not be plot :"
[1] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[9] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[17] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[25] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[33] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[41] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[49] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[57] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[65] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[73] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[81] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[89] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[97] "T3" "T3" "T3" "T3" "T4" "T4" "T4" "T4"
[105] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[113] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[121] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[129] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[137] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[145] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[153] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[161] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[169] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[177] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[185] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[193] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[201] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[209] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[217] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[225] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[233] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[241] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[249] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[257] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[265] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[273] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[281] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[289] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[297] "T5" "T5" "T5" "T5" "T6" "T6" "T6" "T6"
[305] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[313] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[321] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[329] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[337] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[345] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[353] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[361] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[369] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[377] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[385] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[393] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[401] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[409] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[417] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[425] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[433] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[441] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[449] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[457] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[465] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[473] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[481] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[489] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[497] "A2" "A2" "A2" "A2" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[505] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[513] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[521] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[529] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[537] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[545] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[553] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[561] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[569] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[577] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[585] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[593] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[601] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[609] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[617] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[625] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[633] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[641] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[649] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[657] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[665] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[673] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[681] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[689] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[697] "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[1] "The following electrodes will not be plot :"
[1] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[9] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[17] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[25] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[33] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[41] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[49] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[57] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[65] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[73] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[81] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[89] "T3" "T3" "T3" "T3" "T3" "T3" "T3" "T3"
[97] "T3" "T3" "T3" "T3" "T4" "T4" "T4" "T4"
[105] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[113] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[121] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[129] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[137] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[145] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[153] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[161] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[169] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[177] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[185] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[193] "T4" "T4" "T4" "T4" "T4" "T4" "T4" "T4"
[201] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[209] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[217] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[225] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[233] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[241] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[249] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[257] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[265] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[273] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[281] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[289] "T5" "T5" "T5" "T5" "T5" "T5" "T5" "T5"
[297] "T5" "T5" "T5" "T5" "T6" "T6" "T6" "T6"
[305] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[313] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[321] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[329] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[337] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[345] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[353] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[361] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[369] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[377] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[385] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[393] "T6" "T6" "T6" "T6" "T6" "T6" "T6" "T6"
[401] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[409] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[417] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[425] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[433] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[441] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[449] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[457] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[465] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[473] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[481] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[489] "A2" "A2" "A2" "A2" "A2" "A2" "A2" "A2"
[497] "A2" "A2" "A2" "A2" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[505] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[513] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[521] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[529] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[537] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[545] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[553] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[561] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[569] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[577] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[585] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[593] "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1" "VEOG1"
[601] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[609] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[617] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[625] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[633] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[641] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[649] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[657] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[665] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[673] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[681] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[689] "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1" "HEOG1"
[697] "HEOG1" "HEOG1" "HEOG1" "HEOG1"
grid.arrange(p[[1]],p[[2]],p[[3]],p[[4]],ncol=2)
ERPcor<- readRDS("data/erpt_data.Rda")
ERPcor2 <- downsample(data = ERPcor,
datacol = 7:432,
binwidth = 50,
movinginterval=5)
dim(ERPcor2);length(7:102)
[1] 200 102
[1] 96
ERP_cor_test <- chan_test(ERPcor2,7:102,chancol=1,testtype="erpfatest",
design_model=(~IQ+Condition),
design0_model=(~Condition))
t <- seq(1,1700,by =17.8)
for (i in 1:16){
nam <- paste("Fig", i, sep = "")
assign(nam,coord_plot(tests_rst =ERP_cor_test,frames=1:96, # t
elect_coord=readRDS("Elect_Location.RData"),
type = "r2",
show = ((i-1)*6+1):((i)*6),
point_size = 10,show_na_ele = F,
text = T,text_size = 1,text_col = "black",
circle = T,nose = T,cir_nose_col="black")+
scale_fill_continuous(low="red",high = "yellow",na.value = "grey97",
limit=c(0,1))+
#guide = guide_colorbar(reverse=T))+
theme_nothing(legend = T)+
labs(list(title = paste("Frames = ",
paste(t[((i-1)*6+1)],t[((i)*6)],sep = "~")))))
}
[1] "The following electrodes will not be plot :"
[1] "T3" "T3" "T3" "T3" "T3" "T3" "T4" "T4" "T4" "T4" "T4" "T4" "T5" "T5"
[15] "T5" "T5" "T5" "T5" "T6" "T6" "T6" "T6" "T6" "T6"
[1] "The following electrodes will not be plot :"
[1] "T3" "T3" "T3" "T3" "T3" "T3" "T4" "T4" "T4" "T4" "T4" "T4" "T5" "T5"
[15] "T5" "T5" "T5" "T5" "T6" "T6" "T6" "T6" "T6" "T6"
[1] "The following electrodes will not be plot :"
[1] "T3" "T3" "T3" "T3" "T3" "T3" "T4" "T4" "T4" "T4" "T4" "T4" "T5" "T5"
[15] "T5" "T5" "T5" "T5" "T6" "T6" "T6" "T6" "T6" "T6"
[1] "The following electrodes will not be plot :"
[1] "T3" "T3" "T3" "T3" "T3" "T3" "T4" "T4" "T4" "T4" "T4" "T4" "T5" "T5"
[15] "T5" "T5" "T5" "T5" "T6" "T6" "T6" "T6" "T6" "T6"
[1] "The following electrodes will not be plot :"
[1] "T3" "T3" "T3" "T3" "T3" "T3" "T4" "T4" "T4" "T4" "T4" "T4" "T5" "T5"
[15] "T5" "T5" "T5" "T5" "T6" "T6" "T6" "T6" "T6" "T6"
[1] "The following electrodes will not be plot :"
[1] "T3" "T3" "T3" "T3" "T3" "T3" "T4" "T4" "T4" "T4" "T4" "T4" "T5" "T5"
[15] "T5" "T5" "T5" "T5" "T6" "T6" "T6" "T6" "T6" "T6"
[1] "The following electrodes will not be plot :"
[1] "T3" "T3" "T3" "T3" "T3" "T3" "T4" "T4" "T4" "T4" "T4" "T4" "T5" "T5"
[15] "T5" "T5" "T5" "T5" "T6" "T6" "T6" "T6" "T6" "T6"
[1] "The following electrodes will not be plot :"
[1] "T3" "T3" "T3" "T3" "T3" "T3" "T4" "T4" "T4" "T4" "T4" "T4" "T5" "T5"
[15] "T5" "T5" "T5" "T5" "T6" "T6" "T6" "T6" "T6" "T6"
[1] "The following electrodes will not be plot :"
[1] "T3" "T3" "T3" "T3" "T3" "T3" "T4" "T4" "T4" "T4" "T4" "T4" "T5" "T5"
[15] "T5" "T5" "T5" "T5" "T6" "T6" "T6" "T6" "T6" "T6"
[1] "The following electrodes will not be plot :"
[1] "T3" "T3" "T3" "T3" "T3" "T3" "T4" "T4" "T4" "T4" "T4" "T4" "T5" "T5"
[15] "T5" "T5" "T5" "T5" "T6" "T6" "T6" "T6" "T6" "T6"
[1] "The following electrodes will not be plot :"
[1] "T3" "T3" "T3" "T3" "T3" "T3" "T4" "T4" "T4" "T4" "T4" "T4" "T5" "T5"
[15] "T5" "T5" "T5" "T5" "T6" "T6" "T6" "T6" "T6" "T6"
[1] "The following electrodes will not be plot :"
[1] "T3" "T3" "T3" "T3" "T3" "T3" "T4" "T4" "T4" "T4" "T4" "T4" "T5" "T5"
[15] "T5" "T5" "T5" "T5" "T6" "T6" "T6" "T6" "T6" "T6"
[1] "The following electrodes will not be plot :"
[1] "T3" "T3" "T3" "T3" "T3" "T3" "T4" "T4" "T4" "T4" "T4" "T4" "T5" "T5"
[15] "T5" "T5" "T5" "T5" "T6" "T6" "T6" "T6" "T6" "T6"
[1] "The following electrodes will not be plot :"
[1] "T3" "T3" "T3" "T3" "T3" "T3" "T4" "T4" "T4" "T4" "T4" "T4" "T5" "T5"
[15] "T5" "T5" "T5" "T5" "T6" "T6" "T6" "T6" "T6" "T6"
[1] "The following electrodes will not be plot :"
[1] "T3" "T3" "T3" "T3" "T3" "T3" "T4" "T4" "T4" "T4" "T4" "T4" "T5" "T5"
[15] "T5" "T5" "T5" "T5" "T6" "T6" "T6" "T6" "T6" "T6"
[1] "The following electrodes will not be plot :"
[1] "T3" "T3" "T3" "T3" "T3" "T3" "T4" "T4" "T4" "T4" "T4" "T4" "T5" "T5"
[15] "T5" "T5" "T5" "T5" "T6" "T6" "T6" "T6" "T6" "T6"
#cat(paste("Fig",1:16,sep=""),sep=",")
grid.arrange(Fig1,Fig2,Fig3,Fig4,Fig5,Fig6,Fig7,Fig8,Fig9,Fig10,Fig11,Fig12,Fig13,Fig14,Fig15,Fig16,ncol=4)
scalp_plot <- function(chan_data,frames,
datacol,chancol,cpvarcol=NULL,
ylim=c(-10,10),color = c("blue","red")){
if ((dim(chan_data)[2]) > length(datacol)+length(chancol)+length(cpvarcol)){
stop("input object must only contain Data, Channel and Compare_variable!")
}
get_legend<-function(myggplot){
tmp <- ggplot_gtable(ggplot_build(myggplot))
leg <- which(sapply(tmp$grobs, function(x) x$name) == "guide-box")
legend <- tmp$grobs[[leg]]
return(legend)
}
erplay <- rbind(c(NA,NA,NA,NA,"Fp1","Fpz","Fp2",NA,NA,NA,NA),
c(NA,NA,NA,"AF7","AF3","AFz","AF4","AF8",NA,NA,NA),
c(NA,"F7","F5","F3","F1","Fz","F2","F4","F6","F8",NA),
c("FT9","FT7","FC5","FC3","FC1","FCz","FC2","FC4","FC6","FT8","FT10"),
c("T9","T7","C5","C3","C1","CZ","C2","C4","C6","T8","T10"),
c("TP9","TP7","CP5","CP3","CP1","CPz","CP2","CP4","CP6","TP8","TP10"),
c("P9","P7","P5","P3","P1","PZ","P2","P4","P6","P8","P10"),
c(NA,NA,"PO9","PO7","PO3","POz","PO4","PO8","PO10",NA,NA),
c(NA,NA,NA,NA,"O1","Oz","O2",NA,NA,NA,NA),
c(NA,NA,NA,NA,"I1","Iz","I2",NA,NA,NA,NA))
dtaall <- chan_data
names(dtaall)[chancol] <- "Channel"
plotlist <- list()
if (is.null(cpvarcol)){
for (i in 1:length(levels(dtaall[,chancol]))){
dta <- subset(dtaall,dtaall[,chancol] == levels(dtaall[,chancol])[i])
dta2 <- melt(dta,id = "Channel")
dta2 <- dta2[order(dta2$Channel),]
dta2$frames <- rep(frames,dim(dta2)[1]/length(frames))
plotlist[[i]] <- ggplot(dta2,aes(x = frames, y = value))+
geom_line(col = color[1])+
ylim(ylim[1],ylim[2])+
theme_bw()+
theme(legend.position="none")+
labs(list(title=levels(dtaall[,chancol])[i]))+
theme(axis.title.y = element_blank(),axis.title.x = element_blank(),
axis.text = element_text(size = 5),
axis.text.x = element_blank(),
axis.line = element_blank(),
axis.ticks = element_blank(),
panel.border =element_blank())
names(plotlist)[i] <-levels(dtaall[,chancol])[i]
}
for (i in 1 : 10 ){
for (j in 1:11){
if (!toupper(erplay[i,j]) %in% toupper(dtaall$Channel)){
erplay[i,j] = NA
}
}
}
print("The following electrodes will not be plotted :")
print(as.character(dtaall$Channel[!toupper(dtaall$Channel) %in% toupper(erplay)]))
printlist <- plotlist[which(toupper(names(plotlist)) %in% toupper(erplay))]
erplaynum <- matrix(NA,10,11)
for (i in 1:10){
for (j in 1:11){
if (toupper(erplay[i,j]) %in% toupper(dtaall$Channel)){
erplaynum[i,j] = which(toupper(names(printlist)) %in% toupper(erplay[i,j]))
}
}
}
# printlist[[length(printlist)+1]] <- legend
# erplaynum[1,11] <- length(printlist)
plot <- do.call("grid.arrange", list(grobs=printlist,layout_matrix=erplaynum))
} else {
names(dtaall)[cpvarcol] <- "Condition"
condlevel <- levels(as.factor(dtaall$Condition))
if (length(color) != length(condlevel)){
stop("Color object must only be same as levels of compare varaible")
}
colvalue <- color[1:length(condlevel)]
dta <- subset(dtaall,dtaall[,chancol] == levels(dtaall[,chancol])[2])
dta2 <- melt(dta,id = c("Condition","Channel"))
dta2 <- dta2[order(dta2$Condition),]
dta2$Condition <- as.factor(dta2$Condition)
dta2$frames <- rep(frames,dim(dta2)[1]/length(frames))
flegend <- ggplot(dta2,aes(x=frames, y=value))+
geom_line(aes(col=Condition))+
ylim(ylim[1],ylim[2])+
theme_bw()+
theme_minimal()+
theme(legend.position="left")+
labs(list(title=levels(levels(dtaall[,chancol])[1])[i]))+
theme(axis.title.y = element_blank(),
axis.title.x = element_blank(),
axis.text = element_text(size = 3),
axis.ticks = element_blank(),
axis.line = element_blank())+
scale_colour_manual(values= colvalue,name = names(chan_data)[cpvarcol])
legend <- get_legend(flegend)
for (i in 1:length(levels(dtaall[,chancol]))){
dta <- subset(dtaall,dtaall[,chancol] == levels(dtaall[,chancol])[i])
dta2 <- melt(dta,id = c("Condition","Channel"))
dta2 <- dta2[order(dta2$Condition),]
dta2$Condition <- as.factor(dta2$Condition)
dta2$frames <- rep(frames,dim(dta2)[1]/length(frames))
plotlist[[i]] <- ggplot(dta2,aes(x = frames, y = value,group=Condition))+
geom_line(aes(col=Condition))+
ylim(ylim[1],ylim[2])+
scale_colour_manual(values= colvalue,name = names(chan_data)[cpvarcol])+
theme_bw()+
theme(legend.position="none")+
labs(list(title=levels(dtaall[,chancol])[i]))+
theme(axis.title.y = element_blank(),axis.title.x = element_blank(),
axis.text = element_text(size = 5),
axis.text.x = element_blank(),
axis.line = element_blank(),
axis.ticks = element_blank(),
panel.border =element_blank() )
names(plotlist)[i] <-levels(dtaall[,chancol])[i]
}
for (i in 1 : 10 ){
for (j in 1:11){
if (!toupper(erplay[i,j]) %in% toupper(dtaall$Channel)){
erplay[i,j] = NA
}
}
}
print("The following electrodes will not be plotted :")
print( as.character(dtaall$Channel[!toupper(dtaall$Channel) %in% toupper(erplay)])[duplicated(as.character(dtaall$Channel[!toupper(dtaall$Channel) %in% toupper(erplay)]))])
printlist <- plotlist[which(toupper(names(plotlist)) %in% toupper(erplay))]
erplaynum <- matrix(NA,10,11)
for (i in 1:10){
for (j in 1:11){
if (toupper(erplay[i,j]) %in% toupper(dtaall$Channel)){
erplaynum[i,j] = which(toupper(names(printlist)) %in% toupper(erplay[i,j]))
}
}
}
printlist[[length(printlist)+1]] <- legend
erplaynum[1,11] <- length(printlist)
plot <- do.call("grid.arrange", list(grobs=printlist,layout_matrix=erplaynum))
}
return(plot)
}
ERPdata_agg <- data_summarize(ERPdata,frames=1:426,2:427,430,1,othvarcol=c(428,429,431,432),
summarycol=c(428,429,1),
fun=mean)
scalp_plot(chan_data=ERPdata_agg[,-1],frames=1:426,datacol=3:428,chancol=2,cpvarcol=1,
ylim=c(-15,15),color=c("red","blue"))
[1] "The following electrodes will not be plotted :"
[1] "T3" "T4" "T5" "T6" "A2" "VEOG1" "HEOG1"
TableGrob (9 x 11) "arrange": 28 grobs
z cells name grob
Fp1 1 ( 1- 1, 5- 5) arrange gtable[layout]
Fp2 2 ( 1- 1, 7- 7) arrange gtable[layout]
F3 3 ( 3- 3, 4- 4) arrange gtable[layout]
F4 4 ( 3- 3, 8- 8) arrange gtable[layout]
C3 5 ( 5- 5, 4- 4) arrange gtable[layout]
C4 6 ( 5- 5, 8- 8) arrange gtable[layout]
P3 7 ( 7- 7, 4- 4) arrange gtable[layout]
P4 8 ( 7- 7, 8- 8) arrange gtable[layout]
O1 9 ( 9- 9, 5- 5) arrange gtable[layout]
O2 10 ( 9- 9, 7- 7) arrange gtable[layout]
F7 11 ( 3- 3, 2- 2) arrange gtable[layout]
F8 12 ( 3- 3,10-10) arrange gtable[layout]
CZ 13 ( 5- 5, 6- 6) arrange gtable[layout]
FZ 14 ( 3- 3, 6- 6) arrange gtable[layout]
PZ 15 ( 7- 7, 6- 6) arrange gtable[layout]
FCZ 16 ( 4- 4, 6- 6) arrange gtable[layout]
CPZ 17 ( 6- 6, 6- 6) arrange gtable[layout]
CP3 18 ( 6- 6, 4- 4) arrange gtable[layout]
CP4 19 ( 6- 6, 8- 8) arrange gtable[layout]
FC3 20 ( 4- 4, 4- 4) arrange gtable[layout]
FC4 21 ( 4- 4, 8- 8) arrange gtable[layout]
TP7 22 ( 6- 6, 2- 2) arrange gtable[layout]
TP8 23 ( 6- 6,10-10) arrange gtable[layout]
FPZ 24 ( 1- 1, 6- 6) arrange gtable[layout]
OZ 25 ( 9- 9, 6- 6) arrange gtable[layout]
FT7 26 ( 4- 4, 2- 2) arrange gtable[layout]
FT8 27 ( 4- 4,10-10) arrange gtable[layout]
28 ( 1- 1,11-11) arrange gtable[guide-box]
ERPdata_agg2 <- subset(ERPdata_agg[,-1],ERPdata_agg[,-1]$Condition == "word")
scalp_plot(chan_data=ERPdata_agg2[,-1],frames=1:426,datacol=2:427,chancol=1,cpvarcol=NULL,
ylim=c(-5,5),color="purple")
[1] "The following electrodes will not be plotted :"
[1] "T3" "T4" "T5" "T6" "A2" "VEOG1" "HEOG1"
TableGrob (9 x 10) "arrange": 27 grobs
z cells name grob
Fp1 1 ( 1- 1, 5- 5) arrange gtable[layout]
Fp2 2 ( 1- 1, 7- 7) arrange gtable[layout]
F3 3 ( 3- 3, 4- 4) arrange gtable[layout]
F4 4 ( 3- 3, 8- 8) arrange gtable[layout]
C3 5 ( 5- 5, 4- 4) arrange gtable[layout]
C4 6 ( 5- 5, 8- 8) arrange gtable[layout]
P3 7 ( 7- 7, 4- 4) arrange gtable[layout]
P4 8 ( 7- 7, 8- 8) arrange gtable[layout]
O1 9 ( 9- 9, 5- 5) arrange gtable[layout]
O2 10 ( 9- 9, 7- 7) arrange gtable[layout]
F7 11 ( 3- 3, 2- 2) arrange gtable[layout]
F8 12 ( 3- 3,10-10) arrange gtable[layout]
CZ 13 ( 5- 5, 6- 6) arrange gtable[layout]
FZ 14 ( 3- 3, 6- 6) arrange gtable[layout]
PZ 15 ( 7- 7, 6- 6) arrange gtable[layout]
FCZ 16 ( 4- 4, 6- 6) arrange gtable[layout]
CPZ 17 ( 6- 6, 6- 6) arrange gtable[layout]
CP3 18 ( 6- 6, 4- 4) arrange gtable[layout]
CP4 19 ( 6- 6, 8- 8) arrange gtable[layout]
FC3 20 ( 4- 4, 4- 4) arrange gtable[layout]
FC4 21 ( 4- 4, 8- 8) arrange gtable[layout]
TP7 22 ( 6- 6, 2- 2) arrange gtable[layout]
TP8 23 ( 6- 6,10-10) arrange gtable[layout]
FPZ 24 ( 1- 1, 6- 6) arrange gtable[layout]
OZ 25 ( 9- 9, 6- 6) arrange gtable[layout]
FT7 26 ( 4- 4, 2- 2) arrange gtable[layout]
FT8 27 ( 4- 4,10-10) arrange gtable[layout]
ERPdata_agg3 <- subset(ERPdata_agg2,ERPdata_agg2$Channel %in% c("CZ","PZ","CPZ","TP7","TP8","F7","F8"))
ERPdata_agg3$Channel <- as.factor(as.character(ERPdata_agg3$Channel))
scalp_plot(chan_data=ERPdata_agg3[,-1],
frames=1:426,
datacol=2:427,
chancol=1,
cpvarcol=NULL,
ylim=c(-5,5),
color="purple")
[1] "The following electrodes will not be plotted :"
character(0)
TableGrob (7 x 10) "arrange": 7 grobs
z cells name grob
CPZ 1 ( 6- 6, 6- 6) arrange gtable[layout]
CZ 2 ( 5- 5, 6- 6) arrange gtable[layout]
F7 3 ( 3- 3, 2- 2) arrange gtable[layout]
F8 4 ( 3- 3,10-10) arrange gtable[layout]
PZ 5 ( 7- 7, 6- 6) arrange gtable[layout]
TP7 6 ( 6- 6, 2- 2) arrange gtable[layout]
TP8 7 ( 6- 6,10-10) arrange gtable[layout]