PennController for IBEX › Forums › Support › Logging Question Chosen-Option › Reply To: Logging Question Chosen-Option
![](https://www.pcibex.net/wp-content/uploads/2018/10/IMG_8365-e1540835663655-150x150.jpg)
Hi Juliana,
Unfortunately the Question controller was written in a way that it reports the content of the selected answer, not its index. However, since you are logging the content of both questions, you can compare the content of the answer to those columns and determine the index of the chosen answer, which you can then compare to the expected index. For example, here is a line from a test-run of mine, with a header line with column names before it for clarity:
ReceptionTime,MD5,Controller,Item,Element,Label,Group,PennElementType,PennElementName,Parameter,Value,EventTime,Frase1,Frase2,Condition,Item,Group,Expected,Correct,Time,Comments 752,REDACTED,PennController,11,0,item,NULL,Controller-Question,Question,NULL,Ou hoje ou amanhã fomos à praia.,1684831742806,Ou hoje ou amanhã iremos à praia.,Ou hoje ou amanhã fomos à praia.,TREINO,1,U,1,NULL,1967
In R for example, and assuming results
only contain rows for that Question controller, I would do something like this:
results$AnswerIndex <- 1 + (results$Value == results$Frase2) results$Accurate <- results$AnswerIndex == results$Expected
Note, however, that the Question controller already comes with a hasCorrect
option, so you could do newController("Question", {q: "", as: [variable.Frase1, variable.Frase2], hasCorrect: parseInt(variable.Expected)-1})
. Then you'd have a 1 reported for correct answers and a 0 for incorrect answers
Jeremy