Commit 014ffe42 authored by Bonte Bruno's avatar Bonte Bruno

En cours de reorganisation de l'orga des données

	* Attention le projet est d'avoir un dépot specifique pour les
données..
parent 23c46345
#Addapted from the script IAT-master
#load basic libraries for graphs
library(dplyr)
library(tidyr)
library(ggplot2)
library(stringr)
library(lubridate)
# Give sessions dates to estimate if iat tests
# are performed pre/during/post/NO sessions
sessionCode =c("tcld3490",)
sessionDate =c("2020-02-24 10:00:00 CET",)
sessionType =c("T1",)
sessions = data.frame() %>%
tbl_df()
# Set the path to the IAT folder here (be sure to include trailing slash)
# on Linux (use a single forward slash):
......@@ -17,46 +29,6 @@ fd = '/'
expe.name = "expe-lem"
output.dir = paste(base.dir,"data",fd,expe.name,sep="")
# Summary from IATmaster package analysis
#----------------------------------------
setwd(output.dir)
output.files = list.files()
data.list = lapply(output.files, read.table, sep = ",")
summarized <- data.frame(matrix(ncol=9,nrow=length(data.list)))
names(summarized) <- c("Id","Date","Block4.m","Block4.sd","Block7.m","Block7.sd","diff","full.sd",'d')
for(i in 1:length(data.list))
{
filename = strsplit(output.files[i],'-')
id = filename[[1]][2]
iat.date = paste(filename[[1]][4],"-",filename[[1]][5],"-",filename[[1]][3]," ",filename[[1]][6],":",substr(filename[[1]][7],1,2),sep="")
block4.m = mean(as.numeric(unlist(subset(data.list[[i]], V1==3 & V6>300 & V6 < 3000, select="V6"))))
block7.m = mean(as.numeric(unlist(subset(data.list[[i]], V1==6 & V6>300 & V6 < 3000, select="V6"))))
block4.sd = sd(as.numeric(unlist(subset(data.list[[i]], V1==3 & V6>300 & V6 < 3000, select="V6"))))
block7.sd = sd(as.numeric(unlist(subset(data.list[[i]], V1==6 & V6>300 & V6 < 3000, select="V6"))))
full.sd = sd(as.numeric(unlist(subset(data.list[[i]], (V1==6 | V1==3) & V6>300 & V6 < 3000, select="V6"))))
diff = block7.m - block4.m
d = diff / full.sd
summarized[i,] = c(id, iat.date, block4.m, block4.sd, block7.m, block7.sd, diff, full.sd, d)
}
rm(block4.m,block4.sd,block7.m,block7.sd,d,data.list,diff,filename,full.sd,i,iat.date,id,output.files)
setwd(paste(base.dir,"data",sep=""))
write.csv(summarized %>%
mutate(Block4.m = as.numeric(Block4.m)) %>%
mutate(Block4.sd = as.numeric(Block4.sd)) %>%
mutate(Block7.m = as.numeric(Block7.m)) %>%
mutate(Block7.sd = as.numeric(Block7.sd)) %>%
mutate(diff = as.numeric(diff)) %>%
mutate(d = as.numeric(d)) %>%
mutate(full.sd = as.numeric(full.sd)),
paste0("summarized-", expe.name,".csv"),
row.names = F)
summarized %>% tbl_df()
# Compilation of all datas of an experiment in a single file
#----------------------------------------
......@@ -76,6 +48,8 @@ for(i in 1:length(data.list))
"error",
"reactionTime")
dat$id <- filename[[1]][2]
dat$date <- as.Date(paste(filename[[1]][3:5], collapse = "-"))
dat$time <- as.Date(paste(c(filename[[1]][6:7],"00"), collapse = ":"))
alldata <- alldata %>%
rbind(dat)
}
......@@ -84,6 +58,7 @@ alldata <- alldata %>%
tbl_df()
setwd(paste(base.dir,"data",sep=""))
write.csv(alldata,
paste0("alldata-", expe.name,".csv"),
paste0("iat-times-", expe.name,".csv"),
row.names = F)
# Set the path to the IAT folder here (be sure to include trailing slash)
# on Linux (use a single forward slash):
base.dir = "~/git/aiat/"
# on Windows (use double forward slashes):
# base.dir = "C://Users//winteram//Documents//IAT//"
# File delimiter = '/' for Unix/Max, '//' for Windows
fd = '/'
# Set the template you want to analyze here
expe.name = "expe-lem"
output.dir = paste(base.dir,"data",fd,expe.name,sep="")
# Summary from IATmaster package analysis
#----------------------------------------
setwd(output.dir)
output.files = list.files()
data.list = lapply(output.files, read.table, sep = ",")
summarized <- data.frame(matrix(ncol=9,nrow=length(data.list)))
names(summarized) <- c("Id","Date","Block4.m","Block4.sd","Block7.m","Block7.sd","diff","full.sd",'d')
for(i in 1:length(data.list))
{
filename = strsplit(output.files[i],'-')
id = filename[[1]][2]
iat.date = paste(filename[[1]][4],"-",filename[[1]][5],"-",filename[[1]][3]," ",filename[[1]][6],":",substr(filename[[1]][7],1,2),sep="")
block4.m = mean(as.numeric(unlist(subset(data.list[[i]], V1==3 & V6>300 & V6 < 3000, select="V6"))))
block7.m = mean(as.numeric(unlist(subset(data.list[[i]], V1==6 & V6>300 & V6 < 3000, select="V6"))))
block4.sd = sd(as.numeric(unlist(subset(data.list[[i]], V1==3 & V6>300 & V6 < 3000, select="V6"))))
block7.sd = sd(as.numeric(unlist(subset(data.list[[i]], V1==6 & V6>300 & V6 < 3000, select="V6"))))
full.sd = sd(as.numeric(unlist(subset(data.list[[i]], (V1==6 | V1==3) & V6>300 & V6 < 3000, select="V6"))))
diff = block7.m - block4.m
d = diff / full.sd
summarized[i,] = c(id, iat.date, block4.m, block4.sd, block7.m, block7.sd, diff, full.sd, d)
}
rm(block4.m,block4.sd,block7.m,block7.sd,d,data.list,diff,filename,full.sd,i,iat.date,id,output.files)
setwd(paste(base.dir,"data",sep=""))
write.csv(summarized %>%
mutate(Block4.m = as.numeric(Block4.m)) %>%
mutate(Block4.sd = as.numeric(Block4.sd)) %>%
mutate(Block7.m = as.numeric(Block7.m)) %>%
mutate(Block7.sd = as.numeric(Block7.sd)) %>%
mutate(diff = as.numeric(diff)) %>%
mutate(d = as.numeric(d)) %>%
mutate(full.sd = as.numeric(full.sd)),
paste0("summarized-", expe.name,".csv"),
row.names = F)
summarized %>% tbl_df()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment