Replies: 1 comment 2 replies
-
Hi Ivonne, You can use the data parameter of the trial to add a unique identifier for each question. Then you can use the .filter() method to get data from the trial that matches that identifier. var trial = {
type: 'survey-text',
questions: [{prompt: 'What is your name?'}],
data: {
question_id: 'name'
}
}
jsPsych.data.get().filter({question_id: 'name'}) |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone,
I'm quite new to jspsych and I have run into a problem while coding a simple online questionnaire.
The entire structure of the questionnaire consists of if nodes, because the appearance of all following questions depends on the responses in the first survey-likert type item and/or following items.
My problem now is that I can't simply use
var data = jsPsych.data.get().last(1).values()[0];
to access the responses from the previous trials because as I understand, last() needs the exact number of previous trials (it breaks down if I put more than have been collected)- which is not possible because some people get more questions than others, depending on their responses.
Using
var first_qu = jsPsych.data.get().filter({trial: 'survey-likert'})//.values()[0];
also doesn't work for some reason and isn't helpful for the entire experiment,
neither does
var data = jsPsych.data.getDataByTimelineNode(0.0-1.0)
Can anyone suggest a different way to access the individual question responses without referring to their sequence in the data frame?
Thanks & best
Ivonne
Beta Was this translation helpful? Give feedback.
All reactions