PennController for IBEX › Forums › Support › Trouble logging participant information › Reply To: Trouble logging participant information
April 29, 2021 at 12:46 pm
#6898
Jeremy
Keymaster
Hi Zara,
There is no documentation about it, but it’s a matter of adding columns to each Selector row that will report the position and filename of the selected image. There are many ways of doing this, one option using the dplyr
package is (assuming you have loaded your results file in a variable named results
using the function read.pcibex
):
library("dplyr") results$Value<-as.character(results$Value) results$picture1<-as.character(results$picture1) results$picture2<-as.character(results$picture2) results$picture3<-as.character(results$picture3) results$picture4<-as.character(results$picture4) getImage <- function(value,p1,p2,p3,p4){ c(picture1=p1,picture2=p2,picture3=p3,picture4=p4)[value] } getPosition <- function(value,comments){ c("top-left","top-right","bottom-left","bottom-right")[ which(strsplit(as.character(comments), ";")[[1]] == value) ] } choices <- results %>% filter(PennElementType=="Selector") %>% rowwise() %>% mutate(ChosenPosition=getPosition(Value,Comments)) %>% mutate(ChosenImage=getImage(Value,picture1,picture2,picture3,picture4))
The choices
variable will contain a tibble with two additional columns, ChosenPosition and ChosenImage
Let me know if you have questions
Jeremy