Chi-Lin Yu
A reason workflow from user's perspective
head(dta[,1:8],5)
Channel Experiment Condition Subject AveRT IQ value.1 value.2
13 T3 Exp1 nonword subj1 0.01340599 65 1.809247 1.9723400
14 T4 Exp1 nonword subj1 0.01340599 65 1.064528 1.1616680
15 T5 Exp1 nonword subj1 0.01340599 65 -2.184362 -2.2619550
16 T6 Exp1 nonword subj1 0.01340599 65 0.134014 0.4524255
17 CZ Exp1 nonword subj1 0.01340599 65 -2.501931 -3.2716440
tail(dta[,1:8],5)
Channel Experiment Condition Subject AveRT IQ value.1 value.2
1344 FZ Exp1 word subj9 4.452716 84 1.763616 2.512715
1345 PZ Exp1 word subj9 4.452716 84 2.450751 3.467061
1346 FCZ Exp1 word subj9 4.452716 84 2.039289 2.840635
1347 CPZ Exp1 word subj9 4.452716 84 2.420711 3.365350
1348 CP3 Exp1 word subj9 4.452716 84 2.272059 3.157104
str(dta[,1:9],digits.d=1)
'data.frame': 200 obs. of 9 variables:
$ Channel : Factor w/ 10 levels "CP3","CPZ","CZ",..: 7 8 9 10 3 5 6 4 2 1 ...
$ Experiment: chr "Exp1" "Exp1" "Exp1" "Exp1" ...
$ Condition : Factor w/ 2 levels "nonword","word": 1 1 1 1 1 1 1 1 1 1 ...
$ Subject : Factor w/ 10 levels "subj1","subj2",..: 1 1 1 1 1 1 1 1 1 1 ...
$ AveRT : num 0.01 0.01 0.01 0.01 0.01 ...
$ IQ : num 65 65 65 65 65 ...
$ value.1 : num 1.8 1.1 -2.2 0.1 -2.5 ...
$ value.2 : num 2 1.2 -2.3 0.5 -3.3 ...
$ value.3 : num 0.9 0.7 -1.3 0.6 -2.7 ...
timepoint <- seq(0,1700,by=4)
Fig0 <- edaplot(data = dta,
frames = timepoint ,
datacol=7:433,
subjcol=4,
chancol=1,
othvarcol=c(2:3,5:6))+
geom_line(aes(col=Condition))+
facet_grid(Channel~Subject)
timepoint <- seq(0,1700,by=4)
Fig1 <- edaplot(data = dta,
frames = timepoint ,
datacol=7:432,
subjcol=4,
chancol=1,
othvarcol=c(2:3,5:6),
select_subj = c("subj2","subj10"),
select_chan = c("PZ","CPZ"))+
geom_line(aes(col=Condition))+
facet_grid(Channel~Subject)+
theme_bw()
timepoint <- seq(0,1700,by=4)
Fig2 <- edaplot(data = dta,
frames = timepoint ,
datacol=7:432,
subjcol=4,
chancol=1,
othvarcol=c(2:3,5:6),
select_chan = c("PZ","CPZ"),
outlinesub = "subj2",
outcolor = "red")+
facet_grid(.~Channel)+
theme_bw()
Fig3 <- edaplot(data = dta,
frames = timepoint ,
datacol=7:432,
subjcol=4,
chancol=1,
othvarcol=c(2:3,5:6),
select_chan = c("PZ","CPZ"),
outlinesub = "subj10",
outcolor = "green")+
facet_grid(.~Channel)+
theme_bw()
dta2 <- data_select(data = dta,
frames = timepoint ,
datacol=7:432,
subjcol=4,
chancol=1,
othvarcol=c(2:3,5:6),
select_subj = c(paste("subj",c(1,3:9),sep="")))
head(dta2[,1:8])
Channel Experiment Condition Subject AveRT IQ value.1 value.2
1 T3 Exp1 nonword subj1 0.01340599 65 1.809247 1.9723400
2 T4 Exp1 nonword subj1 0.01340599 65 1.064528 1.1616680
3 T5 Exp1 nonword subj1 0.01340599 65 -2.184362 -2.2619550
4 T6 Exp1 nonword subj1 0.01340599 65 0.134014 0.4524255
5 CZ Exp1 nonword subj1 0.01340599 65 -2.501931 -3.2716440
6 FZ Exp1 nonword subj1 0.01340599 65 -2.422126 -2.8691950
dta3 <- downsample(data = dta2,
datacol = 7:432,
binwidth = 10,
movinginterval=5)
timepoint2 <- seq(1,1700,by = 16.1)
Fig4 <- edaplot(data = dta3,
frames = timepoint2 ,
datacol= 7:112,
subjcol=4,
chancol=1,
othvarcol=c(2:3,5:6))+
geom_line(aes(col=Subject))+
facet_wrap(~Channel)
Fig5 <- edaplot(data = dta3,
frames = timepoint2 ,
datacol= 7:112,
subjcol=4,
chancol=1,
othvarcol=c(2:3,5:6))+
geom_line(aes(col=Condition))+
facet_wrap(~Channel)+
stat_summary(aes(group=Condition,shape=Condition),
fun.y = "mean",col = "purple",size = 1, geom = "point")+
theme_bw()+
theme(legend.position="bottom")+
labs(list(x="Signal",y="Time Points"))
Fig6 <- edaplot(data = dta3,
frames = timepoint2 ,
datacol= 7:112,
subjcol=4,
chancol=1,
othvarcol=c(2:3,5:6))+
geom_line(aes(col=IQ))+
facet_wrap(~Channel)+
scale_color_continuous(low="pink",high="red")+
theme_bw()
#head(dta3[1:8])
dtasum <- data_summarize(data=dta3,
frames = timepoint2,
datacol = c(7:112,5,6),
subjcol = 4,
chancol = 1,
othvarcol = c(2:3,5:6),
summarycol= c(1,3),
fun=mean)
head(dtasum[,c(1:3,108:110)])
Channel Condition value.1 value.106 AveRT IQ
1 CP3 nonword 0.28431756 -1.7114410 2.5333 78.375
2 CPZ nonword 0.32909478 0.6572579 2.5333 78.375
3 CZ nonword 0.14390679 0.2463680 2.5333 78.375
4 FCZ nonword 0.05660090 -1.0273331 2.5333 78.375
5 FZ nonword -0.05661048 -2.1258145 2.5333 78.375
6 PZ nonword 0.48773763 0.1641567 2.5333 78.375
Fig7 <- edaplot(data = dtasum,
frames = timepoint2 ,
datacol= 3:108,
subjcol=NULL,
chancol=1,
othvarcol=c(2,109:110))+
geom_line(aes(col=Condition,size=as.factor(round(AveRT,1))))+
facet_wrap(~Channel)+
theme_bw()+
scale_size_discrete(name="Average RT",range=c(1,2))+
theme(legend.position="bottom")+
labs(list(title="Average ERP curve",x="Signal",y="Time Points"))
Fig8 <- edaplot(data = dtasum,
frames = timepoint2 ,
datacol= 3:108,
subjcol=NULL,
chancol=1,
othvarcol=c(2,109:110),
select_chan = c("T3","T4","PZ"))+
geom_line(aes(col=Condition))+
facet_grid(Channel~.)+
theme_bw()+
theme(legend.position="bottom")+
labs(list(title="Average ERP curve",x="Signal",y="Time Points"))
Fig9 <- Fig8+geom_vline(xintercept = c(400:450),col="pink",alpha=0.1)+
theme(legend.position=c(0.7,0.95),legend.direction="horizontal",
legend.key.size =unit(0.3, "cm"))