I have a large dataframe in RStudio (15,000 rows, 300 columns) and its a mess. It looks somewhat like this:
ID Exam1 Exam2 Exam3..... Exam299
1 75 76 99 100
2 25 25 25 25
2 22 20 22 22
2 25 25 20 22
2 20 20 25 23
3 79 88 92 96
For each individual student ID I want to add all the individual columns so each student only has 1 row associated with him/her. It should look like this:
ID Exam1 Exam2 Exam3 Exam299
1 75 76 99 100
2 92 90 92 92
3 79 88 92 96
Everything I've tried sums only one column at a time and/or combines entries without summing them:
aggregate(ID~Exam1, data=df, c)