I have the following dataset:
absences G1 G2 G3
1 6 5 6 6
2 4 5 5 6
3 10 7 8 10
4 2 15 14 15
5 4 6 10 10
Each of the columns G1, G2 and G3 are different measurement of a given variable of interest. I would like to have another dataset like with 3 columns: absences, a key indicating which measurement is that and the value. For instance, stacking the columns above.
I have taken a look online and the gather() function from tidyr seems the way to go. However, I couldn't understand really well its syntax. Could anyone help me? Thank you a lot in advance!