I'm a freshman learning R, and I am stuck on some homework.
Data frame:
student HW1 HW2 EXAM1 HW3 HW4
A 100 95 80 96 100
B 98 100 89 100 100
C 90 95 90 88 90
My question is how do I create a new column that contains the homework average
? This new column should be the last column and aligned to each student.
The apply function, grep function and rowMeans
may be used in this assignment.
What should I try next?