Select a specific row of the csv file depending on the previous trial?

Dear all,
Is it possible to select a specific row of the csv file depending on the previous row? For example, I have a csv file with 236 rows and, among other things, a variable called “list” with the characteristics “listA”, “listB” or “listC” for each row. I want to define that if the previous trial was a “listA” row, the current row of the csv file should be a “listB” row or a “listC” row (and vice versa for “listB” and “listC”). Any ideas?
Thanks in advance.

Best wishes
Kati

Have a look at my Randomisation without repetition online demo for a potential solution to this.

Great, thank you. I managed to avoid a direct repeat with your code!
However, is there a way to prevent additional trials from being added to the new list? I need the fixed number of different trialTypes set in the original list.

Best wished
Kati

Hi Kati,

Did you see this bit in the description?

Since there is a danger that doing this on the fly can end up with an insoluble problem (for example, the final two trials are of the same trial type), this method will add an extra trial into the new list. The participant may therefore end up seeing one or two additional trials in the experiment, but they can easily be excluded from the analysis if desired, using column that records the presentation number.

Hi there,

Yes, I read that, and one or two extra trials would have been manageable. However, I ended up with 36 additional trials. Since the number of trials should be approximately the same as in the original csv file, I was wondering if there is an alternative method or if one can limit these additional trials?

Best,
Kati

Please could you check your data? That should only happen if two trial types have completed when the third still has 36 left to go. Possibly that is just random fluctuation. At what trial number did each of the three trial types hit their desired limit? I’ll have to have a think about an alternative method which works with larger numbers of trials.