Replies: 1 comment
-
Hi @ontinglo, I wouldn't do this in the I also wouldn't suggest using the Here are the steps for calculating the mean and saving it to the data:
Here's an example of averaging the RT values from responses to a series of images and saving the mean RT to the data. var trial_procedure = {
timeline: [fixation, trial],
timeline_variables: trial_info,
on_timeline_finish: function() {
var all_rt_values = jsPsych.data.get().filter({trial_type:'image-keyboard-response'}).select('rt').subset(function(x){ return x !== null; });
var rt_mean = all_rt_values.mean();
jsPsych.data.get().addToLast({mean: rt_mean});
}
}; In your case, I'm not sure that you can easily filter the trials with a trial trust value in your data. So I suggest adding a flag in the data for those trials, something like on_finish: function() {
var all_trial_trust_values = jsPsych.data.get().filter({task_part: 'trial_trust'}).select('Trial_Trust_Value').subset(function(x){ return x !== null; });
var trial_trust_mean = all_trial_trust_values .mean();
jsPsych.data.get().addToLast({trial_trust_mean: trial_trust_mean});
jsPsych.data.get().localSave('csv', 'pilot_v5_mydata_Murk.csv');
} I hope this helps! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
hi all
I want to calculate the average value of a column of data and save the average value in a new column in the .csv file. Like what is shown below:
Before

After

I don't know in where (now i write codes in jsPsych.init() and what codes should I add to achieve such purposes. What I have right now is like the following, apparently it does not work. could you please give me some advice?
thanks a lot!
Beta Was this translation helpful? Give feedback.
All reactions