PennController for IBEX › Forums › Support › reaction time results appear in different two columns › Reply To: reaction time results appear in different two columns
Hi,
For this illustration, I created a dummy experiment with just two trials:
newTrial( "rich_columns" , newController("DashedSentence", {s: "This is a first test sentence"}) .log() .print() .wait() ) .log("extra_column1", "value of extra colum 1") .log("extra_column2", "value of extra colum 2") newTrial( "poor_columns" , newController("DashedSentence", {s: "This is a second test sentence"}) .log() .print() .wait() )
I took the experiment once, and ended up with this results file (comment lines removed, MD5 hash replaced):
1603727411,MD5ID,PennController,0,0,rich_columns,NULL,PennController,0,_Trial_,Start,1603727373087,value of extra colum 1,value of extra colum 2,NULL 1603727411,MD5ID,PennController,0,0,rich_columns,NULL,Controller-DashedSentence,DashedSentence,1,This,1603727376797,value of extra colum 1,value of extra colum 2,289,false,This is a first test sentence,Any addtional parameters were appended as additional columns 1603727411,MD5ID,PennController,0,0,rich_columns,NULL,Controller-DashedSentence,DashedSentence,2,is,1603727376797,value of extra colum 1,value of extra colum 2,251,false,This is a first test sentence,Any addtional parameters were appended as additional columns 1603727411,MD5ID,PennController,0,0,rich_columns,NULL,Controller-DashedSentence,DashedSentence,3,a,1603727376797,value of extra colum 1,value of extra colum 2,215,false,This is a first test sentence,Any addtional parameters were appended as additional columns 1603727411,MD5ID,PennController,0,0,rich_columns,NULL,Controller-DashedSentence,DashedSentence,4,first,1603727376797,value of extra colum 1,value of extra colum 2,236,false,This is a first test sentence,Any addtional parameters were appended as additional columns 1603727411,MD5ID,PennController,0,0,rich_columns,NULL,Controller-DashedSentence,DashedSentence,5,test,1603727376797,value of extra colum 1,value of extra colum 2,229,false,This is a first test sentence,Any addtional parameters were appended as additional columns 1603727411,MD5ID,PennController,0,0,rich_columns,NULL,Controller-DashedSentence,DashedSentence,6,sentence,1603727376797,value of extra colum 1,value of extra colum 2,291,false,This is a first test sentence,Any addtional parameters were appended as additional columns 1603727411,MD5ID,PennController,0,0,rich_columns,NULL,PennController,0,_Trial_,End,1603727376807,value of extra colum 1,value of extra colum 2,NULL 1603727411,MD5ID,PennController,1,0,poor_columns,NULL,PennController,1,_Trial_,Start,1603727376828,NULL 1603727411,MD5ID,PennController,1,0,poor_columns,NULL,Controller-DashedSentence,DashedSentence,1,This,1603727378601,240,false,This is a second test sentence,Any addtional parameters were appended as additional columns 1603727411,MD5ID,PennController,1,0,poor_columns,NULL,Controller-DashedSentence,DashedSentence,2,is,1603727378601,205,false,This is a second test sentence,Any addtional parameters were appended as additional columns 1603727411,MD5ID,PennController,1,0,poor_columns,NULL,Controller-DashedSentence,DashedSentence,3,a,1603727378601,169,false,This is a second test sentence,Any addtional parameters were appended as additional columns 1603727411,MD5ID,PennController,1,0,poor_columns,NULL,Controller-DashedSentence,DashedSentence,4,second,1603727378601,247,false,This is a second test sentence,Any addtional parameters were appended as additional columns 1603727411,MD5ID,PennController,1,0,poor_columns,NULL,Controller-DashedSentence,DashedSentence,5,test,1603727378601,215,false,This is a second test sentence,Any addtional parameters were appended as additional columns 1603727411,MD5ID,PennController,1,0,poor_columns,NULL,Controller-DashedSentence,DashedSentence,6,sentence,1603727378601,246,false,This is a second test sentence,Any addtional parameters were appended as additional columns 1603727411,MD5ID,PennController,1,0,poor_columns,NULL,PennController,1,_Trial_,End,1603727378605,NULL
I saved the file as results.csv and then used this R script:
# First read the results file all_results <- read.csv("results.csv", header=F, sep=",", quote='"', comment.char='#') # We will work on the DashedSentence lines only dashed_results <- all_results # Name the columns based on the longer lines (ie the ones with extra1 and extra2) names(dashed_results) <- c("SubmitTime","MD5","Controller","ItemN","ElementN","Label","Group", "Type","Name","Param","Value","EventTime","Extra1","Extra2", "RT","LineBreak","Sentence","Comments") # Keep only the DashedSentence lines dashed_results <- subset(dashed_results, Type=="Controller-DashedSentence") # Let us first make the columns character-based instead of factors dashed_results$Comments <- as.character(dashed_results$Comments) dashed_results$Sentence <- as.character(dashed_results$Sentence) dashed_results$LineBreak <- as.character(dashed_results$LineBreak) dashed_results$RT <- as.character(dashed_results$RT) dashed_results$Extra2 <- as.character(dashed_results$Extra2) dashed_results$Extra1 <- as.character(dashed_results$Extra1) # Let us identify the short lines (the ones without extra1 and extra2) short_lines <- dashed_results$Label=="poor_columns" # Now let us move the columns dashed_results[short_lines,'Comments'] <- dashed_results[short_lines,'LineBreak'] dashed_results[short_lines,'Sentence'] <- dashed_results[short_lines,'RT'] dashed_results[short_lines,'LineBreak'] <- dashed_results[short_lines,'Extra2'] dashed_results[short_lines,'RT'] <- dashed_results[short_lines,'Extra1'] dashed_results[short_lines,'Extra2'] <- NA dashed_results[short_lines,'Extra1'] <- NA # Done!
You’ll have to adapt this code to your case, of course. For example, I only have two extra-columns (the ones inserted by .log on newTrial) but judging from what you reported, it looks like you have 5 extra columns in your target items. Also, I labeled my trials rich_columns and poor_columns which, respectively, correspond to your target and filler items.
I chose to keep the extra columns and fill them with NAs for the poor_columns lines, but alternatively you could just remove them altogether, in which case you would first need to move the columns of long_lines instead.
Let me know if you have questions
Jeremy