jeudi 19 septembre 2019

How to create subgroups of a fixed number of subjects out of a large group?

I am analyzing data from an experiment composed of 60 subjects. Every subject made a decision which is numerical. I need to create groups of 3 subjects out of the 60, so that at the end I will have 20 groups of three and then take the decisions of each group member and calculate the sum of the value of their decisions, according to the group membership.

I have tried this code which works in reshuffling the group:

students=1:60; rand_students=sample(students,length(students));

But I need not only to reshuffle them but to pick their decision and then calculate their average by group




Aucun commentaire:

Enregistrer un commentaire