How to calculate multiple correlation matrices by looping through subset (based on feature values)
I have a data set that contains student names, their marks in different courses and the number of times they showed up for classes, like e.g.:
Max Mustermann | Database Technology | 2.3 | 10
Max Mustermann | Computer Science Intro | 1.3 | 12
Maria Musterfrau | Computer Science Intro | 2.0 | 13
So Max showed up 10 times at DB and got a 2.3 (mark) in the end.
Now, for each student in the data set, I want to calculate the correlation coefficient between mark and number of times attended.
The output should look like this:
Student name | Correlationcoefficient between mark and number of times attended (considering all courses the respective student took)
Max Mustermann | 0,711
Maria Musterfrau | -0,312
Everything works fine, except that I don't know how to best do the looping and producing the final table (e.g. using "correlation matrix").
I would appreciate your help. Thanks in advance and kind regards.